dodicat wrote:Your code works with 64 bit, and 32 bit -gen gcc.
But not -gen gas. (No dialog box visible)
Win 10.
The issue with -gen gas : in some cases the memory after the DLGTEMPLATE structure is not zero initialised, due to alignment.
In these cases the API function gets invalid data.... If lucky there are zeroes.
Using getlasterror to get the extended error message and fbdebugger to see the memory values.
I check poking zero just after the DLGTEMPLATE structure that works well but not safe.
*(Cast(UShort Ptr,lpdt)+(SizeOf(DLGTEMPLATE)\SizeOf(UShort)))=0
The best solution : a zeroed area, enough large.
Code: Select all
function NewDialog( byval hParent as HWND, byval lpDialogProc as DLGPROC) as INT_PTR
Dim as long rval
Dim strTitle as string
Dim lpdt As DLGTEMPLATE Ptr = CAllocate(1, SizeOf(DLGTEMPLATE)+12)
lpdt->style = WS_OVERLAPPEDWINDOW 'DS_MODALFRAME OR DS_CENTER OR WS_VISIBLE OR WS_OVERLAPPEDWINDOW
lpdt->dwExtendedStyle = 0
lpdt->cx = 170
lpdt->cy = 200
lpdt->cdit = 0
lpdt->x = 50
lpdt->y = 50
rval = DialogBoxIndirect(GetModuleHandle(null),lpdt,hParent,lpDialogProc)
DeAllocate lpdt
return rval
end function