Results 1 to 5 of 5

Thread: Data type in API calls.

  1. #1

    Thread Starter
    Member gvphubli's Avatar
    Join Date
    May 2001
    Location
    INDIA
    Posts
    48

    Unhappy Data type in API calls.

    Hi experts,

    ------------------------------
    Public Declare Function SendMessage Lib "user32" _
    Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Long, lParam As Long) As Long
    ------------------------------

    here they use data type Long for hwnd if we change this to some other data type like byte and integer will the program shutdown.

    And how should I ensure that the existing API declarations in the project are correct...


    With warm rgds.
    Girish Patil
    Cracky - = DBA / Developer = -
    visit : http://www.geocities.com/gvphubli/

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    DO NOT EVER change the data type, it will fail, and quite possibly crash. read MDSN and look at the function prototypes to study how to call the API routines, or look at sites like www.allapi.net
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  3. #3
    Megatron
    Guest
    If you know what you're doing that it's okay to change the datatypes around. For example, some prefer that wParam and lParam should be declared as Any.

    A hWnd is really a datatype of HWND in C++, but you can go even lower, and find out that it's really an unsigned int. But VB doesn't support unsigned integers, so you have declare everything as Long.

  4. #4

    Thread Starter
    Member gvphubli's Avatar
    Join Date
    May 2001
    Location
    INDIA
    Posts
    48
    Thanks for Ur early replies VB buddies..
    Cracky - = DBA / Developer = -
    visit : http://www.geocities.com/gvphubli/

  5. #5
    Addicted Member ZanM's Avatar
    Join Date
    Oct 1999
    Location
    The here and now.
    Posts
    191
    The interesting thing about C++\Visual C++ is that MS has gone and added all these Data masks using Define hWnd is a long, wParam is a long, lParam is also a long but MS uses these Data masks for special types of information like a windows handle or a type of parameter in C++ a string is even a long in truth it's complecated stuff O'reilly has a very good book on the matter that if you read it three or four times makes since to us dumb vb programmers Win32 API for Visual Basic Programmer I think is the name link to book
    Magiaus
    Visual Basic 6.0 SP5
    Visual C++ 6.0 SP5


    The only sovereign you can allow to rule you is reason.

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