Hi, what I'm trying to do is loading a .res file containing a dialog resource and then using DialogBoxIndirectParamA to display it. That function expects a 'Pointer to a global memory object containing a template that DialogBoxIndirect uses to create the dialog box'. The problem is that I don't know how to create that 'global memory object'. I tried GlobalAlloc, CreateFileMapping and the like but nothing worked for me. Maybe someone can point me in the right direction. thx in advance
Posted on 2000-12-29 09:44:00 by pontius
the memory object is in fact data that defines your dialogbox look in DLGTEMPLATE in the api reference. i give you an example that i used on one of my patch some times ago : stDlgLineTemplate dd DS_CENTER or DS_SYSMODAL or WS_CAPTION or WS_POPUP or WS_SYSMENU dd 0 dw 2 dw 0,0,63,11 dw 0 dw 0 db 'g',0,'o',0,'t',0,'o',0,' ',0,'l',0,'i',0,'n',0,'e',0 db 0,0,0,0 dd WS_BORDER or WS_CHILD or WS_VISIBLE or WS_TABSTOP dd 0 dw 0,0,23,11 dw IDC_EDITLINE dw 0ffffh dw 81h dw 0 dw 0 dw 0 dd WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON or WS_TABSTOP dd 0 dw 23,0,40,11 dw IDC_GOTOLINE dw 0ffffh dw 80h db '&',0,'g',0,'o',0,'t',0,'o',0,' ',0,'l',0,'i',0,'n',0,'e',0 db 0,0,0 dw 0 db 0 beware that your template must be dword aligned, that' s why you can find some db 0,0,... in that source, it' s just to align the dialog templates.
Posted on 2000-12-29 10:48:00 by roy
dword alignment did the trick, thx
Posted on 2000-12-29 11:01:00 by pontius