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
|
#include <windows.h>
#define textfield 1
#define textfield2 3
#define text 2
#define text2 4
using namespace std;
char *b,*c;
char *title="EditBox Example";
LRESULT CALLBACK P(HWND A,UINT B,WPARAM C,LPARAM D){
switch(B){
case WM_CREATE:
CreateWindow("button","Change Title",WS_CHILD|WS_VISIBLE,150,150,100,25,A,(HMENU)text,NULL,NULL);
CreateWindow("button","Change in this textfield",WS_CHILD|WS_VISIBLE,300,150,170,25,A,(HMENU)text2,NULL,NULL);
CreateWindow("EDIT",
b,
WS_CHILD|WS_VISIBLE,
50,
100,
100,
25,
A,
(HMENU)textfield,
NULL,
NULL);
CreateWindow("edit",c,WS_CHILD|WS_VISIBLE,380,100,100,25,A,(HMENU)textfield2,NULL,NULL);
break;
case WM_COMMAND:
switch(LOWORD(C)){
case text:
title=b;
break;
case text2:{
if(title=b)
c="Hello";
} }
break;
case 0x2:
PostQuitMessage(0);
break;
default:
return DefWindowProc(A,B,C,D);
}
return 0;
}
int WINAPI WinMain(HINSTANCE A,HINSTANCE B,LPSTR C,int d){
HWND E;
MSG F;
WNDCLASS G={0};
G.hInstance=A;
G.lpszClassName=title;
G.lpfnWndProc=P;
G.hbrBackground=GetSysColorBrush(COLOR_3DFACE);
RegisterClass(&G);
CreateWindow(G.lpszClassName,title,0xcf0000|WS_VISIBLE,50,150,600,450,0,0,A,0);
while(GetMessage(&F,NULL,0,0)){
TranslateMessage(&F);
DispatchMessage(&F);
}
return F.wParam;
}
|