Joe Strazzere - All Things Quality

Visit my new blog at http://strazzere.blogspot.com/


December 1, 2005 - WinTask - WNetGetConnection

Posted in WinTask

'
' WNetGetConnection - get the name of the network resource associated with a local device
'

' Author: Joe Strazzere
'

' WNetGetConnection(
'  LPCTSTR lpLocalName,  // local name
'  LPTSTR lpRemoteName,  // buffer for remote name
'  LPDWORD lpnLength     // buffer size
');

 

dim ptr1 as unsigned
dim ptr2 as unsigned
dim ptr3 as unsigned

 

ptr1=allocate(255)
ptr2=allocate(255)
ptr3=allocate(4)

 

local$ ="I:"     ' the local drive name
remote$="not found"  ' where the remote name goes

pokestring(ptr1,local$,1)
pokestring(ptr2,"                                                                ",1)
pokeinteger(ptr3,64,4)

 

ret = External("mpr","WNetGetConnectionA", ptr1, ptr2, ptr3)
remote$=peekstring$(ptr2)

 

If ret = 0 then
    msgbox(local$+" is really "+remote$,,"WNetGetConnection")
else
    msgbox("An error occurred trying to find "+local$+"  Return Code="+str$(ret))
EndIf


<- Last Page :: Next Page ->

About Me

A gathering place for information and ideas about Quality Assurance, Testing, and other useful topics.

Problems cannot be solved by the same level of thinking that created them. - A. Einstein

Search This Site

Translate This Site

RSS Feed

Subscribe

Twitter

@jstrazzere

Categories

Life
QA
Sports
Tools
WinTask
Work in General

What I'm Reading Now