To create a popup window, it should have the WS_POPUPWINDOW
and the WS_CAPTION styles. It should fit a relatively small
rectangle. It may also have the WS_EX_TOOLWINDOW extended style.
In this exercise, to illustrate our point, we will
create a frame-based application where a popup window is the main object.
Practical Learning: Introducing Tables
|
|
-
Start Microsoft Visual C++ 5, 6, or .NET
-
Create an Win32 Project in a folder called PopupWnd1.
Create it as an Empty Project
-
For this exercise, we will Use MFC In A Shared DLL. If
you don't how to do this:
in the main menu of MSVC 5 and 6, click Project -> Settings... and, in
the Microsoft Foundation Classes combo box, select Use MFC in a Shared DLL
in MSVC .NET, in the Solution Explorer, right-click the project name and
click Properties. On the right side, find Use of MFC and click it to display
its combo box. In the combo box, select Use MFC in a Shared DLL.
-
Create a new C++ Source file and save it as Exercise
-
In the empty file type:
#include <afxwin.h>
struct CFrameTest : public CFrameWnd
{
CFrameTest()
{
Create(NULL, "Windows Application Tester",
WS_POPUPWINDOW | WS_CAPTION,
CRect(400, 280, 580, 520), NULL, NULL,
WS_EX_TOOLWINDOW);
}
};
struct CAppTest : public CWinApp
{
BOOL InitInstance()
{
CFrameTest *Tester = new CFrameTest();
m_pMainWnd = Tester;
Tester->ShowWindow(SW_NORMAL);
return TRUE;
}
};
CAppTest theApp;
|
-
Test the application
|
|