.code ;****************************************************************************** ;***** Edit Control Dialog Procedure ***** ;****************************************************************************** EditCtrlProc2 proc hEdit:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM .if uMsg==WM_KEYUP .if (wParam==VK_ESCAPE) invoke GetParent, hEdit invoke EndDialog, eax, 00h mov op_exist,0 .endif .else invoke CallWindowProc, OldWndProc3, hEdit, uMsg, wParam, lParam ret .endif xor eax,eax ret EditCtrlProc2 endp StaticProc proc hStatic:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM LOCAL rect : RECT LOCAL hdc : HDC LOCAL ps : PAINTSTRUCT .if uMsg == WM_PAINT invoke BeginPaint, hStatic, ADDR ps mov hdc,eax invoke GetClientRect, hStatic, ADDR rect invoke CreateSolidBrush, BgColor invoke FillRect, hdc, addr rect, eax invoke EndPaint, hStatic, ADDR ps .else invoke CallWindowProc, OldWndProc2, hStatic, uMsg, wParam, lParam ret .endif xor eax,eax ret StaticProc endp ;****************************************************************************** ;***** Options Dialog Procedure ***** ;****************************************************************************** OptionsDlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM LOCAL hFreq : DWORD LOCAL hKey : DWORD LOCAL hAlpha : DWORD LOCAL hColor : DWORD LOCAL chcolor : CHOOSECOLOR LOCAL rect : RECT .IF uMsg==WM_INITDIALOG mov op_exist,1 invoke LoadSettings invoke SetDlgItemText, hWnd, IDC_DRIVE, addr DriveLetter invoke SetDlgItemInt, hWnd, IDC_LEV1, lev01, FALSE invoke SetDlgItemInt, hWnd, IDC_LEV2, lev02, FALSE invoke SetDlgItemText, hWnd, IDC_WNAME, addr WndName invoke SetDlgItemText, hWnd, IDC_WCLASS, addr ClsName invoke SetDlgItemInt, hWnd, IDC_UPDINTERVAL, UpdateInterval, FALSE invoke GetDlgItem, hWnd, IDC_FREQ mov hFreq,eax invoke GetDlgItem, hWnd, IDC_KEY mov hKey,eax invoke GetDlgItem, hWnd, IDC_ALPHA mov hAlpha,eax .if (KillTarget) invoke CheckDlgButton, hWnd, IDC_CLOSETARGET ,BST_CHECKED .endif .if (ShutDownPC) invoke CheckDlgButton, hWnd, IDC_SHUTDOWNPC ,BST_CHECKED .endif .if (freq) invoke CheckDlgButton, hWnd, IDC_BEEP ,BST_CHECKED invoke SetDlgItemInt, hWnd, IDC_FREQ, freq, FALSE invoke EnableWindow, hFreq, TRUE .else invoke EnableWindow, hFreq, FALSE .endif .if (key) invoke CheckDlgButton, hWnd, IDC_SENDKEY ,BST_CHECKED invoke SetDlgItemText, hWnd, IDC_KEY, addr key invoke EnableWindow, hKey, TRUE .else invoke EnableWindow, hKey, FALSE .endif .if (HideTarget) invoke CheckDlgButton, hWnd, IDC_HIDE ,BST_CHECKED invoke SetDlgItemInt, hWnd, IDC_ALPHA, HideTarget, FALSE invoke EnableWindow, hAlpha, TRUE .else invoke EnableWindow, hAlpha, FALSE .endif invoke GetDlgItem,hWnd, IDC_COLOR mov hColor,eax invoke SetWindowLong, hColor, GWL_WNDPROC, addr StaticProc mov OldWndProc2,eax invoke GetDlgItem, hWnd, IDC_UPDINTERVAL invoke SetWindowLong, eax, GWL_WNDPROC, addr EditCtrlProc2 mov OldWndProc3,eax .ELSEIF uMsg==WM_CLOSE mov op_exist,0 invoke EndDialog,hWnd,00h .ELSEIF uMsg==WM_COMMAND invoke GetDlgItem, hWnd, IDC_FREQ mov hFreq,eax invoke GetDlgItem, hWnd, IDC_KEY mov hKey,eax invoke GetDlgItem, hWnd, IDC_ALPHA mov hAlpha,eax mov edx, wParam shr edx, 16 .if dx==BN_CLICKED mov ecx, wParam .if cx==IDC_APPLY invoke GetDlgItemText, hWnd, IDC_DRIVE, addr DriveLetter, 04 invoke GetDlgItemInt, hWnd, IDC_LEV1, NULL, FALSE mov lev01,eax invoke GetDlgItemInt, hWnd, IDC_LEV2, NULL, FALSE mov lev02,eax invoke GetDlgItemText, hWnd, IDC_WNAME, addr WndName, 255 invoke GetDlgItemText, hWnd, IDC_WCLASS, addr ClsName, 255 invoke GetDlgItemInt, hWnd, IDC_UPDINTERVAL, NULL, FALSE mov UpdateInterval,eax invoke IsDlgButtonChecked, hWnd, IDC_CLOSETARGET .if (eax==BST_CHECKED) mov KillTarget,1 .else mov KillTarget,0 .endif invoke IsDlgButtonChecked, hWnd, IDC_SHUTDOWNPC .if (eax==BST_CHECKED) mov ShutDownPC,1 .else mov ShutDownPC,0 .endif invoke IsDlgButtonChecked, hWnd, IDC_BEEP .if (eax==BST_CHECKED) invoke GetDlgItemInt, hWnd, IDC_FREQ, NULL, FALSE mov freq,eax .else mov freq,0 .endif invoke IsDlgButtonChecked, hWnd, IDC_SENDKEY .if (eax==BST_CHECKED) invoke GetDlgItemText, hWnd, IDC_KEY, addr key, 03 .else mov key,0 .endif invoke IsDlgButtonChecked, hWnd, IDC_HIDE .if (eax==BST_CHECKED) invoke GetDlgItemInt, hWnd, IDC_ALPHA, NULL, FALSE mov HideTarget,eax .else mov HideTarget,0 .endif invoke SaveSettings ;invoke EndDialog,hWnd,00h invoke KillTimer, hMainWnd, hTimer invoke SetTimer, hMainWnd, NULL, UpdateInterval, NULL mov hTimer, eax invoke SwitchTargetLock invoke SetForegroundWindow, hWnd .elseif cx==IDC_CANCEL invoke LoadSettings invoke GetClientRect, hMainWnd, ADDR rect invoke InvalidateRect, hMainWnd, ADDR rect, 01h mov op_exist,0 invoke EndDialog,hWnd,00h .elseif cx==IDC_OK ; we should save settings xor edx,edx mov dx,BN_CLICKED shl edx, 16 xor ecx,ecx mov cx,IDC_APPLY or edx,ecx invoke SendMessage, hWnd, WM_COMMAND, edx, NULL mov op_exist,0 invoke EndDialog,hWnd,00h .elseif cx==IDC_BEEP invoke IsDlgButtonChecked, hWnd, IDC_BEEP .if (eax==BST_CHECKED) invoke EnableWindow, hFreq, TRUE .else invoke EnableWindow, hFreq, FALSE .endif .elseif cx==IDC_SENDKEY invoke IsDlgButtonChecked, hWnd, IDC_SENDKEY .if (eax==BST_CHECKED) invoke EnableWindow, hKey, TRUE .else invoke EnableWindow, hKey, FALSE .endif .elseif cx==IDC_HIDE invoke IsDlgButtonChecked, hWnd, IDC_HIDE .if (eax==BST_CHECKED) invoke EnableWindow, hAlpha, TRUE .else invoke EnableWindow, hAlpha, FALSE .endif .endif .elseif dx==STN_DBLCLK mov ecx, wParam .if cx==IDC_COLOR mov chcolor.lStructSize, sizeof chcolor mov eax,hWnd mov chcolor.hwndOwner, eax mov chcolor.lpCustColors, offset acrCustClr mov eax, BgColor mov chcolor.rgbResult, eax mov chcolor.Flags, CC_FULLOPEN or CC_RGBINIT invoke ChooseColor, addr chcolor .if eax mov eax, chcolor.rgbResult mov BgColor,eax invoke GetClientRect, hWnd, ADDR rect invoke InvalidateRect, hWnd, ADDR rect, 01h invoke GetClientRect, hMainWnd, ADDR rect invoke InvalidateRect, hMainWnd, ADDR rect, 01h .endif .endif .endif .ELSEIF uMsg==WM_LBUTTONDOWN invoke ReleaseCapture invoke SendMessage, hWnd, WM_SYSCOMMAND, SC_MOVE or HTCAPTION, 0 .ELSE mov eax,FALSE ret .ENDIF mov eax,TRUE ret OptionsDlgProc endp