C++/Win32 Illumination - part#1

Discussion in 'C++' started by Shahid Latif, Jun 19, 2011.

  1. Shahid Latif

    Shahid Latif New Member

    Joined:
    Jun 13, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    No doubt that C++ is a wonderful programming language. Although Visual Basic and Delphi and many other programming languages are used to programming Win32 API applications but C++ is a more dynamic and powerful than others. You know that C++ has some data types like unsigned int, int, char, double and so on. In the other hand, in Win32 API that is actually written in C, there are many custom data types like LPSTR, PSTR, LPTSTR, NULL and so on, which are very confusing. That is why, new programmers feels uncomfortable with them. Actually Microsoft engineers defined their custom data types in Win32 API because C++ is not a single language that uses Win32 API, there are many other languages that use Win32 API. I wrote this article to provide you some knowledge about mapping Win32 API data types to C++.

    1. LPSTR: Actually is Long Pointer to String.
    Which is you learned as char* in C++. Note: There is no long is C++.
    2. PSTR: Actually is Pointer to String.
    3. LPCSTR/PCSTR: Actually is Long Pointer to Constant String.
    Which is you learned as const char* in C++.
    4. NULL: Actually is null or 0 in C++. Note: You can not use NULL where actually number 0 is required.

    Try these C++ data types instead of writing Win32 data types and become comfortable with Win32 API.

    I will come soon with a new article.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice