bool LabelManager::Create(HINSTANCE hInstance) { // Save the DLL instance handle since we'll need it later mInstance = hInstance; // Create the window mWindow = CreateWindowEx(WS_EX_TOOLWINDOW, WINDOW_CLASS, NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, hInstance, this); if (!mWindow) { TRACE2("%s: CreateWindowEx failed, GetLastError returns %d", MODULE_NAME, GetLastError()); return false; } // Register for Litestep messages that we're interested in SendMessage(GetLitestepWnd(), LM_REGISTERMESSAGE, (WPARAM) mWindow, (LPARAM) gMessages); // Create the labels CreateLabels(); return true; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASSEX wc; HWND hwnd; MSG Msg; //Step 1: Registering the Window Class wc.cbSize = sizeof(WNDCLASSEX); wc.style = 0; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wc.lpszMenuName = NULL; wc.lpszClassName = g_szClassName; wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); if(!RegisterClassEx(&wc)) { MessageBox(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } // Step 2: Creating the Window hwnd = CreateWindow( wc.lpszClassName, "Moving", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 150, 150, 250, 180, 0, 0, hInstance, 0); if(hwnd == NULL) { MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } CreateLabels(hwnd); ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); // Step 3: The Message Loop while(GetMessage(&Msg, NULL, 0, 0) > 0) { TranslateMessage(&Msg); DispatchMessage(&Msg); } return Msg.wParam; }
//---------------------------------------------------------------------------- __fastcall TInputGroupBox::TInputGroupBox(TComponent* Owner) : TGroupBox(Owner) { OnEnter=TInputGroupBoxOnEnter; TextBox=CreateTextBox(); TypeBox=CreateTypeBox(); CreateLabels(); PopupMenu=CreatePopupMenu(); Width=205; Height=85; OnResize=OnResizeBox; }
PrayerGroup::PrayerGroup(QWidget *parent) : QGroupBox(parent){ //Setting the title of the group and the layout. PrayerTimesLayout = new QGridLayout(); PrayerTimesLayout->setVerticalSpacing(3); PrayerTimesLayout->setHorizontalSpacing(20); //Create the Labels. CreateLabels(); //Set the layout. PrayerGroup::setLayout(PrayerTimesLayout); //Set GUI texts. SetText(); }