Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return UNC path for shared local LPT1:
Message
From
07/11/2000 17:43:56
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00438857
Message ID:
00439060
Views:
17
>>>>Is there a way and how do you do it, to rturn the shared name for a printer mapped to the local lpt1: port?
>>>>
>>>>I can get the shared names for devices mapped to the current PC but I cannot get the shared name of the local device.
>>>
>>>DOS Tip: Rogaine.
>>>
>>>You can enumerate the shares on a network using my NETRESOURCE class, and look for the printer shares associqted with a given server, but that doesn't solve the problems of possibly associating more than one name with a device, or the shared device being indirectly shared as a pooled resource in a domain.
>>
>>Ed:
>>
>>Unless I'm missing something, If the printer is shared on the current PC, the share name cannot be returned.
>
>
>Would you care to make a small wager?


This is the code. I got the basics from the API section here on the UT. The WNetConnection returns 1.

*************************************

DECLARE INTEGER WNetGetConnection IN WIN32API ;
STRING @ lpLocalName, ;
STRING @ lpRemoteName, ;
INTEGER @ lpnLength

*!* cLocalDevice = 'S:'
*!* cLocalDevice = 'HP LaserJet 4 Plus'

cLocalDevice = 'LPT1:'

cUNCBuffer = REPLICATE(CHR(0),261)
nLength = LEN(cUNCBuffer)


IF WNetGetConnection(cLocalDevice, @cUNCBuffer, @nLength) = 0
MessageBox('The UNC for '+ cLocalDevice + ' is ' + LEFT(cUNCBuffer,AT(CHR(0),cUNCBuffer)-1))
Else
MessageBox([Error] )
ENDIF
***************************************************

When I download you clsheap and netrsc, and run the getallshare I get the following:

Microsoft Windows Network Microsoft Windows Network CONTAINER ANY

*************************

Am I missing something?
Fred Lauckner

You know, it works on my computer. I don't know what your problem is.

.Net aint so bad.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform