Incorporating Windows Code into a Rogue Wave Views Application
You can easily incorporate into your Rogue Wave® Views application Windows menus and panels that were created with one of the numerous interface generators that Microsoft Windows supports. Examples can be found in the subdirectory foundation\windows, which is located under <ILVHOME>\samples. Refer also to the Views Foundation Tutorials in the online documentation.
The following example displays a panel that was created by any interface builder, and linked with your application with the resource compiler.
#define VIEW_ID 1010 // The ID of a sub-window in the panel
int PASCAL ILVEXPORTED
DialogProc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
// Create some Views object in the dialog.
InitRogueWaveViews((IlvDisplay*)lParam, GetDlgItem(dlg, VIEW_ID));
return 1;
case WM_COMMAND:
if (wParam == QUIT_ID) {
EndDialog(dlg, 1); // Close the dialog
ReleaseRogueWaveViews(); // Delete Views objects
PostQuitMessage(0); // Exit the event loop
return 1;
}
}
return 0;
}
int
main(int argc, char* argv[])
{
// Connect to the windowing system.
IlvDisplay* display = new IlvDisplay("RogueWaveViews", "", argc, argv);
if (display->isBad()) {
IlvFatalError("Couldn’t connect to display system");
delete display;
return 1;
}
// Create the dialog box.
if (DialogBoxParam(display->getInstance(), "MY_PANEL", 0,
(FARPROC)DialogProc, (long)display) == -1)
IlvFatalError("Couldn’t create dialog");
delete display;
return 1;
}
void
InitRogueWaveViews(IlvDisplay* display, HWND wnd)
{
// For example: a container that uses the ‘wnd’ window.
container = new IlvContainer(display, wnd);
...
}void
ReleaseRogueWaveViews()
{
delete container;
}
In the
InitRogueWaveViews member function, a new
IlvContainer object holding an existing Windows panel,
wnd, is created. In your user interface generator, you must specify that
RogueWaveViewsWndClass is the WindowsClass to be used for that window.
In this example, since a main function is provided instead of the WinMain entry point that Microsoft Windows expects to start an application, you have to link your object files with the ILVMAIN.OBJ file. This file, supplied with Rogue Wave Views, defines a default WinMain function that does all the necessary initialization operations and calls the main function.
Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.