PDA

Click to See Complete Forum and Search --> : Callbacks? slightly confused.....


crispin
Mar 8th, 2001, 04:19 AM
guys, consider the following:


Public Type editstream
dwCookie As Long
dwError As Long
pfnCallback As Long
End Type


the pfnCallback has to be the address of an application defined callback function, how do I go about pushing this in, this is how far I got....


Dim iResult&
eStream.dwCookie = 9
eStream.dwError = 0&
eStream.pfnCallback = AddressOf EditStreamCallback


I know this is incorrect - I just need some pointers here (scuse the pun :) )

KENNNY
Mar 9th, 2001, 12:13 PM
yeah, addressof only is valid as a parameter to a function unfortunately :(
so you can't put Addressof Myfunc directly into the type
but there's a simple workaround:

Function ReturnAddress(Byval FuncPtr as long) as long

ReturnAddress = FuncPtr

End function

so:

Dim iResult&
eStream.dwCookie = 9
eStream.dwError = 0&
eStream.pfnCallback = ReturnAddress(AddressOf EditStreamCallback)

Lord Orwell
Mar 9th, 2001, 09:11 PM
if you get this to work, can you email me? Im currently trying to get the em_streamout and em_streamin messages to work also. They both use that type declaration.

crispin
Mar 12th, 2001, 07:03 AM
Lord Orwell

Thats why I put the post out, If I get it working i'll post a new thread for ya!