CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2010
    Posts
    13

    Need Some Information

    Hey everyone, i'm new to Win32 API.

    I just had a few questions:

    1. If i need to get numbers from an EDIT box, i use GetWindowText, but i'm wondering, do you always need to convert the char to the specified data type (e.g. atoi(number)) ?

    2. As i'm new i'm using char something[20] to put data into a buffer (i think), but ive seen another method:

    something = (char*)GlobalAlloc(GPTR, 50) and GlobalFree((HANDLE)something);

    I'm wondering, is there any difference, e.g. stable, efficiency, speed?

    Thank,

    Russell

  2. #2
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Need Some Information

    For 1., it looks like you answered your own question.

    For 2., GlobalAlloc and GlobalFree are used mainly for passing buffers between diverse processes. You can just use the C++ new[] and delete[] operators if you just need local memory buffers for your app.

  3. #3
    Join Date
    Mar 2010
    Posts
    28

    Re: Need Some Information

    If you want to get Integer from EDIT box, you can use GetDlgItemInt(). This way you don't have to convert char into integer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured