【求助】我的第一个C++窗口程序
我第一次用C++调用Windows API 来写窗口,但是我很郁闷,,我这个怎么米有窗口啊,,,大哥大们给帮忙看下。谢谢!程序代码:
#include <windows.h> #include <stdio.h> LRESULT CALLBACK WinLogerPro( HWND hKeyloger, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ); int WINAPI WinMain( HINSTANCE klg, // handle to current instance HINSTANCE hPrevInstance, // handle to previous instance LPSTR lpCmdLine, // command line int nCmdShow // show state ) { WNDCLASS keyloger; keyloger.style=CS_HREDRAW | CS_VREDRAW; keyloger.lpfnWndProc=WinLogerPro; keyloger.cbClsExtra=0; keyloger.cbWndExtra=0; keyloger.hInstance=klg; keyloger.hIcon=LoadIcon(NULL,IDI_ERROR); keyloger.hCursor=LoadCursor(NULL,IDC_CROSS); keyloger.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH); keyloger.lpszMenuName=NULL; keyloger.lpszClassName="keyloger"; RegisterClass(&keyloger); HWND hKeyloger; hKeyloger=CreateWindow("keyloger","键盘记录",WS_OVERLAPPEDWINDOW,0,0,600,400,NULL,NULL,klg,NULL); ShowWindow(hKeyloger,SW_SHOWNORMAL); UpdateWindow(hKeyloger); MSG msg; while(GetMessage(&msg,NULL,0,0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; } LRESULT CALLBACK WinLogerPro( HWND hKeyloger, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ) { switch (uMsg) { case WM_LBUTTONDOWN: MessageBox(hKeyloger,"How do you do?","Hello",MB_YESNO); } return 0; }