64 bit assembler > Mikl__'s ml64 examples
[SOLVED]DialogBoxParam pops the dialog but i cannot close it
bluedevil:
Hello;
I am trying Mikl__'s samples. Thank you Mikl__ btw.
I have wrote a small code to open a dialog from template. I can see the template but i cannot close it from X button. Alt+F4 combination also doesn't works
--- Code: --- OPTION DOTNAME ; required for macro files
option casemap:none ; case sensitive
; _____________________________________________________________________________
; include files
include \masm64\include64\win64.inc ; main include file
include \masm64\include64\kernel32.inc
include \masm64\include64\user32.inc
include \masm64\include64\comctl32.inc
; _____________________________________________________________________________
; libraries
includelib \masm64\lib64\user32.lib
includelib \masm64\lib64\kernel32.lib
includelib \masm64\lib64\comctl32.lib
; _____________________________________________________________________________
; MASM64 macros
include \masm64\macros64\vasily.inc ; main macro file
include \masm64\macros64\macros64.inc ; auxillary macro file
; _____________________________________________________________________________
; constant variables
.const
; Main Dialog
IDD_DIALOG EQU 1000
; _____________________________________________________________________________
; initialized variables
.data
lpTitle db ".title",0
lpMessa db ".message",0
.code
WinMainCRTStartup proc hInstance:HINSTANCE, hPrevInstance:HINSTANCE, lpCmdLine:LPSTR, nCmdShow:DWORD
invoke InitCommonControls
invoke DialogBoxParam,hInstance, IDD_DIALOG,0,addr DlgProc,NULL
invoke ExitProcess,NULL
WinMainCRTStartup endp
DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
mov eax,uMsg
.if edx==WM_INITDIALOG
invoke MessageBox,hWnd,addr lpMessa,addr lpTitle,MB_OK
.elseif edx==WM_COMMAND
; code here
.elseif edx==WM_CLOSE
invoke EndDialog,hWnd,0
ret
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
DlgProc endp
end
--- End code ---
I have debug the code via debugger and understand that in DlgProc the uMsg does not carry the WM_xxxx messages?
Where am i doing wrong.
PS. I am using masm64 sdk.
I have attached my radasm2 project.
zedd151:
Nevermind this post. Mikl__ has answered better than I could have.
See his post below this one.
I removed my comments and code to avoid further confusion. :undecided:
Mikl__:
Hi, blue_devil!
DialogAppx64.asm
--- Code: ---; GUI #
include win64a.inc ; main include file
; constant variables
IDD_DIALOG EQU 1000
IMAGE_BASE EQU 400000h
; _____________________________________________________________________________
; initialized variables
.data
lpTitle db ".title",0
lpMessa db ".message",0
.code
WinMain proc hInstance:HINSTANCE, hPrevInstance:HINSTANCE, lpCmdLine:LPSTR, nCmdShow:DWORD
invoke InitCommonControls
invoke DialogBoxParamA,IMAGE_BASE, IDD_DIALOG,0,addr DlgProc,NULL
invoke RtlExitUserProcess,NULL
WinMain endp
DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
mov hWnd,rcx
cmp edx,WM_INITDIALOG
je wmINITDIALOG
cmp edx,WM_COMMAND
je wmCOMMAND
cmp edx,WM_CLOSE
je wmCLOSE
xor eax,eax;eax=FALSE
jmp exit_
wmINITDIALOG:
mov edx,offset lpMessa
mov r8d,offset lpTitle
invoke MessageBoxA,hWnd,,,MB_OK
jmp wmBYE
wmCOMMAND:; code here
jmp wmBYE
wmCLOSE:invoke EndDialog,hWnd,0
wmBYE: mov eax,TRUE
exit_: leave
ret
DlgProc endp
end
--- End code ---
DialogAppx64.rc
--- Code: ---#include "resource.h"
#define IDD_DIALOG 1000
#define FW_NORMAL 400
#define FALSE 0
IDD_DIALOG DIALOGEX 6,6,189,99
FONT 8,"MS Sans Serif",FW_NORMAL, FALSE, 1
STYLE WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION
| WS_SYSMENU | WS_THICKFRAME
BEGIN
END
--- End code ---
zedd151:
Hi Mikl__
I noticed that you too have not called GetModuleHandle for the instance handle. Does it work without?
I'm on my 32 bit box so can't test it
Your example has some strange looking code. I might have to load up 64 bit OS to investigate
Seems mixing 32 and 64 bit registers. ?? How odd.
Mikl__:
Hi, Swordfish!
hInstance = IMAGE_BASE = 400000h
the GetModuleHandle function returns this value because the /BASE:0x400000 key was specified during assembly
Navigation
[0] Message Index
[#] Next page
Go to full version