Results 1 to 3 of 3

Thread: API Translation

  1. #1
    NOMADMAN
    Guest

    API Translation

    I've got the API Guide and want to know if I can use the API calls in it with C++, even though the examples are in VB.

    I'm asking about the declarations, not the usage. I can figure that out. I'm in terested in:



    VB Code:
    1. Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    2.  
    3. 'AND
    4.  
    5. Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer

    Also, with the RECT declaration. do I declare that as

    Code:
    struct RECT {
         long Left;
         long top;
         long right;
         long bottom;
    }
    I'm new to C++ so thats probably horribly wrong, so please bare with me!

    Thanks
    NOMAD

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    The API declarations are in windows.h, the only thing you need to do is include windows.h and you will be able to use any of API functions defined for win32api. Even if you know the usage since VB you'd better look up the usage again in MSDN since win32api is has names most types for their specific purposes.
    RECT and any other API related types are also in windows.h, RECT's members are all lowercase btw.

    If you haven't programmed C++ before, it's recommended that you choose a tutorial (check out the FAQ) and go trough the language concepts and first when you're trough start with the API, since C++ differs from VB in a lot of ways that would cause you trouble if you don't get them straight from the beginnning.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    NOMADMAN
    Guest
    Thanks

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