Help needed with unusual OCX Method (Objct Call) requirement

Started by gian young, January 04, 2006, 03:52:12 AM

Previous topic - Next topic

gian young

While I know this is really a PowerBasic code related question I have posted my request for assistance here first because I now do all my PB development with FireFly.

I am currently working on integrating a well known third party ActiveX graphics control into FireFly and having a good deal of success with it. When I have completed my testing and developement I will be glad to share my Properties and Method access Inc. code with anyone who may be interested.

While I do have most of it working as it should, I have met with some difficulty implementing one particular method call and am looking for some words of wisdom from anyone who can help. (Jose Help).

This particular OCX incorporates one method whereby it merges the image of one control onto the image of the other control. This Method call requires a parameter of Type .Object passed to it.

In VB code the (Method) Call looks like this:-

Control1.MethodName Control2.Object, Xpos, Ypos

(I have reproduced this in VB6 and it works fine.)


In PB8 I have assumed this would be handled with a PB Object Call Statement.

I have tried the following code without success.

Object Call DispatchObject1.MethodName (DispatchObject2Vnt, XposVnt, YposVnt)

DispatchObject1 is a Dispatch variable and DispatchObject2 is also a Dispatch variable.

In attempting to Pass the Control2.Object to the PB Object Call statement I could only take the Dispatch variable of Control2 and place it into a Variant.

DispatchObject2Vnt is a Variant of DispatchObject2, XposVnt and YposVnt are Variants of Xpos and Ypos respectively.

I have tested the above Object statement with OBJRESULT immediately afterwards and no error is generated, ie: the code appears to run Ok but the net result is negative, the Control doesn't respond. Am I passing the second control's Object parameter correctly ??

Any ideas appreciated ??

Regards

Gian Young

Dataman Barcode Systems Australia

Jose Roca

The way to pass an object variable is to assign it to a variant and pass the variant. If you are using PBWin 7.x the assigment must be done with SET: SET DispatchObject2Vnt = DispatchObject2.

If it fails, generate wrapper functions with my TypeLib Browser, cut the wrapper for the failing method, and call it using OBJPTR to pass the pointers, that is, if the parameter for the DispatchObject2 is a DWORD, not a VARIANT, that I don't know because your post is too "abstract".

gian young

Hello Jose,

Thank you very much for your assistance and prompt reply to my request.

Re: If you are using PBWin 7.x the assigment must be done with SET: SET DispatchObject2Vnt = DispatchObject2.

I am currently using PBWin 8.01.

DispatchObject2 is a Dispatch variable and I have assigned the Variant DispatchObject2Vnt with LET DispatchObject2Vnt = DispatchObject2

You have helped by confirming that I am on the right track. Unfortunately the Object Call does fail using this approach so I am interested in your second suggestion of using your TypeLib Browser to generate wrapper functions.

Please excuse my ignorance but I am only aware of your Typlib Browser as a Tool to generate Event Code as supplied with FireFly. I do not know how to use it outside of FireFly to generate any other code, especially as wrappers for Properties and Methods. Could you please explain further, especially as to how to use the OBJPTR to pass the pointers.

You could be correct in that I may have to pass the parameter for the DispatchObject2 is a DWORD. I appreciate your interest and assistance.

Regards

Gian Young
Australia

Jose Roca

The version used in FireFly is an stripped down version used only to generate code for events sink. You can download the full browser in my website: http://com.it-berater.org/typelib_browser.htm

Generate the wrappers following the instructions posted in the web page, cut the one for the method that fails, poste it in this thread and I will tell you how to use it.

gian young

Dear Jose,

Thank you once again for your help and guidance, I have downloaded the information you have provided and will now spend some time absorbing the information.

I will take you up on your offer of help with using the wrapper function when I am confident that I have the correct information to send you.

Once again thanks, your WebSite and the information contained within it is great.

Regards

Gian Young
Australia