本文整理汇总了C++中UserInterface::setHwnd方法的典型用法代码示例。如果您正苦于以下问题:C++ UserInterface::setHwnd方法的具体用法?C++ UserInterface::setHwnd怎么用?C++ UserInterface::setHwnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserInterface
的用法示例。
在下文中一共展示了UserInterface::setHwnd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WndProc
/************************************************************************
*
* WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
* Function recieves windows messages and handles them.
*
*************************************************************************/
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static Balloon balloon; // Var to hold balloon data
static ParserABC* parser; // Pointer to abstract parser
static MapControl mapControl (hwnd); // Create MapControl
static UserInterface userInterface; // Create UserInterface
static WindDataReader windDataReader; // Create WindDataReader
static Predictor predictor; // Create predictor
// Set the predictors private data member to reference of balloon
predictor.setBalloon(&balloon);
static ControlState controlState(&predictor); // Create control state and pass reference of predictor
static HWND hwndCombo, hwndStatic, hwndQuit, hwndFollow,
hwndFpers, hwndFperm, hwndMpers; // Create handles for buttons on WndProcs UI
string buffer; // Buffer to display on the UI the most recent point
HDC hdc; // Device context for painting
PAINTSTRUCT ps; // Structure for painting
RECT rect; // RECT for representing the UI dimensions
// Checks to see if a serial message occurs
if (message == CSerialWnd::mg_nDefaultComMsg)
{
// Create serial event
const CSerialWnd::EEvent eEvent = CSerialWnd::EEvent(LOWORD(wParam));
// Switch to see what type of event
switch (eEvent)
{
case CSerialWnd::EEventRecv: // EVENT RECIEVED
// Read in the point recieved
parser->readIn();
buffer.resize (150);
// TODO: FIX THIS CRASHING
buffer = mapControl.getLatestPoint();
SetWindowText (hwndStatic, buffer.c_str());
break;
}
}
// Switch to see what message was sent
switch (message)
{
case WM_CREATE: // WINDOW CREATION
// Create child controls
hwndStatic = CreateWindow(TEXT("static"), NULL, WS_CHILD | WS_VISIBLE |
SS_LEFT, 10, 10, 160, 300, hwnd, (HMENU) STATIC,
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
hwndCombo = CreateWindow(TEXT("combobox"), NULL, WS_CHILD | WS_VISIBLE
| LBS_STANDARD, 10, 330, 60 + 100, 60 + 200, hwnd, (HMENU) COMBO,
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
hwndFollow = CreateWindow(TEXT("button"), TEXT("Follow"), WS_CHILD |
WS_VISIBLE | BS_CHECKBOX, 10, 400, 160, 40, hwnd, (HMENU) FOLLOW,
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
hwndQuit = CreateWindow(TEXT("button"), TEXT("Quit"), WS_CHILD
| WS_VISIBLE | BS_PUSHBUTTON, 100, 600, 70, 70, hwnd, (HMENU) QUIT,
(HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
// Create child control radio buttons
hwndFpers = CreateWindow(TEXT("button"), TEXT("f/s"),
WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON, 10, 470, 60, 20, hwnd,
(HMENU) FPERS, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
hwndFperm = CreateWindow(TEXT("button"), TEXT("f/m"),
WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON, 10, 490, 60, 20, hwnd,
(HMENU) FPERM, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
hwndMpers = CreateWindow(TEXT("button"), TEXT("m/s"),
WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON, 10, 510, 60, 20, hwnd,
(HMENU) MPERS, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
// Fill combo box with intervals
SendMessage (hwndCombo, CB_ADDSTRING, 0, (LPARAM) "1 Point Interval");
SendMessage (hwndCombo, CB_ADDSTRING, 1, (LPARAM) "3 Point Interval");
SendMessage (hwndCombo, CB_ADDSTRING, 2, (LPARAM) "6 Point Interval");
// Set default radio button
SendMessage (hwndFpers, BM_SETCHECK, 1, 0);
// Set userInterface private member _hwnd to WndProcs hwnd
userInterface.setHwnd (hwnd);
// Set mapControls private member _balloon to balloon
mapControl.setData (&balloon);
// Set windDataReaders private member _balloon to balloon
windDataReader.setBalloon (&balloon);
//.........这里部分代码省略.........