OK here is my little code
I always get illegal instruction with this code ?!?! DlgBox doesn't show up... maybe it would showup if program doesn't crash!?
and this is rc file compiled with resource builder
Can anyone tell me where is mistake?? I really got frustrated with win programing lately =(
p.s. I used to be unix asm/C programmer so I really dont know where is mistake in this programm ...
plz... help
tnx
.486
.model flat,stdcall
option casemap:none
DlgProc proto :DWORD,:DWORD,:DWORD,:DWORD
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
.data
AppName db "c0mrad",0
string db "meeeeeeeeeeeeeeeee",0
string1 db 32 dup(0)
format db "0x%h",0
about db "Dialog Box koji sluzi kao pomoc",0dh
db "jednom dodatnom programu koji ce",0dh
db "da mu petlja po memoriji, pa otuda",0dh
db "i Refresh dugme...",0dh
db " c0mrad 13/11/2004",0
dialog db "MYDIALOG",0
.data?
hInstance HINSTANCE ?
.code
start:
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke DialogBoxParam, hInstance, ADDR dialog,NULL, addr DlgProc, NULL
invoke ExitProcess,eax
DlgProc proc hDlg:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.IF uMsg==WM_DESTROY
invoke ExitProcess, NULL
.ELSEIF uMsg==WM_CLOSE
invoke ExitProcess, NULL
.ELSEIF uMsg==WM_COMMAND
mov eax, wParam
.IF ax == 600
invoke MessageBox, hDlg, ADDR about, ADDR AppName, MB_OK
.ELSEIF ax == 9999
invoke wsprintf, ADDR string1, ADDR format, ADDR string
invoke SendDlgItemMessage, hDlg, 502 , WM_SETTEXT, 0, ADDR string
invoke SendDlgItemMessage, hDlg, 503 , WM_SETTEXT, 0, ADDR string1
.ENDIF
.ELSEIF uMsg==WM_INITDIALOG
invoke wsprintf, ADDR string1, ADDR format, ADDR string
invoke SendDlgItemMessage, hDlg, 502 , WM_SETTEXT, 0, ADDR string
invoke SendDlgItemMessage, hDlg, 503 , WM_SETTEXT, 0, ADDR string1
.ENDIF
DlgProc endp
end start
end start
I always get illegal instruction with this code ?!?! DlgBox doesn't show up... maybe it would showup if program doesn't crash!?
and this is rc file compiled with resource builder
MYDIALOG DIALOG 0, 0, 182, 76
STYLE DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_CAPTION |WS_VISIBLE |WS_SYSMENU |WS_MINIMIZEBOX
CAPTION "c0mrad"
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, 0
BEGIN
CONTROL "String:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_VISIBLE ,5,13,85,8
CONTROL "",502,"STATIC",SS_SUNKEN |SS_LEFT |WS_CHILD |WS_VISIBLE ,33,13,137,10
CONTROL "Addres:",65535,"STATIC",SS_LEFT |WS_CHILD |WS_VISIBLE ,5,27,48,8
CONTROL "",503,"STATIC",SS_SUNKEN |SS_LEFT |WS_CHILD |WS_VISIBLE ,93,27,79,10
CONTROL "&Refresh",9999,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,66,52,50,14
CONTROL "&About",600,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_VISIBLE ,122,52,50,14
END
Can anyone tell me where is mistake?? I really got frustrated with win programing lately =(
p.s. I used to be unix asm/C programmer so I really dont know where is mistake in this programm ...
plz... help
tnx
No ret. Most probably you ended up in the int3 that pads the exe.
yes =)
I overlooked that =(
thnx I tought that error is in res or something like that =))
I overlooked that =(
thnx I tought that error is in res or something like that =))
c0mrad:
do you think it is right?
best regards.
do you think it is right?
best regards.
=) Tnx for this code, yes I figured that I used some stuff in wrong way or some are not needed such as SendDlg for address when Refresh button is "clicked" =)
sry I haven't done programming for almost 3 yeasr... and before that I've programmed only in FreeBSD/Linux asm/C... so I'm little bit new in Windows programming =)
tnx
sry I haven't done programming for almost 3 yeasr... and before that I've programmed only in FreeBSD/Linux asm/C... so I'm little bit new in Windows programming =)
tnx