Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:
Donate to VoyForums (PayPal):
[ Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: [1] ] |
#define IDC_AROW1 1000
#define IDI_ICON1 1001
#define IDM_MENU 1002
#define IDM_FILE_EXIT 1003
#define IDM_HELP_ABOUT 1004
#include "Resources.h"
IDC_AROW1 CURSOR "larrow.cur"
IDI_ICON1 ICON "wt.ico"
IDM_MENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", IDM_FILE_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About", IDM_HELP_ABOUT
END
END
//---------------------------------------------------------------------------
#include
#include "Resources.h"
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused
//---------------------------------------------------------------------------
const char *ClsName = "FundApp";
const char *WndName = "My First Win32 App";
LRESULT CALLBACK WndProcedure(HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam);
//---------------------------------------------------------------------------
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MSG Msg;
HWND hWnd;
WNDCLASSEX WndClsEx;
// Create the application window
WndClsEx.cbSize = sizeof(WNDCLASSEX);
WndClsEx.style = CS_HREDRAW | CS_VREDRAW;
WndClsEx.lpfnWndProc = WndProcedure;
WndClsEx.cbClsExtra = 0;
WndClsEx.cbWndExtra = 0;
WndClsEx.hIcon = LoadIcon(hInstance,
MAKEINTRESOURCE(IDI_ICON1));
WndClsEx.hCursor = LoadCursor(hInstance,
MAKEINTRESOURCE(IDC_AROW1));
WndClsEx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
WndClsEx.lpszMenuName = "IDM_MENU";
WndClsEx.lpszClassName = ClsName;
WndClsEx.hInstance = hInstance;
WndClsEx.hIconSm = LoadIcon(hInstance,
MAKEINTRESOURCE(IDI_ICON1));
// Register the application
RegisterClassEx(&WndClsEx);
// Create the window object
hWnd = CreateWindowEx(0,
ClsName,
WndName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
// Find out if the window was created
if( !hWnd ) // If the window was not created,
return FALSE; // stop the application
// Display the window to the user
ShowWindow(hWnd, nCmdShow);// SW_SHOWNORMAL);
UpdateWindow(hWnd);
// Decode and treat the messages
// as long as the application is running
while( GetMessage(&Msg, NULL, 0, 0) )
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
//---------------------------------------------------------------------------
LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg,
WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
case IDM_FILE_EXIT:
return 0;
break;
default:
// Process the left-over messages
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
//---------------------------------------------------------------------------
// If something was not done, let it go
return 0;
}
//---------------------------------------------------------------------------
Forum timezone: GMT-8 VF Version: 3.00b, ConfDB: Before posting please read our privacy policy. VoyForums(tm) is a Free Service from Voyager Info-Systems. Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved. |