Lance,
after I compiled that small example on a W2K system it works.
It does not work on W2K when compiled on Win98.
It does not work on Win98 when compiled on Win98.
The API calls are the same so that's not it. Any other ideas?
Thomas.
------------------
[email protected]
Announcement
Collapse
No announcement yet.
WNetEnumResource and Error 487
Collapse
X
-
Guest replied
-
Guest repliedLance,
this is exactly the code I've used and with the WNetEnumResource
function I'm getting this 487 error.
This code is not the only one I tried. I had a snippet from the MSDN CD
with another example and this one is giving me the same error.
Is it possible that the API call is wrong with the parameters?
Regards.
Thomas
------------------
[email protected]
Leave a comment:
-
Originally posted by Frederic Faure:
Check out Lance's code, but you'll have to customize it because it uses the STDOUT function, so won't work in a Windows program.
------------------
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
Leave a comment:
-
Oops. Wrong APICheck out Lance's code, but you'll have to customize it because it uses the STDOUT function, so won't work in a Windows program.
FF.
------------
This works:
1. Open a DOS box, and run eg. "net use x: \\W2K\C$" where W2K is the name of your local box
2. Run this code:
#COMPILE EXE
#DIM ALL
#REGISTER NONE
#INCLUDE "WIN32API.INC"
Function PbMain () AS LONG
Local lResult AS LONG
Local sDrive AS ASCIIZ * 4
Local sPath AS ASCIIZ * 128
sDrive = "X:"
lResult = WNetGetConnection (sDrive,sPath, sizeof(sPath))
Select Case lResult
Case %NO_ERROR
MsgBox "Success! Remote host is " + sPath
Case Else
MsgBox "Error: " + str$(lResult) + ". Check WIN32API.INC and WIN32.HLP for more infos."
End Select
End Function
My ¥.2
FF.
------------------
[This message has been edited by Frederic Faure (edited October 21, 2001).]
Leave a comment:
-
The following is some PB/CC code that works fine for me (tested with PB/CC 2.0 under Windows 2000)
Code:'============================================================================== ' ' Network Resource List for PB/CC 1.0 ' Copyright (c) 1998 by PowerBASIC, Inc. ' ' Enumerate all of the networks and network resources available to the ' current machine. ' '============================================================================== $DIM ALL $INCLUDE "WIN32API.INC" '============================================================================== SUB EnumAll (nr AS NETRESOURCE) LOCAL hEnum AS LONG LOCAL Entries AS LONG LOCAL nSize AS LONG LOCAL ec AS LONG LOCAL x AS LONG LOCAL t AS STRING STATIC s AS STRING DIM n(1 TO 256) AS NETRESOURCE Entries = 256 nSize = SIZEOF(nr) * Entries s = s + " " ec = WNetOpenEnum(%RESOURCE_GLOBALNET, %RESOURCETYPE_ANY, %NULL, nr, hEnum) ec = WNetEnumResource(hEnum, Entries, n(1), nSize) FOR x = 1 TO Entries t = LEFT$(s & n(x)[email protected] + SPACE$(40), 40) + n(x)[email protected] IF LEN(RTRIM$(t)) THEN STDOUT t END IF IF (n(x).dwUsage AND %RESOURCEUSAGE_CONTAINER) THEN EnumAll n(x) END IF NEXT s = LEFT$(s, LEN(s) - 2) END SUB '============================================================================== FUNCTION WINMAIN (BYVAL CurInst&, _ BYVAL PrvInst&, _ CmdLine AS ASCIIZ PTR, _ BYVAL CmdShow&) EXPORT AS LONG LOCAL u AS ASCIIZ * 256 GetUserName u, 256 STDOUT "Network Resource List for " & u STDOUT "" EnumAll BYVAL %NULL END FUNCTION
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
Leave a comment:
-
WNetEnumResource and Error 487
Hi there,
now I'm comming in here with another (I think crazy) problem.
Everytime I call the WNetEnumResource Function I'm getting an
487 error that drives me nuts. Searching the Deja News up and down
but can not get an answer. I found sample codes but they give me
the same error messages and it looks like they work for their authors.
Does anyone have experience or snippets for enumerating network.
BTW I'm using PBDLL 6.0
Any help appreciated
Thomas Noelker
------------------
[email protected]Tags: None
Leave a comment: