#include LRESULT CALLBACK WndProc( HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam ) { static HINSTANCE hinstDll; HOOKPROC hGetMsgProc; static HHOOK hKeyHook; switch( iMessage ) { case WM_CREATE: hinstDll = LoadLibrary("hooker.dll"); if(!hinstDll){ MessageBox(hWnd, "hooker.dllÀ» ·ÎµåÇÒ ¼ö ¾ø½À´Ï´Ù.", "¿À·ù", MB_OK); ExitProcess(1); } hGetMsgProc = (HOOKPROC)GetProcAddress(hinstDll, "GetMsgProc"); if(!hGetMsgProc){ MessageBox(hWnd, "GetMsgProc ÇÔ¼ö¸¦ ãÀ» ¼ö ¾ø½À´Ï´Ù.", "¿À·ù", MB_OK); FreeLibrary(hinstDll); ExitProcess(1); } hKeyHook = SetWindowsHookEx(WH_GETMESSAGE, hGetMsgProc, hinstDll, 0); if(!hKeyHook){ MessageBox(hWnd, "HookingÀ» ¼º°øÇÏÁö ¸øÇß½À´Ï´Ù.", "¿À·ù", MB_OK); FreeLibrary(hinstDll); ExitProcess(1); } return 0; case WM_DESTROY: PostQuitMessage( 0 ); break; } return DefWindowProc( hWnd, iMessage, wParam, lParam ); } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { HWND hWnd; MSG message; WNDCLASS wndclass; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hbrBackground = (HBRUSH)GetStockObject( GRAY_BRUSH ); wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); wndclass.hIcon = LoadIcon( NULL, IDI_APPLICATION ); wndclass.hInstance = hInstance; wndclass.lpfnWndProc = (WNDPROC)WndProc; wndclass.lpszClassName = "WG WINDOW"; wndclass.lpszMenuName = NULL; wndclass.style = NULL; RegisterClass( &wndclass ); hWnd = CreateWindow("WG WINDOW", "¾Ñ½Î ³»°¡ ¸¸µé¾ú´Ù.", WS_OVERLAPPEDWINDOW, 200, 200, 500, 500, NULL, (HMENU)NULL, hInstance, NULL ); ShowWindow( hWnd, nShowCmd ); while( GetMessage( &message, NULL, 0, 0 ) ){ TranslateMessage( &message ); DispatchMessage( &message ); } return message.wParam; }