|
-
May 5th, 2000, 07:20 AM
#1
Thread Starter
Addicted Member
I am trying to use the icq api but am getting this error message when I try to use one of the function.
The function set wich of MY functions (In my app) will be called when a certain notification from ICQ arrives...
here goes..
Now the documentation for the ICQ API is written for C++, I have managed to convert most of them but maybe this one is not converted correctly ?
What the documentation says:
Code:
void WINAPI ICQAPIUtil_SetUserNotificationFunc(UINT uNotificationCode, void *pUserFunc);
In a module:
Code:
Public Declare Function ICQSetUserNotificationFunc Lib "ICQMAPI.dll" Alias "ICQAPIUtil_SetUserNotificationFunc" (uNotificationCode As Integer, ByVal pUserFunc As Variant)
In the code of a form:
Code:
Call ICQSetUserNotificationFunc(1, AddressOf ICQOnlineListChange)
Is the function converted correctly ? if it is, what is the problem. If not , How should it be?
-
May 5th, 2000, 07:59 AM
#2
Frenzied Member
Try
Code:
Public Declare Function ICQSetUserNotificationFunc Lib "ICQMAPI.dll" Alias "ICQAPIUtil_SetUserNotificationFunc" (uNotificationCode As Long, ByVal pUserFunc As Long)
-
May 5th, 2000, 08:13 AM
#3
Thread Starter
Addicted Member
Thanks for the reply...
I have tried your declaration but still get the same error message...
Any other ideas?
-
May 5th, 2000, 08:21 AM
#4
Thread Starter
Addicted Member
I just read about "_stdcall" for use with AdressOf...
Should I use this?
What is it?
How do I use it?
-
May 5th, 2000, 11:07 AM
#5
Member
Originally posted by David Laplante
I just read about "_stdcall" for use with AdressOf...
Should I use this?
What is it?
How do I use it?
In C++, you specify this as part of the function type
declaration to tell the compiler how the addressing is
handled. I've only had call to use this in a C++ DLL, so
don't know how it applies in VB.
[Edited by ShepherdOfChaos on 05-06-2000 at 12:08 AM]
-
May 5th, 2000, 05:38 PM
#6
Frenzied Member
The 2nd is Definatley a function pointer, which means you need to declare it as a long and use the addressof operator
The First is a UINT which sounds like an unsigned integer but it could be a long one or a short one, so if the 2 longs don't work then try an integer and a long.
Actually I've just noticed it's a function so It returns something, which the C++ code doesn't try declaring it as a sub
-
May 5th, 2000, 11:47 PM
#7
Thread Starter
Addicted Member
YEAH BABY!
That worked! of course! how could I have not seen it... it was declared a VOID... wich means it doesn't return anything. It was a SUB not a FUNCTION
Thanks for your help!
-
May 6th, 2000, 01:15 AM
#8
Frenzied Member
that's just one of those annoying things that nobody spots, I once spent 2 monts trying to debug a subclassing procedure only to realise that I'd forgotten to declare my parameters ByVal. D'OH
-
Jul 30th, 2001, 06:04 AM
#9
Lively Member
Sometimes you can define a DLL function correct and then VB still tells you that it's not,
If you put an On Error Resume Next just before the DLL and an On Error Goto 0 just after the DLL, you will probably find that the function did execute allthough VB tell's you it didn't
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
|