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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 making a modeless dialog fails - solved!
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

stoelzer@p

Germany
5 Posts

Posted - 04/22/2008 :  4:17:00 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

vinden

China
Posts

Posted - 04/29/2008 :  01:19:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

stoelzer@p

Germany
5 Posts

Posted - 04/30/2008 :  09:55:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Vinden,

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

Thank you very much!
Mathias

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000