Multithreading menu

User Tag List

Results 1 to 7 of 7
  1. #1
    J0llyGr33n's Avatar Corporal
    Reputation
    1
    Join Date
    Sep 2011
    Posts
    20
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multithreading

    Hey guys I am going to keep it short and sweet.

    So I was switching all of my console tools to a GUI and everything was working fine until I attempted to implement Multithreading.

    The error was:
    Code:
    (350): error C2664: '_beginthreadex' : cannot convert parameter 3 from 'void (__clrcall *)(void *)' to 'unsigned int (__stdcall *)(void *)'
    According to MSDN I should be using __clrcall as I am in the call below --
    Code:
    				if(_beginthreadex(NULL, 0, CastLine, NULL, 0, &threadid1) == 0)
    				{
    					label7->Text = "0"; // move to MesageBox::show later.
    				}
    The CastLine function is:
    Code:
    void __clrcall CastLine(void *arg){
            HWND hWnd = FindWindowA(NULL, (LPCSTR)("World of Warcraft"));
    	while(true)
    	{
    		PostMessageW(hWnd, WM_KEYDOWN, VK_F1, 0);
    		PostMessageW(hWnd, WM_KEYUP, VK_F1, 0);
    		Sleep(19000); //Sleeps for 19 seconds before casting again.
    	}
    }
    As far as I can tell it looks right. Googlefu brought me to an old post from 2010
    Missing definitions for _beginthreadex and _beginthread in process.h | Microsoft Connect
    (considering its the version of VS10 I am using)

    says no work around found -- only 3 useless post.

    Best option i can think of is to find an old versions process.h

    What do you guys think I should do?

    Multithreading
  2. #2
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change the function definition so it's no longer __clrcall. Change it to the proper type.

  3. #3
    J0llyGr33n's Avatar Corporal
    Reputation
    1
    Join Date
    Sep 2011
    Posts
    20
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can't use __stdcall with /clr:ure

    error C3641: 'CastLine' : invalid calling convention '__stdcall ' for function compiled with /clrure or /clr:safe

  4. #4
    sitnspinlock's Avatar Elite User CoreCoins Purchaser
    Reputation
    398
    Join Date
    Sep 2010
    Posts
    439
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can still use CreateThread with clr : pure.

    what is your reasoning for using _beginthreadex?

  5. #5
    J0llyGr33n's Avatar Corporal
    Reputation
    1
    Join Date
    Sep 2011
    Posts
    20
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought that CreateThread was an __stdcall, thus not usable.

    Testing now to check.

    ---------- Post added at 10:25 PM ---------- Previous post was at 10:16 PM ----------

    Sorry for double post
    //same function I use for my Console app
    Code:
    DWORD WINAPI CastLine(LPVOID arg)
    {
    	while(true)
    	{
    		HWND hWnd = FindWindowA(NULL, (LPCSTR)("World of Warcraft"));
    		PostMessage(hWnd, WM_KEYDOWN, VK_F1, 0);
    		PostMessage(hWnd, WM_KEYUP, VK_F1, 0);
    		Sleep(19000);
    	}
    	return 0;
    }
    call
    Code:
    CreateThread(NULL, 0, CastLine, NULL, 0, &threadid1);
    error
    Code:
    error C3641: 'CastLine' : invalid calling convention '__stdcall ' for function compiled with /clr:pure or /clr:safe
    error C2664: 'CreateThread' : cannot convert parameter 3 from 'DWORD (__stdcall *)(LPVOID)' to 'LPTHREAD_START_ROUTINE'

  6. #6
    sitnspinlock's Avatar Elite User CoreCoins Purchaser
    Reputation
    398
    Join Date
    Sep 2010
    Posts
    439
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so change it to just /clr? ;p

  7. #7
    J0llyGr33n's Avatar Corporal
    Reputation
    1
    Join Date
    Sep 2011
    Posts
    20
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh now I just feel silly! Thank you very much Everdox.

Similar Threads

  1. [Release] [FREE] PokémonGO Banchecker/Accountstats-Updater [Multithread, Proxysupport]
    By Robind2604 in forum Pokemon GO Hacks|Cheats
    Replies: 19
    Last Post: 08-23-2016, 08:32 AM
  2. Replies: 3
    Last Post: 10-16-2012, 02:31 AM
  3. [help] Process Handle and multithreading
    By Myryador in forum WoW Memory Editing
    Replies: 4
    Last Post: 11-03-2011, 12:41 AM
  4. [help request] multithreading, delegates, events
    By abuckau907 in forum Programming
    Replies: 0
    Last Post: 08-06-2009, 03:17 AM
All times are GMT -5. The time now is 05:09 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search