OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Constructing a Frame Window Alias

This TFrameWindow constructor is used to connect an existing interface element to a new TFrameWindow object.

This object is known as an alias for the existing window.

TFrameWindow(HWND hWnd, TModule *module);
ParameterExplanation
hWndThe window handle of the existing interface element. This is the window the TFrameWindow object controls.
modulePassed to the base class constructor as the TModule parameter for that constructor. This parameter defaults to 0.

This version of the constructor is useful for creating window objects for existing windows. You can then manipulate any window as if it were an ObjectWindows-created window. This is useful in situations such as DLLs, when a non-ObjectWindows application calling into the DLL passes in an HWND. You can then construct a TFrameWindow alias for the HWND and call TFrameWindow member functions as you normally would.

Example

The following example shows how to construct a TFrameWindow for an existing interface element and use that window as the main window:

void TMyApplication::AddWindow(HWND hWnd)
{
TFrameWindow* frame = new TFrameWindow(hWnd);
TFrameWindow* tmp = SetMainWindow(frame);
ShowWindow(GetMainWindow()->HWindow, SW_SHOW);
tmp->ShutDownWindow();
}

When you use this constructor for TFrameWindow, it sets the flag wfAlias. You can tell whether a window element was constructed from its window object or whether it's actually an alias by calling the function TWindow::IsFlagSet() with the wfAlias flag. For example, suppose you do not know whether the function AddWindow in the last example has executed yet. If your main window is not an alias, AddWindow has not executed. If your main window is an alias, AddWindow has executed.

void TMyApplication::CheckAddExecute()
{
if(GetMainWindow()->IsFlagSet(wfAlias))
// MainWindow is an alias; AddWindow has executed
else
// MainWindow is not an alias; AddWindow has not executed
}

See Also