 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Tue Jul 22, 2008 8:46 am Post subject: [C++] Creating Window |
|
|
i don't really know what the f*ck happened here but for some reason when i create Win32 Project (Creating the Window) i can't see it.
but the process is running at processes list
my code is very simple
| Code: |
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
switch (iMsg)
{
case WM_CREATE:
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hWnd,iMsg,wParam,lParam);
}
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
HWND hWnd;
MSG iMsg;
WNDCLASSEX wc;
wc.cbSize = sizeof(wc);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.lpfnWndProc = WndProc;
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_BTNSHADOW);
wc.hInstance = hInstance;
wc.lpszClassName = L"AutoClick";
wc.lpszMenuName = NULL;
wc.hIconSm = LoadIcon(NULL,IDI_APPLICATION);
RegisterClassEx(&wc);
hWnd = CreateWindowW(L"AutoClicker",L"AutoClicker",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,200,200,NULL,NULL,hInstance,NULL);
ShowWindow(hWnd,nShowCmd);
UpdateWindow(hWnd);
while (GetMessage(&iMsg,NULL,0,0))
{
TranslateMessage(&iMsg);
DispatchMessage(&iMsg);
}
return iMsg.wParam;
}
|
no compiling errors, not missing anything.. cuz it worked b4.. now it happenes any time i open Win32 Project
_________________
Stylo |
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Tue Jul 22, 2008 11:39 am Post subject: |
|
|
Try not using CW_USEDEFAULT.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Tue Jul 22, 2008 12:05 pm Post subject: |
|
|
Nope.
Error is that he used different classes.
Look at his WNDCLASSEX.
| Quote: | | wc.lpszClassName = L"AutoClick"; |
Then his CreateWindow
| Quote: | | CreateWindowW(L"AutoClicker",L"AutoClicker",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,200,200,NULL,NULL,hInstance,NULL); |
AutoClick != AutoClicker
I also recommend You include tchar.h and use _T instead of L, also with CreateWindow, just use that instead of CreateWindowW (Or use CreateWindowEx)
Also in the WndProc make sure to call DestroyWindow on WM_CLOSE, And return DefWindowProc on default, and return 0 outside the switch.
_________________
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Tue Jul 22, 2008 12:35 pm Post subject: |
|
|
oh thx that really was the L"AutoClick" thing ..
but what's the different between _T and L ? isn't it the same?
_________________
Stylo |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Tue Jul 22, 2008 12:41 pm Post subject: |
|
|
Yea its the same, but it's a good way to code seeing as someone could change the character set and you wouldn't have to recode anything that is UNICODE only.
_T just looks like this
| Code: | #ifdef UNICODE
#define __T(x) L ## x
#else
#define __T(x)
#endif
.
.
#define _T(x) __T(x) |
_________________
|
|
| 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
|
|