After building your resource in Visual C++ it is a good idea to open your resource in Origin to verify that it looks the way you want. Before accessing your resource in Origin, make sure your resource-only DLL and all the Origin C source and header files are in the same project folder.
To launch a Dialog Builder resource (dialog) in Origin with Origin C:
#include
both header files.Select the Tools:Rebuild All menu item in Code Builder to compile and link the Origin C code used to launch the resource.
The following example demonstrates how to construct an Origin C object of type Dialog and then use it to launch a modal dialog.
The example code below constructs an Origin C object of type ListDataSets and then launches a modal dialog in Origin using the ListDataSets.DoModal method. In this example the user-defined class type ListDataSets is derived from the built-in Origin C Dialog class and inherits all of its functionality.
ListDataSets dlgListDataSets; // Declare Dialog class derived object dlgListDataSets.DoModal(GetWindow()); // Launch modal dialog
The ListDataSets constructor used above declares the dlgListDataSets object by calling the Dialog class constructor. It passes the resource ID string of the dialog and the name of the resource-only DLL containing the dialog. The ListDataSets constructor is implemented elow.
ListDataSets() : Dialog(IDD_LDS_DLG, "ListDataSets") { }
The ListDataSets.DoModal method called above directly calls the Dialog.DoModal method passing to it the return value of the GetWindow function (a handle to the Origin window). The ListDataSets.DoModal function is implemented below.
int DoModal(HWND hParent = NULL) { InitMsgMap(); int nRet = Dialog::DoModal(hParent); return nRet; }
Note: See the example in the section Accessing a List Box Control with Origin C for a link to all source code used in this example.