com >> Function-Pointer?

by Christoph Basedau » Wed, 24 Aug 2005 04:11:59 GMT

Hi

I have an ActiveX-DLL for validating user-entries from UI-Controls (mostly text-boxes)
The validation-method is very basic.
It validates whether the data entered matches the expected datatype (int, long, double etc)
and optionally minimae and maximae for numeric and date values or length
and pattern for strings.
In order to make a more specific validation i would like to pass a function-pointer
from the client to the the dll, that points to a boolean validation function.
In JavaScript one can pass a func-pointer by simply passing its name (without brackets),
in C/C++ it is similar.
Is there such a thing in VB (Maybe AdressOf, or CallByName)?

Any help appreciated.

--
Gruesse, Christoph



com >> Function-Pointer?

by Karl E. Peterson » Wed, 24 Aug 2005 04:24:02 GMT





Yes, AddressOf will work fine, if you're passing the function pointer directly, as a
parameter to the DLL call. If you need to stuff the pointer into a structure, you
can do so something like this:

wincls.lpfnWndProc = FcnPtr(AddressOf WindowProc)

Private Function FcnPtr(ByVal Whatever As Long) As Long
' Return whatever was passed.
FcnPtr = Whatever
End Function

--
Working Without a .NET?
http://classicvb.org/petition





com >> Function-Pointer?

by scott.marquardt » Thu, 01 Sep 2005 02:00:00 GMT

Pinging Chris --

Some time ago you posted a superb script for walking Internet
Explorer's history.

Simple question: is it possible to retreive more granular date/time
information, or is it stored only to minute precision?

Sorry to interrupt, gentlemen . . .

- Scott



Function-Pointer?

by Christoph Basedau » Thu, 01 Sep 2005 18:03:07 GMT

Karl E. Peterson schrieb:





Thanks Karl

AdressOf does the trick. Thanks very much.


If you need to stuff the pointer into a

--
Gruesse, Christoph



Function-Pointer?

by Christoph Basedau » Thu, 01 Sep 2005 18:04:13 GMT

XXXX@XXXXX.COM schrieb:


Sorry i am afraid i can't remember of the details.
afair it deals with GetDetailsOf which in 2nd position receives
a column-param, that retrieves the specific information.
it's not doucmented which column returns what data, so you could simply
try your luck by looping over the first dozen of integers.

sth like

for i=0 to 20
WScript.Echo histFolder.GetDetailsOf (null, i), _
histFolder.GetDetailsOf (histItem, i)
next


where histFolder is the history folder as Shell Special Folder
and histItem is an ShellFolderItem.

--
Gruesse, Christoph



Function-Pointer?

by scott.marquardt » Fri, 09 Sep 2005 13:08:07 GMT

Thanks. Yeah, no luck. Minute granularity it is, I'm afraid.



Similar Threads

1. validating function pointer returned by an exported function

Hi,

I have a dll and one of its exported function is suppossed to return a
pointer to an object.
How can i check whether the exported function is of the same prototype
i want.

Please comment 

Thanks & Regards
Srilal

2. Passing function pointer from VB .NET to C dll - VB.Net

3. C++ Function Pointer to VB.Net

To all gurus,

I am currently converting some of C++ codes to VB.net

The C++ Codes is as follows :

================= C++ CODE ==================
typedef struct _tagBBCameraParameter
{
unsigned int preview_width;
unsigned int preview_height;
unsigned int preview_x;
unsigned int preview_y;
unsigned int preview_format;
unsigned int preview_zoom;

const TCHAR* capture_file_name;

unsigned int contrast;
unsigned int saturation;
unsigned int brightness;

} BBCameraParameter;

typedef LPVOID HBBCAMERA;

BBAPI DWORD WINAPI BBCameraPreviewStart(HBBCAMERA,
BBCameraParameter*);
BBAPI DWORD WINAPI BBCameraPreviewStop(HBBCAMERA);

================= END C++ CODE ==================

I managed to convert most of the codes to VB.Net but when I try to fun
BBCameraPreviewStart function, it gives error.

'=================Partial VB.Net Code


Public Shared Function BBCameraPreviewStart(ByVal HBBCamera As IntPtr,
ByRef BBParam1 As BBCameraParameter) As Integer
End Function

Public Shared Function BBCameraPreviewStop(ByVal HBBCamera As IntPtr)
As Integer
End Function

'=========== END OF PARTIAL VB.NET CODES

This is how i pass the parameters;

Dim BBParam as BBCameraParameter '// already declared but not shown
here
Dim HBBCamera as IntPtr '//Handle

'I have no problems getting handle but once i set the parameters for
BBParam and pass as follows, i get error (not much help from the
message).

BBCameraPreviewStart(HBBCAMERA, BBParam)

How do I call function BBCameraPreviewStart correctly? Did i do it
correctly?

Please advices.
Thanks

4. Passing function pointer in VB.Net - VB.Net

5. Function pointers in .NET?

Hi,

Can anyone tell me if there's any easy way to set up a function pointer in
VB.NET?

Thanks


6. Function Pointers? - VB.Net

7. Function Pointer

8. Visual Basic 6.0 function pointers - Visual Basic