Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DCOM or COM?
Message
 
 
À
20/04/2001 10:38:46
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00497236
Message ID:
00497912
Vues:
10
Jim,
Pass the buffersize parameter by reference. It's supposed to be writable if the buffersize isn't big enough. WinAPI must be choking on that.

I would also recommend using CHR(0) in place of chr(32) to pre-populate your lcRemoteName buffer. That way you don't have to worry about spaces embedded in the returned name. You can simply get everything up to the first CHR(0).

>>Jim,
>>
>>I understand completely. The WSH is undoubtedly interfacing with MPR.DLL (and quite a few others as well depending on the object).
>>
>>I deal with with a lot of Win95B boxes. My post-setup executable checks for the presence of the WSH and, if not found, does a silent install. Given the additional functionality and the reduced code to maintain, it's too good a tool not to take the extra few steps to insure that it's installed on the target machine. I think that if you read over the series (which just deals with the additional functionality it can provide VFP basically) you might come to the same conclusion.
>
>George,
>
>I'm going to take you advice and read the series when I have more time. I'm under the gun at the moment. What I've done is write a quick function to return the UNC path. Problem is it ain't working! The function always returns an error number of 487. Maybe a spare set of eyes can see an obvious problem that I can't:
>
>
>LPARAMETERS tcDriveLetter
>
>#DEFINE NO_ERROR 0
>#DEFINE BUFFER_SIZE 255
>
>LOCAL lnSize, lcDriveLetter, lnRemoteBuffer, ;
>     lcRemoteName, lnStatus, lcLocalName
>
>IF PCOUNT() = 0
>     tcDriveLetter = "c:\"
>ENDIF
>
>STORE 0 TO lnSize
>lcRemoteName = SPACE(BUFFER_SIZE)
>lcLocalName  = ""
>lcDriveLetter = UPPER(LEFT(tcDriveLetter,1)) + ":"
>
>DECLARE INTEGER WNetGetConnection IN Win32API ;
>     STRING @lcLocalName, STRING @lcRemoteName, ;
>     INTEGER lnSize
>
>&& Specifies the size in charaters of the buffer.
>lnRemoteBuffer = BUFFER_SIZE
>
>&& Return the UNC path (\\Server\Share)
>lnStatus = WNetGetConnection(lcDriveLetter, lcRemoteName, ;
>     lnRemoteBuffer)
>
>&& Check to see if WNetGetConnection() succeeded.
>&& returns 0 if it succesfully retrieves the UNC path.
>IF lnStatus  = NO_ERROR
>     ? lcRemoteName
>ELSE
>     ? "Unable to obtain the UNC path. Error = "+ allt(str(lnStatus))
>ENDIF
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform