 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Tue Jul 31, 2007 9:55 pm Post subject: wtf is wrong with this |
|
|
| Code: | #include <windows.h>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
static char gszClassName[] = "class";
static HINSTANCE ghInstance = NULL;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WNDCLASSEX WndClass;
HWND hwnd;
MSG Msg;
ghInstance = hInstance;
WndClass.cbSize = sizeof(WNDCLASSEX);
WndClass.style = NULL;
WndClass.lpfnWndProc = WndProc;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = ghInstance;
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
WndClass.lpszMenuName = NULL;
WndClass.lpszClassName = gszClassName;
WndClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&WndClass)) {
MessageBox(0, "Error Registering Window!", "Error!", MB_ICONSTOP | MB_OK);
return 0;
}
hwnd = CreateWindowEx(
WS_EX_STATICEDGE,
gszClassName,
"darkblue owNz!",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
320, 240,
NULL, NULL,
ghInstance,
NULL);
if(hwnd == NULL) {
MessageBox(0, "Window Creation Failed!", "Error!", MB_ICONSTOP | MB_OK);
return 0;
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&Msg, NULL, 0, 0)) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
HDC hdc;
PAINTSTRUCT ps;
LPSTR szMessage = "blahblahstring";
switch(Message) {
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
TextOut(hdc, 70, 50, szMessage, strlen(szMessage));
EndPaint(hwnd, &ps);
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
}
|
this should right text in the window but it wont compile
| Quote: | Compiling: C:\Program Files\CodeBlocks\Files\WindowText.cpp
C:\Program Files\CodeBlocks\Files\WindowText.cpp: In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':
C:\Program Files\CodeBlocks\Files\WindowText.cpp:16: warning: converting to non-pointer type `UINT' from NULL
Linking console executable: C:\Program Files\CodeBlocks\Files\WindowText.exe
C:\Program Files\CodeBlocks\Files\WindowText.o:WindowText.cpp:(.text+0x281): undefined reference to `TextOutA@20'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 31 seconds)
0 errors, 1 warnings |
_________________
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Tue Jul 31, 2007 9:56 pm Post subject: |
|
|
link to gdi32.lib
and if you ever have 'undefined reference' errors, take the following steps:
1. visit the msdn page
2. verify you have the correct header file (it will tell you what you need on the page), if you don't, then the compiler will try a default one, which may not work.
3. verify you have linked to the appropriate library, also on the page. |
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Tue Jul 31, 2007 10:22 pm Post subject: |
|
|
thanks appal
it workz0rz _________________
|
|
| 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
|
|