ifndef UNICODE define UNICODE endif include windows define ID_EDIT1 90

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef UNICODE
#define UNICODE
#endif
#include "windows.h"
#define ID_EDIT1 9000
#define ID_EDIT2 9001
#define ID_EDIT3 9002
#define ID_BUTTON1 9003
#define ID_BUTTON2 9004
#define ID_BUTTON3 9005
#define ID_LISTBOX1 9006
#define ID_LISTBOX2 9007
LRESULT CALLBACK NewWndProc(HWND hWnd,UINT Message, UINT wParam, LONG lParam)
{
switch (Message)
{
case WM_CLOSE:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd,Message,wParam,lParam);
}
void CreateNewWindow()
{
int WINAPI NewWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
WNDCLASSEX nmw;
nmw.cbClsExtra=NULL;
nmw.cbSize=sizeof(WNDCLASSEX);
nmw.cbWndExtra=NULL;
nmw.hbrBackground=(HBRUSH)(COLOR_BTNFACE+1);
nmw.hCursor=NULL;
nmw.hIcon=NULL;
nmw.hIconSm=NULL;
nmw.hInstance=hInstance;
nmw.lpfnWndProc=NewWndProc;
nmw.lpszClassName=L"NewWindow";
nmw.lpszMenuName=NULL;
nmw.style=CS_HREDRAW|CS_VREDRAW;
RegisterClassEx(&nmw);
HWND GenWindow=CreateWindowEx(NULL,L"NewWindow",L"Генератор",WS_OVERLAPPEDWINDOW|WS_VISIBLE,150,100,500,400,NULL,NULL,hInstance,NULL);
ShowWindow(GenWindow,nShowCmd);
UpdateWindow(GenWindow);
MSG msg;
while (GetMessage(&msg,NULL, 0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
}
void OnButton1Click()
{
CreateNewWindow();
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT Message, UINT wParam, LONG lParam)
{
switch (Message)
{
case WM_COMMAND:
if (wParam==ID_BUTTON3)
{
PostQuitMessage(0);
}
if (wParam==ID_BUTTON2)
{
}
if (wParam==ID_BUTTON1)
{
OnButton1Click();
return 0;
}
return 0;
case WM_CLOSE:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd, Message, wParam,lParam);
}
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
WNDCLASSEX mw;
mw.cbClsExtra=NULL;
mw.cbSize=sizeof(WNDCLASSEX);
mw.cbWndExtra=NULL;
mw.hbrBackground=(HBRUSH)(COLOR_BTNFACE+1);
mw.hCursor=NULL;
mw.hIcon=NULL;
mw.hIconSm=NULL;
mw.hInstance=hInstance;
mw.lpfnWndProc=WndProc;
mw.lpszClassName=L"Window";
mw.lpszMenuName=NULL;
mw.style=CS_HREDRAW|CS_VREDRAW;
RegisterClassEx(&mw);
HWND MainForm=CreateWindowEx(NULL,L"Window",L"MainWindow",WS_OVERLAPPEDWINDOW|WS_VISIBLE, 150,100,1000,800,NULL,NULL,hInstance, NULL);
HWND Edit1=CreateWindowEx(NULL,L"EDIT",L"",WS_CHILD|WS_VISIBLE,20,10,300,20,MainForm, (HMENU) ID_EDIT1, hInstance, NULL);
HWND Edit2=CreateWindowEx(NULL,L"EDIT",L"",WS_CHILD|WS_VISIBLE,20,40,300,20,MainForm, (HMENU) ID_EDIT2, hInstance, NULL);
HWND Edit3=CreateWindowEx(NULL,L"EDIT",L"",WS_CHILD|WS_VISIBLE,20,70,300,20,MainForm, (HMENU) ID_EDIT3, hInstance, NULL);
HWND Button1=CreateWindowEx(NULL,L"BUTTON",L"1", WS_CHILD|WS_VISIBLE, 20, 100, 100, 30,MainForm,(HMENU)ID_BUTTON1,hInstance, NULL);
HWND Button2=CreateWindowEx(NULL,L"BUTTON",L"2", WS_CHILD|WS_VISIBLE, 120, 100, 100, 30,MainForm,(HMENU)ID_BUTTON2,hInstance, NULL);
HWND Button3=CreateWindowEx(NULL,L"BUTTON",L"3", WS_CHILD|WS_VISIBLE, 220, 100, 100, 30,MainForm,(HMENU)ID_BUTTON3,hInstance, NULL);
HWND LisBox1=CreateWindowEx(NULL,L"LISTBOX",L"List_box", WS_CHILD|WS_VISIBLE, 20, 180, 300, 500, MainForm, (HMENU) ID_LISTBOX1,hInstance,NULL);
HWND LisBox2=CreateWindowEx(NULL,L"LISTBOX",L"List_box", WS_CHILD|WS_VISIBLE, 330, 180, 300, 250, MainForm, (HMENU) ID_LISTBOX2,hInstance,NULL);
ShowWindow(MainForm,nShowCmd);
UpdateWindow(MainForm);
MSG msg;
while (GetMessage(&msg,NULL, 0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}