HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Fri Aug 03, 2007 11:23 am Post subject: GET(SET)WindowText() |
|
|
| Code: | #include <windows.h>
#define CEL_BUTTON 1
#define FER_BUTTON 2
#define BUFFER_SIZE 256
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
static char sClassName[] = "MyClass";
static HINSTANCE zhInstance = NULL;
INT Cel;
CHAR szText[BUFFER_SIZE];
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow) {
WNDCLASSEX WndClass;
HWND hwnd;
MSG Msg;
zhInstance = hInstance;
WndClass.cbSize = sizeof(WNDCLASSEX);
WndClass.style = NULL;
WndClass.lpfnWndProc = WndProc;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = zhInstance;
WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
WndClass.lpszMenuName = NULL;
WndClass.lpszClassName = sClassName;
WndClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&WndClass)) {
MessageBox(0, "Error Registering Class!", "Error!", MB_ICONSTOP | MB_OK);
return 0;
}
hwnd = CreateWindowEx(WS_EX_STATICEDGE, sClassName, "Hide Icon", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
CW_USEDEFAULT,
359, 359, NULL, NULL, zhInstance, NULL);
if(hwnd == NULL) {
MessageBox(0, "Error Creating Window!", "Error!", MB_ICONSTOP | MB_OK);
return 0;
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&Msg, NULL, 0, 0)) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
int retCel(INT fer)
{
Cel = fer - 32;
return Cel;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
HWND hButton, hButton2, hEdit, hEdit2;
switch(Message) {
case WM_CREATE:
hButton = CreateWindowEx(NULL, "Button", ">>>>>>",
WS_BORDER | WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
0, 40,
100, 30,
hwnd, (HMENU)CEL_BUTTON,
zhInstance, NULL);
hButton2 = CreateWindowEx(NULL, "Button", "<<<<<<",
WS_BORDER | WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
110, 40,
100, 30,
hwnd, (HMENU)FER_BUTTON,
zhInstance, NULL);
hEdit = CreateWindowEx(NULL, "Edit", "32.0",
WS_BORDER | WS_CHILD | WS_VISIBLE,
0, 0,
100, 30,
hwnd, NULL,
zhInstance,
NULL);
hEdit2 = CreateWindowEx(NULL, "Edit", "0",
WS_BORDER | WS_CHILD | WS_VISIBLE,
110, 0,
100, 30,
hwnd, NULL,
zhInstance,
NULL);
break;
case WM_COMMAND:
if (LOWORD(wParam) == CEL_BUTTON)
{
GetWindowText(hEdit, szText, sizeof(szText));
//retCel(szText);
SetWindowText(hEdit2, szText);
}
if (LOWORD(wParam) == FER_BUTTON)
{
}
else{}
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
}
|
im just trying to get the hang of receiving and setting text usign these 2 commands but it doesnt seem to be working, i want it to set hEdit2 to hEdit text(32.0)
_________________
|
|