Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 09 MAY 2003 07:08:19PM Wayne Shepard wrote:

I am attempting to call WNetAddConnection2 from OI. The Visual Basic declaration is as follows:

Declare Function WNetAddConnection2 Lib "mpr.dll" Alias "WNetAddConnection2A" (lpNetResource As NETRESOURCE, ByVal lpPassword As String, ByVal lpUserName As String, ByVal dwFlags As Long) As Long

The problem is that I don't see any way to get OI to send a string as a parameter "Byval", only as a reference.

First, is it true that byval parameter passing is not possible in the OI implementation? Is there a workaround?

Second, here's my workaround idea: If my byval strings are both less than eight characters, maybe I can define the parameters as "double" and pass them that way. Can anyone think of any reason why this would not work?

Wayne Shepard

Zadek, Inc.


At 09 MAY 2003 07:27PM Pat McNerthney wrote:

Wayne,

Use LPSTR for both lpPassword and lpUserName. If you look at the documentation WNetAddConnection2 here at msdn.microsoft.com, these parameters are declared as pointers to constant strings.

Pat


At 12 MAY 2003 05:56PM Wayne Shepard wrote:

Thanks. I guess "byval" means something different from what I thought it meant. Anyway, I did that and now I'm getting an error "ENG0805: MYPROG line 70, Function WNetAddConnection2 does not exist in dynamic link library MPR." I can't find anything in that Windows Networking documentation that says what the correct name of the DLL is. I was trusting my Visual Basic example for that. Do you know where I can find that out?

Wayne


At 13 MAY 2003 07:35AM Sean FitzSimons wrote:

Wayne,

Hidden at the bottom of this page at MSDN it states the function is in the MPR library.

Sean


At 13 MAY 2003 11:13AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:

Wayne,

Sean is correct, it IS in MPR.DLL but you need to specify the ANSI or Unicode version of the function:

ie WNetAddConnection2A or WNetAddConnection2W

and alias it as WNetAddConnection2 when you prototype it.

The Sprezzatura Group

World leaders in all things RevSoft


At 20 MAY 2003 05:40PM Wayne Shepard wrote:

Thanks. I was wondering what that was for. I've gotten past that error and now I'm having a problem with GetPointer that I've raised under a new topic.

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/8b595d6ec16ac8f685256d21007f1b0e.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1