Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using vb dll in PB 6.5

Status
Not open for further replies.

maboo

Programmer
Jan 4, 2002
21
US
I wrote a dll in visual basic 6.0.
I want to call those functions in the dll from pb6.5
I tried putting the declarations as global and local(not at the same time)

FUNCTION LONG ValidateUserName(STRING strUserName,REF STRING strErrorMsg) LIBRARY "c:\foldername\mydll.dll"

When I try and call this function I get an error:
'Error calling external function <functionname> at line ## in function <functionname> of object <myobject>'

Do I need to register this dll?
The .pbl(and dll) file that calls that dll is in one folder with mydll.dll, but the .exe file is in another. Does that matter?

Thanks






 
The only way I was able to use a function in a VB dll was to create an oleobject.

I declared a global variable go_object of type n_oo (I'm using the PFC).

Then in my code I instantiate the ole object, connect to it using ConnetToNewObject and call the function:


go_oleobject = CREATE n_oo
li_connect = go_oleobject.ConnectToNewObject("your_dll.whatever")

li_result = go_oleobject.Your_function_name(argument_1, argument_2, argument_ETC )

Don't quote me on this but apparently VB dll's are a different creature and can't be called the way you were attempting to do (which took me a long time to discover). There are other functions listed in help for oleobjects which might be more applicable to your situation. This is what worked for me.

I do believe the dll must still be registered though.

Hope that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top