Hello @ all ... so here is my question

I want to make a DLL which holds a Dialog (if possible with all resources like bitmaps or icons).
And then this Dialog should be called by another program which loads the DLL. So in fact every program thats loads that DLL should be able to call the DialogBox.

Now my problem is that I don't have much knowledge of the architecture of a DLL.
This is my first attempt to create the DLL but it can't be compiled.
.386
.model flat, stdcall
option casemap:none

include /masm32/include/windows.inc
include /masm32/include/kernel32.inc
include /masm32/include/user32.inc

includelib /masm32/include/kernel32.lib
includelib /masm32/include/user32.lib

DlgProc PROTO :DWORD, :DWORD, :DWORD, :DWORD
CreateMyDlg PROTO

.data
hInst            dd ?
MessageCaption  db 'Test',0
MessageText      db 'About Box, just nothing to say!',0

.code
;###################################################################################
DLLEntry PROC hInstance:HINSTANCE,reason:DWORD,reserved1:DWORD

mov eax,TRUE
ret

DLLEntry ENDP
;###################################################################################
DlgProc PROTO hwndDlg:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

.if uMsg == WM_CLOSE
    invoke DestroyWindow,hwndDlg
   
.elseif uMsg == WM_COMMAND
    mov eax,wParam

        .if ax == 301
            invoke SendMessage,hwndDlg,WM_CLOSE,0,0
        .elseif ax == 302
            invoke MessageBox,hwndDlg,addr MessageText,addr MessageCaption,MB_OK
        .endif

.else
    xor eax,eax
    ret

.endif
mov eax,TRUE
ret

DlgProc ENDP
;###################################################################################
CreateMyDlg PROC

invoke GetModuleHandle,0
mov hInst,eax
invoke DialogBoxParam,hInst,105,0,addr DlgProc,0
ret

CreateMyDlg ENDP
;###################################################################################
END DLLEntry


but masm compiler gives me always that errors:
error A4910: cannot open file: C:\masm32\bin\ML.err
fatal error A1000:  : testdll.dll


Hope somebody can help me.
Posted on 2006-09-19 11:33:05 by ChigpA
it seems you lost ml.err, so, ml can not tell you an explanation of error.
here error list:
Assembling: d:\projects\sw23\sw23.asm
d:\projects\sw23\sw23.asm(32) : error A2006: undefined symbol : hwndDlg
d:\projects\sw23\sw23.asm(32) : error A2114: INVOKE argument type mismatch : argument : 1
d:\projects\sw23\sw23.asm(38) : error A2006: undefined symbol : hwndDlg
d:\projects\sw23\sw23.asm(38) : error A2114: INVOKE argument type mismatch : argument : 1
d:\projects\sw23\sw23.asm(40) : error A2006: undefined symbol : hwndDlg
d:\projects\sw23\sw23.asm(40) : error A2114: INVOKE argument type mismatch : argument : 1
d:\projects\sw23\sw23.asm(51) : fatal error A1010: unmatched block nesting : DlgProc

Posted on 2006-09-20 00:14:28 by Shoo
I have had problems using dialogs that reside in DLLs. My solution was to load the dialog explicitly in order to use it, you may find my method useful if you encounter this problem...

// The main dialog must be loaded explicitly otherwise the load will
// fail if it is from a DLL.
invoke FindResource,, IDD_MAIN, RT_DIALOG
invoke LoadResource, , eax
mov ,eax
invoke LockResource, eax

invoke CreateDialogIndirectParam, , eax, NULL, NULL, NULL
test eax,eax
jnz >
// If we were unable to create the dialog shut down
invoke FreeResource,
invoke ExitProcess, -1
:
mov ,eax
Posted on 2006-09-23 02:17:31 by donkey