社区嘉宾
- 帖子:22020
- 注册:
2003-04-29
- 来自:pe_xscan Studio
|
发表于:
2006-03-09 22:20
|
只看楼主
短消息
资料
WinMain proc hInst:HINSTANCE, hPrevInst:HINSTANCE, CmdLine:LPSTR, CmdShow: DWORD LOCAL wc:WNDCLASSEX LOCAL msg:MSG LOCAL hwnd:HWND mov wc.cbSize, SIZEOF WNDCLASSEX mov wc.style, CS_HREDRAW or CS_VREDRAW mov wc.lpfnWndProc, OFFSET WndProc mov wc.cbClsExtra, NULL mov wc.cbWndExtra, NULL push hInstance pop wc.hInstance mov wc.hbrBackground, COLOR_WINDOW+1 mov wc.lpszMenuName, NULL mov wc.lpszClassName, OFFSET g_szWinClsName invoke LoadIcon, NULL, IDI_APPLICATION mov wc.hIcon, eax mov wc.hIconSm, eax invoke LoadCursor, NULL, IDC_ARROW mov wc.hCursor, eax invoke RegisterClassEx, addr wc INVOKE CreateWindowEx, NULL, ADDR g_szWinClsName, ADDR g_szAppName, \ WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, \ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, \ hInst, NULL mov hwnd, eax invoke ShowWindow, hwnd, SW_SHOWNORMAL invoke UpdateWindow, hwnd .WHILE TRUE invoke GetMessage, ADDR msg, NULL, 0, 0 .BREAK .IF (! eax) invoke TranslateMessage, ADDR msg invoke DispatchMessage, ADDR msg .ENDW mov eax, msg.wParam retWinMain endpWndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM .IF uMsg==WM_DESTROY .if g_bRegisted== TRUE invoke KillTimer, hWnd, c_TimerID .endif invoke PostQuitMessage, NULL .ELSEIF uMsg==WM_CREATE ;创建按钮 invoke CreateWindowEx, NULL, ADDR g_szBtnClsName, ADDR g_szRegisterKey, \ WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON,\ 25, 25, 560, 50, hWnd, c_ButtonID, hInstance, NULL mov g_hwndButton, eax .ELSEIF uMsg==WM_COMMAND mov eax, wParam .IF lParam!=0 .IF ax==c_ButtonID shr eax, 16 .IF ax==BN_CLICKED .if g_bRegisted== TRUE ;禁用监测 invoke KillTimer, hWnd, c_TimerID .IF eax==0 invoke MessageBox, hWnd, ADDR g_szFailKillTimer,\ ADDR g_szAppName, MB_IC ONERROR ret .ENDIF m_m2m g_bRegisted, FALSE ;修改按钮的文本 invoke SetWindowText, g_hwndButton, ADDR g_szRegisterKey .else ;启用监测 invoke SetTimer, hWnd, c_TimerID, 100, NULL .IF eax==0 invoke MessageBox, hWnd, ADDR g_szFailSetTimer,\ ADDR g_szAppName, MB_IC ONERROR ret .ENDIF m_m2m g_bRegisted, TRUE ;修改按钮的文本 invoke SetWindowText, g_hwndButton, ADDR g_szUnregisterKey .endif .ENDIF .ENDIF .ENDIF .ELSEIF uMsg==WM_TIMER invoke GetAsyncKeyState, VK_LMENU ;左Alt键 test eax, 08000h jz @F invoke GetAsyncKeyState, VK_RBUTTON ;鼠标右键 test eax, 08000h jz @F ;把本程序窗口恢复到前台 invoke ShowWindow, hWnd, SW_RESTORE invoke SetForegroundWindow, hWnd ;打开记事本 invoke ShellExecute, hWnd, ADDR g_szOpen, ADDR g_szNotePad, NULL, NULL, SW_RESTORE @@: .ELSE invoke DefWindowProc, hWnd, uMsg, wParam, lParam ret .ENDIF xor eax, eax retWndProc endpend start
|