Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


GET(SET)WindowText()

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Fri Aug 03, 2007 11:23 am    Post subject: GET(SET)WindowText() Reply with quote

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)

_________________
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Fri Aug 03, 2007 11:26 am    Post subject: Reply with quote

always check

1. return value
2. last error

combined they will almost always tell you what you did wrong.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites