Register | Login
Forum Index > Source Help > Problem with Editbox in win32
Author Message
Pages: 1
Molotov
Member
(send private message)

Posts: 49
Topics: 21

Location:
Behind Keyboard
[758] Problem with Editbox in win32 - posted: 2011-11-20 18:46:28
So what happens is that the application crashes if i write more than 11 chars in my "Editbox"

the code:

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
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[759] - posted: 2011-11-20 18:48:34
Code:
    x = GetWindowText(Edit1, myText, length);


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

since you have wrote

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

//myText is already a pointer


example of when to use @

Code:
    char myText[1024];

    //code here
    x = GetWindowText(Edit1, @myText, length);


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Molotov
Member
(send private message)

Posts: 49
Topics: 21

Location:
Behind Keyboard
[760] - posted: 2011-11-20 18:50:06
Ah must have missed that one.. Thanks smile

"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
Pages: 1
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 1 user(s) online. 0 member(s) and 1 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd