Parent Window for DoModal() ??

  • Thread starter Thread starter Alhexx
  • Start date Start date
Status
Not open for further replies.
A

Alhexx

Guest
Okay, here's my problem:
I wanted to move some of Ultima's dialogs into a VC++ DLL, b'cause of better data type check and etc. However, I wanted to call the dialog via DoModal() and *BANG* - it crashed... :(
I've been debugging the dll and I've found out that it has got to do with the dialogs parent window. Well, if you call a Dialog via DoModal() in a C++ app, then it has it parent window - the mainframe.
However, if you call it from a DLL, I will have to specify the parent window manually, but how??

Okay, here's the code I used:
I've got a Dialog and its Class CDiaVert. The window will be created by a global function called DiaAddVertex by Ultima:

Code: [Select]
Code:
// Add New Vertex Dialog Functionint APIENTRY DiaAddVertex(int *iNumVertex, ff7_vertex *pVertex, ff7_color *pColor){ AFX_MANAGE_STATE(AfxGetStaticModuleState()); CDiaVert VertDia; VertDia.SetData( iNumVertex, pVertex, pColor); if(VertDia.DoModal() != IDOK) {  return -1; } else {  VertDia.GetData(iNumVertex, pVertex, pColor);  return 0; }}

Okay, passing Ultima's main window handle to the DLL should be no problem, but how do I tell the DoModal()-Function to use this handle??

 - Alhexx
 
it should go like this:

Code: [Select]
Code:
{   CDiaVert *VertDia;   VertDia = new CDiaVert( IDD_OF_DIALOG_RESOURCE, handle_to_parent_window );   VertDia->SetData();   if( VertDia->DoModal() != IDOK ) {   }   delete VertDia;}

'this' can be used as handle_to_parent_window
but i dont know if it'll help you, because i tried it also with NULL and it worked for me ... i would tell more if i would see it on my own.
 
Hm .. that sounds interesting. I'll try it out. Thanx.

(1 more to go...)

 - Alhexx
 
Status
Not open for further replies.
Back
Top