hairy win32 dialog problem

new topic     » topic index » view thread      » older message » newer message

Okay. Rob, or anyone, can you help me with this

I posted with regard to this ages ago but I've come back to it and
sussed it out more.

I can call DialogBoxParam() with the dll's open_dll() instance
and the dialog box identifier id from the resource table of a
DLL file fine. I can also call DialogBoxIndirectParam with a dialog
loaded from the resource table of a DLL using

LoadResource(open_dll(DLL),FindResource(open_dll(DLL),DLG_100,RT_DIALOG))

The problem is in the dialog callback function. when processing
the WM_INITDIALOG message from my EUPHORIA function, I can only
call SetDlgItemText once.

consider the callback function:

function
 CallBack_Dialog_NewMap
 (
  atom hWindow,
  atom iMsg,
  atom wParam,
  atom lParam
 )

 if
  iMsg = WM_INITDIALOG
  then

  ? GetDlgItem(hWindow,IDC_EDIT2)
  ? SetDlgItemText(hWindow,IDC_EDIT1,allocate_string("100"))
  ? SetDlgItemText(hWindow,IDC_EDIT2,allocate_string("101"))
  ? GetLastError()
  ? GetDlgItem(hWindow,IDC_EDIT2)

 elsif
  iMsg = WM_COMMAND
  then

  if
   (
    LOWORD(wParam) = IDCANCEL or
    LOWORD(wParam) = IDOK
   ) and

   HIWORD(wParam) = BN_CLICKED

   then

   PostMessage(hWindow,WM_CLOSE,0,0)

  end if

 elsif
  iMsg = WM_CLOSE
  then

  EndDialog(hWindow,0)

 end if

 return FALSE

end function


when called with WM_INITDIALOG as the parameter for iMsg the result is:

3052 (or whatever, but IDC_EDIT2's handle)
1 (success)
0 (fail) for the second SetDlgItemText call
6 (ERROR_INVALID_HANDLE) for the call to GetLastError()
0 (the IDC_EDIT2 handle is now null?)

Am I overlooking something really basic here or is this some nuance of
Euphoric
proportion?

The same code compiled in a DLL and called in the same instance from
euphoria,
produces no error at all. (when the callback function is in a DLL.)


I know it sounds trivial, but surely there's a way euphoria can handle
dialogs when the same compiled C code works fine.

Still tearing my hair out,
Francis

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu