Call DLL from OI. ENG0805 error (OpenInsight 16-Bit Specific)
At 21 AUG 2002 02:00:31PM matt bavis wrote:
I am trying for the first time to call a dll from Basic+. When I try to use it in a Stored Procedure I get the following message "ENG0805: TEST_DLL, line 8. Function WNETGETCONNECTIONA does not exist in dynamic link library MPR.DLL." Obviously I'm trying to use the function WnetGetConnectionA that is located in the MPR.DLL. Are there additional steps that I need to take to get this to work?
Thanks for any suggestions,
Matt
The following is my sysprocs entry.
SYSPROCS*DLL_MPR
MPR
LONG PASCAL WNetGetConnectionA(SHORT,LONG,LONG)
I saved it and then ran RUN DECLARE_FCNS "DLL_MPR"
My stored procedure looks like this:
COMPILE SUBROUTINE TEST_DLL (VOID)
DECLARE FUNCTION WNetGetConnectionA
buf_size=255
cbRemoteName=255
lpszRemoteName=str(' ',buf_size)
ret=WNetGetConnectionA("F:",lpszRemoteName,cbRemoteName)
RETURN
At 21 AUG 2002 02:52PM Oystein Reigem wrote:
Matt,
The "A" in WNetGetConnectionA makes me think this function is 32-bit. Is there a 16-bit WNetGetConnection you can use?
- Oystein -
At 21 AUG 2002 04:22PM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Matt,
It appears that your're trying to call a 32-bit DLL function from OI16.
If you're using OI16 then you need to call the WNetGetConnection() function that is located in USER.EXE. You should prototype it like so in the DLL_USER record in the SYSPROCS table:
USHORT PASCAL WNetGetConnection( LPCHAR, LPCHAR, LPUSHORT )
You should then be able to call the function like so after you've run declare_fcns():
declare function WNetGetConnection
lpszLocalName=SomeLocalName' : \00\
lpszRemoteName=str( \00\, 2048 )
cbRemoteName=len( lpszRemoteName )
retVal=WNetGetConnection( lpszLocalName, lpszRemoteName, cbRemoteName )
and so on….
The WNetGetConnectionA function is a 32-bit equivalent that is exported from MRP.DLL but can only really be called from 32-bit apps, so forget this unless you're working with OI32
World leaders in all things RevSoft
At 22 AUG 2002 09:42AM matt bavis wrote:
Thanks for the instruction, worked perfectly.
Matt