Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Source Help

Problem with Editbox in win32

A community discussion post from the original code:zIRON forum.

Molotov member
Posts
49
Threads
21
Location
Behind Keyboard

Problem with Editbox in win32

So what happens is that the application crashes if i write more than 11 chars in my "Editbox"

the code:

int32 length;
length = GetWindowTextLength(Edit1);
   if(length > 0) {
	length++;
	char* myText;
	myText = new length;
			
	if(myText != NULL) {
						
        	int32 x;
		x = 0;
		x = GetWindowText(Edit1, @myText, length);

"Lerning new things is what life is all about, if you are always doing the same old things day in and day out you might aswell just kill yourself." - ME d^_^b

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria
    x = GetWindowText(Edit1, myText, length);

using the @ symbol is to get a pointer...

since you have wrote

char* myText; //this is already a pointer
myText = new length; //allocates space.

//myText is already a pointer

example of when to use @

    char myText[1024];

    //code here
    x = GetWindowText(Edit1, @myText, length);
Molotov member
Posts
49
Threads
21
Location
Behind Keyboard

Ah must have missed that one.. Thanks :)

"Lerning new things is what life is all about, if you are always doing the same old things day in and day out you might aswell just kill yourself." - ME d^_^b