|
-
Aug 2nd, 2001, 04:01 AM
#1
Thread Starter
Member
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/
-
Aug 2nd, 2001, 05:36 AM
#2
Fanatic Member
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]
-
Aug 2nd, 2001, 08:44 AM
#3
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.
-
Aug 2nd, 2001, 09:27 PM
#4
Thread Starter
Member
Thanks for Ur early replies VB buddies..
Cracky - = DBA / Developer = -
visit : http://www.geocities.com/gvphubli/
-
Aug 6th, 2001, 12:37 PM
#5
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|