📄 dlginfo.asm
字号:
;-----------------------------------------------------------------------------------------
; Prototypes.
;-----------------------------------------------------------------------------------------
Static_WndProc PROTO :DWORD, :DWORD, :DWORD, :DWORD
.code
;-----------------------------------------------------------------------------------------
; The procedure of the about dialog.
;-----------------------------------------------------------------------------------------
InfoDialogProc PROC USES ebx esi edi hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
mov eax, uMsg
.IF eax == WM_INITDIALOG
;-----------------------------------------------------------------------------------
;-- Save the handle of this dialog.
mov eax, hWnd
mov hDialogInfo, eax
;-----------------------------------------------------------------------------------
;-- Get the handles of the links (static controls).
invoke GetDlgItem, hWnd, IDDI_S_LINK_EMAIL
mov hInfoDialog_S_Email, eax
invoke GetDlgItem, hWnd, IDDI_S_LINK_CODINGCREWDE
mov hInfoDialog_S_CodingCrew_de, eax
invoke GetDlgItem, hWnd, IDDI_S_LINK_MASM32COM
mov hInfoDialog_S_MASM32_com, eax
;-----------------------------------------------------------------------------------
;-- Load the cursor for the links.
invoke LoadImage, NULL, OCR_HAND, IMAGE_CURSOR, 0, 0, LR_DEFAULTCOLOR or LR_SHARED
mov hCursor, eax
;-----------------------------------------------------------------------------------
;-- Superclass the links (static controls).
invoke GetDlgItem, hWnd, IDDI_S_LINK_EMAIL
invoke SetWindowLong, eax, GWL_WNDPROC, OFFSET Static_WndProc
invoke GetDlgItem, hWnd, IDDI_S_LINK_CODINGCREWDE
invoke SetWindowLong, eax, GWL_WNDPROC, OFFSET Static_WndProc
invoke GetDlgItem, hWnd, IDDI_S_LINK_MASM32COM
invoke SetWindowLong, eax, GWL_WNDPROC, OFFSET Static_WndProc
;-----------------------------------------------------------------------------------
;-- Save the offset of the old window procedure.
mov lpWndProcOld, eax
;-----------------------------------------------------------------------------------
;-- Set the texts.
invoke SendMessage, hWnd, WM_SETTEXT, NULL, lpSTR_TITLE_INFODIALOG
invoke SendDlgItemMessage, hWnd, IDDI_S_TITLE, WM_SETTEXT, NULL, lpSTR_TITLE_PROGRAM
invoke SendDlgItemMessage, hWnd, IDDI_GB_INTERNET, WM_SETTEXT, NULL, lpSTR_GB_INTERNET
invoke SendDlgItemMessage, hWnd, IDDI_S_EMAIL, WM_SETTEXT, NULL, lpSTR_S_EMAIL
invoke SendDlgItemMessage, hWnd, IDDI_S_WEBSITE, WM_SETTEXT, NULL, lpSTR_S_WEBSITE
invoke SendDlgItemMessage, hWnd, IDDI_S_MASM32, WM_SETTEXT, NULL, lpSTR_S_MASM32PACKAGE
;-----------------------------------------------------------------------------------
;-- Set the email and the urls.
invoke SendDlgItemMessage, hWnd, IDDI_S_LINK_EMAIL, WM_SETTEXT, NULL, OFFSET EMAIL_Author
invoke SendDlgItemMessage, hWnd, IDDI_S_LINK_CODINGCREWDE, WM_SETTEXT, NULL, OFFSET WWW_CodingCrew_de
invoke SendDlgItemMessage, hWnd, IDDI_S_LINK_MASM32COM, WM_SETTEXT, NULL, OFFSET WWW_MASM32_com
;-----------------------------------------------------------------------------------
;-- Set button text and set the focus to the button.
invoke GetDlgItem, hWnd, IDDI_B_EXITDIALOG
push eax
invoke SendMessage, eax, WM_SETTEXT, NULL, lpSTR_B_OK
pop eax
invoke SetFocus, eax
.ELSEIF eax == WM_COMMAND
mov eax, wParam
mov edx, eax
shr edx, 16
.IF dx == NULL
.IF ax == IDDI_B_EXITDIALOG
;---------------------------------------------------------------------------
;-- Quit the dialog.
jmp @Exit
.ENDIF
.ENDIF
.ELSEIF eax == WM_CTLCOLORSTATIC
invoke SendMessage, lParam, uMsg, wParam, lParam
ret
.ELSEIF eax == WM_CLOSE
@Exit:
;-----------------------------------------------------------------------------------
;-- Quit the dialog.
invoke EndDialog, hWnd, 0
.ENDIF
@Return:
xor eax, eax
ret
InfoDialogProc ENDP
;-----------------------------------------------------------------------------------------
; The procedure for the "links" in the about dialog.
;-----------------------------------------------------------------------------------------
Static_WndProc PROC hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
mov eax, uMsg
.IF eax == WM_CTLCOLORSTATIC
;-----------------------------------------------------------------------------------
;-- Get the handle of the font.
invoke SendMessage, hWnd, WM_GETFONT, NULL, NULL
invoke GetObject, eax, SIZEOF LF, OFFSET LF
;-----------------------------------------------------------------------------------
;-- The links shall be underlined.
mov LF.lfUnderline, TRUE
invoke CreateFontIndirect, OFFSET LF
;-----------------------------------------------------------------------------------
;-- Load the font in the display device context.
invoke SelectObject, wParam, eax
;-----------------------------------------------------------------------------------
;-- Use different colors for active and inactive links.
.IF fHover
mov edx, lpSTR_S_FEEDBACK
mov ebx, lpSTR_S_FEELING
mov eax, 03C990Fh
.ELSE
mov edx, lpSTR_S_EMAIL
mov ebx, lpSTR_S_MASM32PACKAGE
mov eax, 0FF0000h
.ENDIF
;-------------------------------------------------------------------------------
;-- If the active link is the Email or MASM32.com then change the text of the
;-- static control.
mov ecx, hWnd
.IF ecx == hInfoDialog_S_Email
push eax
invoke SendDlgItemMessage, hDialogInfo, IDDI_S_EMAIL, WM_SETTEXT, NULL, edx
pop eax
.ELSEIF ecx == hInfoDialog_S_MASM32_com
push eax
invoke SendDlgItemMessage, hDialogInfo, IDDI_S_MASM32, WM_SETTEXT, NULL, ebx
pop eax
.ENDIF
;-------------------------------------------------------------------------------
;-- Change the text color.
invoke SetTextColor, wParam, eax
invoke SetBkMode, wParam, TRANSPARENT
invoke GetStockObject, NULL_BRUSH
ret
.ELSEIF eax == WM_MOUSEMOVE
;-------------------------------------------------------------------------------
;-- Is the current window this dialog?
invoke GetActiveWindow
.IF eax == hDialogInfo
;---------------------------------------------------------------------------
;-- Yes. Is the cursor on this link (static control)?
invoke GetCursorPos, OFFSET PT
invoke GetWindowRect, hWnd, OFFSET Rect
invoke PtInRect, OFFSET Rect, PT.x, PT.y
.IF eax
;-----------------------------------------------------------------------
;-- Yes. Is the mouse already captured?
invoke GetCapture
.IF !eax
;-------------------------------------------------------------------
;-- No. Capture the mouse and set the hover flag.
invoke SetCapture, hWnd
mov fHover, TRUE
invoke InvalidateRect, hWnd, FALSE, FALSE
invoke SetCursor, hCursor
invoke UpdateWindow, hWnd
.ENDIF
.ELSE
;-----------------------------------------------------------------------
;-- No. Is the mouse already captured?
invoke GetCapture
.IF eax
;-------------------------------------------------------------------
;-- Yes. Release the mouse and clear the hover flag.
invoke ReleaseCapture
mov fHover, FALSE
invoke InvalidateRect, hWnd, FALSE, FALSE
invoke UpdateWindow, hWnd
.ENDIF
.ENDIF
.ENDIF
.ELSEIF eax == WM_LBUTTONUP
mov eax, hWnd
.IF eax == hInfoDialog_S_Email
;-------------------------------------------------------------------------------
;-- Send an email.
invoke szCopy, OFFSET MAILTO_Author, OFFSET Buffer
invoke szCopy, OFFSET EMAIL_Subject, OFFSET Buffer + SIZEOF MAILTO_Author + SIZEOF EMAIL_Author - 1
invoke szCopy, lpSTR_TITLE_PROGRAM, OFFSET Buffer + SIZEOF MAILTO_Author + SIZEOF EMAIL_Author + SIZEOF EMAIL_Subject - 2
invoke ShellExecute, NULL, OFFSET OperationOpen, OFFSET Buffer, NULL,
NULL, SW_MAXIMIZE
.ELSEIF eax == hInfoDialog_S_CodingCrew_de
;-------------------------------------------------------------------------------
;-- Visit http://www.codingcrew.de.
invoke ShellExecute, NULL, OFFSET OperationOpen, OFFSET URL_CodingCrew_de, NULL,
NULL, SW_MAXIMIZE
.ELSEIF eax == hInfoDialog_S_MASM32_com
;-------------------------------------------------------------------------------
;-- Visit http://www.masm32.com.
invoke ShellExecute, NULL, OFFSET OperationOpen, OFFSET URL_MASM32_com, NULL,
NULL, SW_MAXIMIZE
.ENDIF
mov fHover, FALSE
invoke InvalidateRect, hWnd, FALSE, FALSE
.ELSE
;-----------------------------------------------------------------------------------
;-- Pass the arguments to the old window procedure.
invoke CallWindowProc, lpWndProcOld, hWnd, uMsg, wParam, lParam
ret
.ENDIF
@Return:
xor eax, eax
ret
Static_WndProc ENDP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -