Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++] GUI/DLL help
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Wed Jun 25, 2008 7:57 pm    Post subject: Reply with quote

CreateThread and ExitThread

Code Snippet: (Sorry if there are errors, because im typing it from scratch)
Code:
void FreezeValue( HWND hWnd )
{
    while ( IsDlgButtonChecked( hWnd, ID_CHECKBOX1 ) == BST_CHECKED )
    {
        DWORD dwWeight = (DWORD)(GetDlgItemInt( hWnd, WEIGHT_EDIT, NULL, FALSE ) );
        // You should probably declare your Weight variable globally so you can just do:
        // *(DWORD*)dwWeight = ...
        Sleep( 50 );
    }
    ExitThread( 0 );
}

LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
    //...
    case WM_COMMAND:
          switch ( LOWORD(wParam) )
          {
                case ID_CHECKBOX1:
                        if ( IsDlgButtonChecked( hWnd, ID_CHECKBOX1 ) == BST_CHECKED )                           
                            CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)FreezeValue, hWnd, 0, 0 );
                        break;
          }
          break;
    //...
}

_________________
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Wed Jun 25, 2008 8:05 pm    Post subject: Reply with quote

This crap pisses me off because i released the source to my valuereader.dll that has a prime example of this...
_________________
Back to top
View user's profile Send private message
Drops
Advanced Cheater
Reputation: 0

Joined: 22 Feb 2008
Posts: 62

PostPosted: Wed Jun 25, 2008 8:17 pm    Post subject: Reply with quote

blankrider wrote:
This crap pisses me off because i released the source to my valuereader.dll that has a prime example of this...


Sorry, I was originally lead to your source to see how the pointer reads values (didn't realize you had that) I don't play maplestory, so I didn't really use it Sad

Thanks for the code snippet lurc. Is IsDlgButtonChecked faster than doing SendMessage? Also, it probably takes up a lot of CPU if I'm doing like 5 threads at once, is there a more efficient way?
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Wed Jun 25, 2008 8:36 pm    Post subject: Reply with quote

Drops wrote:
blankrider wrote:
This crap pisses me off because i released the source to my valuereader.dll that has a prime example of this...


Sorry, I was originally lead to your source to see how the pointer reads values (didn't realize you had that) I don't play maplestory, so I didn't really use it Sad

Thanks for the code snippet lurc. Is IsDlgButtonChecked faster than doing SendMessage? Also, it probably takes up a lot of CPU if I'm doing like 5 threads at once, is there a more efficient way?


I'm pretty sure IsDlgButtonChecked just looks like this:

Code:
UINT IsDlgButtonChecked( HWND hWnd, int nIDButton )
{
    return (UINT)SendDlgItemMessage( hWnd, nIDButton, BM_GETCHECK, 0, 0 );
}


I just used it because i didn't feel like adding anything else or typing out SendMessage lol.

What i usually do is just make a macro using #define like so:

Code:
#define GetCheck(hWnd,Id) SendDlgItemMessage( (HWND)(hWnd), (int)(Id), BM_GETCHECK, 0, 0 );


So you could just do:

Code:
if ( GetCheck( hWnd, ID_CHECKBOX1 ) == BST_CHECKED )


And Threads are probably the only safe way. So you'll have to sacrifice your CPU for a couple threads.

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites