 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Thu Jul 30, 2009 12:27 pm Post subject: WndProc doesn't respond? |
|
|
Hmm...
| Code: |
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif
#define IDD_DIALOG1 101
#define IDC_EDIT1 1000
#define IDC_EDIT2 1001
#define IDC_BUTTON1 1002
#define IDC_BUTTON2 1003
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_INITDIALOG:
MessageBox(NULL, NULL, NULL, NULL);
break;
case WM_CLOSE:
DestroyWindow(hwnd);
ExitProcess(-1);
break;
case WM_DESTROY:
PostQuitMessage(-1);
ExitProcess(-1);
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_BUTTON2:
MessageBox(NULL, NULL, NULL, NULL);
break;
}
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return NULL;
}
int __stdcall WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
WNDCLASSEX wcex;
ZeroMemory(&wcex, sizeof(wcex));
wcex.cbSize = sizeof(wcex);
wcex.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(255,255,255));
wcex.lpszMenuName = NULL;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = DefWindowProc;
wcex.hInstance = hInst;
wcex.hIcon = LoadIcon(0, (LPCTSTR)IDI_APPLICATION);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.lpszClassName = "GTFOOUTMYCLASS";
RegisterClassEx(&wcex);
HFONT hfont0 = CreateFont(-11, 0, 0, 0, 400, FALSE, FALSE, FALSE, 1, 400, 0, 0, 0, ("Ms Shell Dlg 2"));
HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, ("GTFOOUTMYCLASS"), "Login", WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP, 0, 0, 285, 152, 0, 0, hInst, 0);
HWND hCtrl0_0 = CreateWindowEx(0, WC_EDIT, 0, WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_BORDER | ES_AUTOHSCROLL, 83, 24, 161, 20, hwnd, (HMENU)IDC_EDIT1, hInst, 0);
SendMessage(hCtrl0_0, WM_SETFONT, (WPARAM)hfont0, FALSE);
HWND hCtrl0_1 = CreateWindowEx(0, WC_STATIC, ("Username: "), WS_VISIBLE | WS_CHILD | WS_GROUP | SS_LEFT, 14, 26, 57, 13, hwnd, (HMENU)IDC_STATIC, hInst, 0);
SendMessage(hCtrl0_1, WM_SETFONT, (WPARAM)hfont0, FALSE);
HWND hCtrl0_2 = CreateWindowEx(0, WC_BUTTON, (""), WS_VISIBLE | WS_CHILD | 0x00000007, 5, 3, 270, 85, hwnd, (HMENU)IDC_STATIC, hInst, 0);
SendMessage(hCtrl0_2, WM_SETFONT, (WPARAM)hfont0, FALSE);
HWND hCtrl0_3 = CreateWindowEx(0, WC_EDIT, 0, WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_BORDER | ES_AUTOHSCROLL, 83, 55, 162, 20, hwnd, (HMENU)IDC_EDIT2, hInst, 0);
SendMessage(hCtrl0_3, WM_SETFONT, (WPARAM)hfont0, FALSE);
HWND hCtrl0_4 = CreateWindowEx(0, WC_STATIC, ("Password: "), WS_VISIBLE | WS_CHILD | WS_GROUP | SS_LEFT, 15, 59, 54, 13, hwnd, (HMENU)IDC_STATIC, hInst, 0);
SendMessage(hCtrl0_4, WM_SETFONT, (WPARAM)hfont0, FALSE);
HWND hCtrl0_5 = CreateWindowEx(0, WC_BUTTON, ("Login"), WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_RIGHT, 240, 89, 33, 23, hwnd, (HMENU)IDC_BUTTON1, hInst, 0);
SendMessage(hCtrl0_5, WM_SETFONT, (WPARAM)hfont0, FALSE);
HWND hCtrl0_6 = CreateWindowEx(0, WC_BUTTON, ("Exit"), WS_VISIBLE | WS_CHILD | WS_TABSTOP | 0x00000001, 206, 89, 33, 23, hwnd, (HMENU)IDC_BUTTON2, hInst, 0);
SendMessage(hCtrl0_6, WM_SETFONT, (WPARAM)hfont0, FALSE);
ShowWindow(hwnd, nShowCmd);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
Sleep(10);
}
return msg.wParam;
} |
|
|
| Back to top |
|
 |
Guy Expert Cheater
Reputation: 0
Joined: 30 May 2009 Posts: 187
|
Posted: Thu Jul 30, 2009 12:31 pm Post subject: |
|
|
Holy shit that's a lot of window styles for each widget - this is one reason why I've been writing a wrapper (Similar to WTL) for the GUI.
| Code: |
BOOL ObjProc( WINPARAM_DEF )
{
do {
if( EXIT ) {
DestroyWindow( hWnd );
break;
}
if( btnAlter->Clicked( WINPARAM ) )
{
if( chkUnclickable->Checked( ) )
chkUnclickable->Uncheck( );
else
chkUnclickable->Check( );
break;
}
if( txtButtonAlter->Changed( WINPARAM ) )
{
MainWindow.SetText( btnAlter, MainWindow.GetText( txtButtonAlter, 255 ) );
break;
}
if( chkUnclickable->Changed( WINPARAM ) )
{
if( chkUnclickable->Checked( ) )
chkUnclickable->Uncheck( );
else
chkUnclickable->Check( );
break;
}
if( lstUnknown && !strcmp( lstUnknown->SelectedItem( ), "Rock!" ) )
{
break;
}
if( tabObject->Selected( ) == 1 )
{
break;
}
if( hlnkTest->Clicked( WINPARAM ) )
{
ShellExecute( 0, "open", hlnkTest->GetLink( ), "iexplore", 0, SW_SHOW );
}
} RUN_ONCE;
return( FALSE );
}
|
So much better, eh? _________________
Has anyone seen Hitler around..? If so, PM me! |
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Thu Jul 30, 2009 12:33 pm Post subject: |
|
|
| Guy` wrote: | Holy shit that's a lot of window styles for each widget - this is one reason why I've been writing a wrapper (Similar to WTL) for the GUI.
| Ya, but ResEdit helps a lot. |
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Thu Jul 30, 2009 12:48 pm Post subject: |
|
|
how come
| Code: |
wcex.lpfnWndProc = DefWindowProc;
|
it should be WndProc (or the name of your window procedure) |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Thu Jul 30, 2009 1:04 pm Post subject: |
|
|
| 1qaz wrote: | how come
| Code: |
wcex.lpfnWndProc = DefWindowProc;
|
it should be WndProc (or the name of your window procedure) |
That is exactly why WndProc isn't responding.
ResEdit creates its own code but it expects you to at least edit it yourself to make it work for the users needs.
Also, there isn't any need for a Sleep call in between GetMessage, you can remove that also. _________________
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Thu Jul 30, 2009 4:42 pm Post subject: |
|
|
| lurc wrote: | | 1qaz wrote: | how come
| Code: |
wcex.lpfnWndProc = DefWindowProc;
|
it should be WndProc (or the name of your window procedure) |
That is exactly why WndProc isn't responding.
ResEdit creates its own code but it expects you to at least edit it yourself to make it work for the users needs.
Also, there isn't any need for a Sleep call in between GetMessage, you can remove that also. |
Ooops, simple mistake... ^^ |
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Jul 31, 2009 7:29 am Post subject: |
|
|
| ; wrote: | | lurc wrote: | | 1qaz wrote: | how come
| Code: |
wcex.lpfnWndProc = DefWindowProc;
|
it should be WndProc (or the name of your window procedure) |
That is exactly why WndProc isn't responding.
ResEdit creates its own code but it expects you to at least edit it yourself to make it work for the users needs.
Also, there isn't any need for a Sleep call in between GetMessage, you can remove that also. |
Ooops, simple mistake... ^^ |
Lol |
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Fri Jul 31, 2009 8:07 am Post subject: |
|
|
Ahm, did you notice that
| Code: | wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = DefWindowProc; |
I accidently rewrote the lpfnWndProc. |
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Fri Jul 31, 2009 9:20 am Post subject: |
|
|
| lol haven't noticed that XD |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Fri Jul 31, 2009 11:38 am Post subject: |
|
|
lmfao...
"case WM_INITDIALOG:"
should be
"case WM_CREATE:"
Since you're not using dialogs..
And i'm not sure you can use WS_POPUP with a toolbox window... _________________
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Fri Jul 31, 2009 11:48 am Post subject: |
|
|
| lurc wrote: | lmfao...
"case WM_INITDIALOG:"
should be
"case WM_CREATE:"
Since you're not using dialogs..
And i'm not sure you can use WS_POPUP with a toolbox window... | Yeah I've noticed that too. Took the callback from my trainer... |
|
| Back to top |
|
 |
|
|
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
|
|