
- •Int winapi WinMain(hinstance hInstance, hinstance hPrevInstance, lpstr lpCmdLine, int nCmdShow)
- •If(!RegisterClass(&w)) return false;
- •If (!hWnd) return false;
- •InvalidateRect(hWnd,&rt,true);
- •InvalidateRect(hWnd,&rt,true);
- •InvalidateRect(hWnd,&rt,true);
- •InvalidateRect(hWnd,&rt,true);
- •Int winapi WinMain(hinstance hInstance, hinstance hPrevInstance, lpstr lpCmdLine, int nCmdShow)
- •If(!RegisterClass(&w)) return false;
- •If (!hWnd) return false;
- •If (!hWnd) return false;
- •If(!RegisterClass(&w)) return false;
- •If(!RegisterClass(&w)) return false;
- •If(!RegisterClass(&w)) return false;
- •InvalidateRect(hWnd,&rt,true);
- •If(!RegisterClass(&w)) return false;
- •Int winapi WinMain(hinstance hInstance, hinstance hPrevInstance, lpstr lpCmdLine, int nCmdShow)
- •If(!RegisterClass(&w)) return false;
- •If (!hWnd) return false;
- •InvalidateRect(hWnd,&rt,true);
- •InvalidateRect(hWnd,&rt,true);
- •InvalidateRect(hWnd,&rt,true);
- •InvalidateRect(hWnd,&rt,true);
- •Int winapi WinMain(hinstance hInstance, hinstance hPrevInstance, lpstr lpCmdLine, int nCmdShow)
- •If(!RegisterClass(&w)) return false;
- •If (!hWnd) return false;
- •InvalidateRect(hWnd,&rt,true);
- •Int winapi WinMain(hinstance hInstance, hinstance hPrevInstance, lpstr lpCmdLine, int nCmdShow)
- •If(!RegisterClass(&w)) return false;
- •If (!hWnd) return false;
- •Int winapi WinMain(hinstance hInstance, hinstance hPrevInstance, lpstr lpCmdLine, int nCmdShow)
- •If(!RegisterClass(&w)) return false;
- •If (!hWnd) return false;
- •Int winapi WinMain(hinstance hInstance, hinstance hPrevInstance, lpstr lpCmdLine, int nCmdShow)
- •If(!RegisterClass(&w)) return false;
- •If (!hWnd) return false;
- •Int winapi WinMain(hinstance hInstance, hinstance hPrevInstance, lpstr lpCmdLine, int nCmdShow)
- •If(!RegisterClass(&w)) return false;
- •If (!hWnd) return false;
- •Int winapi WinMain(hinstance hInstance, hinstance hPrevInstance, lpstr lpCmdLine, int nCmdShow)
- •If(!RegisterClass(&w)) return false;
- •If (!hWnd) return false;
- •Int winapi WinMain(hinstance hInstance, hinstance hPrevInstance, lpstr lpCmdLine, int nCmdShow)
- •If(!RegisterClass(&w)) return false;
- •If (!hWnd) return false;
- •Int winapi WinMain(hinstance hInstance, hinstance hPrevInstance, lpstr lpCmdLine, int nCmdShow)
- •If(!RegisterClass(&w)) return false;
- •If (!hWnd) return false;
- •If(!RegisterClass(&w)) return false;
Int winapi WinMain(hinstance hInstance, hinstance hPrevInstance, lpstr lpCmdLine, int nCmdShow)
{
char ProgName[]="My Window";
char Title[]="Заголовок окна";
HWND hWnd; MSG msg;
WNDCLASS w;
w.lpszClassName=ProgName;
w.hInstance=hInstance;
w.lpfnWndProc=(WNDPROC)MyWinP;
w.hCursor=LoadCursor(NULL, IDC_ARROW);
w.hIcon=LoadIcon(NULL,IDI_APPLICATION);
w.lpszMenuName=NULL;
w.hbrBackground=(HBRUSH)(COLOR_WINDOW+7);
w.style=CS_HREDRAW | CS_VREDRAW;
w.cbClsExtra=0;
w.cbWndExtra=0;
If(!RegisterClass(&w)) return false;
hWnd=CreateWindow(ProgName,Title, WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL,0,0,
600, 600, NULL, NULL, hInstance, NULL);
If (!hWnd) return false;
ShowWindow(hWnd, nCmdShow);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
using namespace std;
LONG MyWinP(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ static HWND Button1, Button3,Button2,Button4,Button5,Button6,edit1,
Button7,Button8,Button9,Button10,Button11,Combo1;
static int en,Nn;
float Ss;
int nItem;
switch(msg)
{ case WM_RBUTTONDOWN:
SendMessage(List1,LB_RESETCONTENT,0,0);
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case ID_LIST:
if (HIWORD(wParam)==LBN_DBLCLK)
{
nItem=SendMessage(List1,LB_GETCURSEL,0,(LPARAM)item);
if (nItem!=LB_ERR)
{
SendMessage(List1,LB_GETTEXT,nItem,(LPARAM)item);
SetWindowText(hWnd,item);
} }
break;
case ID_BUTTON1:
GetWindowText(edit1,item,4);
Ss=atof(item);
a.AddElem (Ss);
sprintf(item,"");
SetWindowText(edit1,item);
break;
case ID_BUTTON2:
a.PrintAllElem();
break;
case ID_BUTTON3:
GetWindowText(edit1,item,4);
Nn=atof(item);
sprintf(item,"");
SetWindowText(edit1,item);
a.PrintElem(Nn);
break;
} break;
case WM_CREATE:
Button1=CreateWindow("button","Добавить элемент", WS_CHILD|WS_VISIBLE,10,400,130,30,hWnd,(HMENU)ID_BUTTON1,NULL,NULL);
Button2=CreateWindow("button","Распечатать все", WS_CHILD|WS_VISIBLE,150,400,130,30,hWnd,(HMENU)ID_BUTTON2,NULL,NULL);
Button3=CreateWindow("button","Распечатать последних....", WS_CHILD|WS_VISIBLE,10,450,180,30,hWnd,(HMENU)ID_BUTTON3,NULL,NULL);
edit1=CreateWindow("edit", NULL, WS_CHILD|WS_VISIBLE|WS_BORDER|ES_CENTER,350,400,130,30,hWnd,(HMENU)ID_EDIT,NULL,NULL);
List1=CreateWindow("listbox",NULL,WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_HSCROLL|LBS_NOINTEGRALHEIGHT, 10,40,300,320,hWnd,(HMENU)ID_LIST,NULL,NULL);
SendMessage(List1,LB_SETHORIZONTALEXTENT,400,0);
//SendMessage(List1,LB_ADDSTRING,0,(LPARAM)"Списки");
// SendMessage(List1,LB_SETCURSEL,1,0);
en=1;
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, msg, wParam, lParam); }return 0;}
ИЗ ТЕКСТОВОГО ПОЛЯ В СТРОКУ СОСТОЯНИЯ
#include "Laba7.h"
#include <windows.h>
#include <commctrl.h>
#pragma comment (lib, "comctl32.lib")
#define ID_PR 1
#define IDC_STATUS_BAR 2
LONG MyWinP(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{char ProgName[]="Window";
char Title[]="Printer";
HWND hWnd;
MSG msg;
WNDCLASS w;
w.lpszClassName=ProgName;
w.hInstance=hInstance;
w.lpfnWndProc=(WNDPROC)MyWinP;
w.hCursor=LoadCursor(NULL,IDC_ARROW);
w.hIcon=LoadIcon(NULL,IDI_APPLICATION);
w.lpszMenuName=NULL;
w.hbrBackground=(HBRUSH)(COLOR_WINDOW+7);
w.style=CS_HREDRAW|CS_VREDRAW;
w.cbClsExtra=0;
w.cbWndExtra=0;