Азбука программирования в Win32 API


Азбука программирования в Win32 API - стр. 133


CONTROL "", ID_Edit, "edit", ES_LEFT | WS_CH1LD | WS_VISIBLE [

WS_BORDER | WS_TABSTOP | HS_NUMBER, 25, 14, 50. 12 >

И, естественно, основной файл программы.

#include <windows.h>

#include <commctrl.h>

#include "ProgressBar.h"

HINSTANCE hlnst;

LRESULT CALLBACK ProgressBarWndProc ( HWND, UINT, UINT, LONG ); BOOL CALLBACK ProgressBarDialogProc(I!WND, UINT, WPARAM,

LPARAM);

int WINAPI WinMain (HINSTANCE hinstancc, HINSTANCE hPrcvInstancc, LPSTR IpszCmdParam, int nCmdShow )

HWND hWnd ;

WNDCLASS WndClass ;

MSG Msg;

char szClassNamef] = "ProgressBarDemo"

hlnst = hinstancc;

158

/* Registering our window class */ /* Fill WNDCLASS structure */

WndClass.stylc = CS_HREDRAW j CS_VREDRAW;

WndClass.IpfhWndProc = ProgressBarWndProc;

WndClass.cbClsExtra = 0;

WndClass.cbWndExtra = 0;

WndClass.hlnstance = hlnstance ;

WndClass.hlcon = Loadlcon (NULL,!DI_APPLICATION);

WndClass.hCursor = LoadCursor (NULL, 1DC_ARROW);

Wndclass.hbrBackground - (HBRUSH) GetStockObject (WHITE_BRUSH);

WndClass.IpszMenuNamc = "ProgressBarMenu";

WndClass. IpszClassName = szClassName;

if ( !RegistcrClass(&WndClass)) {

MessageBox(NULL,"Cannot register cIass","Error",MB_OK); return 0;

} hWnd = CrealeWindow(szClassName, "Progressbar Demonstration Program",

WS_OVERLAPPED\VINDOW,CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, Mnstance,NULL); if(!hWnd) {

MessageBox(NULL,"Cannot create window","Error",MB_OK); return 0;

/* Show our window */ ShowWindow(hWnd,nCmdShow); Update Window(hWnd);

/* Beginning of messages cycle */

while(GetMessage(&Msg, NULL, 0, 0)) {

TranslateMessagc(&Msg); DispatchMessage(&Msg); ( return Msg.wParam;

LRESULT CALLBACK ProgressBarWndProc (HWND hWnd, UINT Message,

UINT wParam, LONG IParam )

j t

swilch(Mcssage) {

case WM_COMMAND; swilch(LOWORD(wParain))

159

case IDM_Dialog:

DialogBoxfhlnst, "ProgressBarDialog", liWnd, ProgressBarDialogProc);




Начало  Назад  Вперед



Книжный магазин