The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 making a modeless dialog fails - solved!

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
stoelzer@p Posted - 04/22/2008 : 4:17:00 PM
Origin Version (Select Help-->About Origin): 7.5 Pro SR6
Operating System: WinXP all updates
MS Visual C++ 6

I want to program a tool window similar to the linear fitting tool, but not tabbet, only a simple dialog. My OC program without the dialog runs well. I made a dialog resource following the "Creating A Microsoft Visual C++ Resource-only DLL" chapter in the programming help, and I can launch it modal. But I want to have it non-modal like the linear fitting tool.
In "Launching Dialog Builder Resources with Origin C" I'm adviced
quote:
Locate a function in the source file (*.c or *.cpp) that contains code constructing an Origin C object of type Dialog and calling either the Dialog.Create or Dialog.DoModal method. The Dialog.Create method launches a modeless dialog and the Dialog.DoModal method launches a modal dialog.

I found only the Dialog.DoModal method. I changed the files made by the Dialog Wizard as follows:
MyDialog.cpp
bool DoMyDialog() 
{
MyDialog myDlg;
myDlg.Create( GetWindow() );
return true;
}

MyDialog.h
class MyDialog : public Dialog
{
public:
MyDialog() : Dialog(IDD_MYDIALOG, "MyDialog")
{
}

BOOL Create(HWND hParent = NULL)
{
InitMsgMap();// will be called from internal later
BOOL BRet = Dialog::Create(hParent);
return BRet;
}


When I launch DoMyDialog, an "unhandled exception in origin75.exe (OK70.DLL)" is announced and CodeBuilder and Origin crash.
What do I wrong? I cant help myself anymore.

Mathias

Edit: Changed bool ==> BOOL, but the exception does still occur. Don't anybody know an example of a modeless dialog made with OC?

Edited by - stoelzer@p on 04/24/2008 5:29:34 PM

Edited by - stoelzer@p on 04/30/2008 09:56:30 AM
2   L A T E S T    R E P L I E S    (Newest First)
stoelzer@p Posted - 04/30/2008 : 09:55:36 AM
Hi Vinden,

actually I do not completely understand why, but is works.

Thank you very much!
Mathias

vinden Posted - 04/29/2008 : 01:19:59 AM
Hi,Mathias

Following is the method to made a modeless dialog,in Origin Version 7.5 ProSR6,you should change the function
DoMyDialog() as belowing:


static MyDialog MyDlg;
BOOL DoMyDialog(BOOL bClose=FALSE)
{
if(MyDlg.GetWindow())
{
if(!bClose)
{
out_str("Dialog already open");
return FALSE; //already open
}
//we will need to close it
return TRUE;
}

return MyDlg.Create();
}



In Origin Version 8.0,the method as you mention will works well.

Thanks
Vinden




Edited by - vinden on 04/29/2008 10:18:21 PM

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000