WNetAddConnection2 in a service 
Author Message
 WNetAddConnection2 in a service

I'm using the standard WNetAddConnection2 API call in my code.  If I run it
in the load event of a windows form, then everything works fine.  If,
however, I try to use it in the OnStart event of a windows service then the
first time I run it it works fine, but when I restart the service, it fails
with error 85 - ERROR_ALREADY_ASSIGNED.  If I restart the machine then it
again works fine the first time the service runs, but again fails when the
service restarts.

I've tried adding a call to WNetCancelConnection2 before the connect
attempt.  That is failing with error 2250 - ERROR_LOCAL_DRIVE

To keep this post manageable, I haven't included my own code as I don't
think it's necessary.  If someone does want to see it the then let me know
and I can post it.  The basic connection code is available here
http://www.*-*-*.com/

If anyone else has come across this problem in a service, then I'd love to
hear any ideas.

Thanks.

--
Rob Oldfield
www.realuk.co.uk



Fri, 09 Sep 2005 20:45:02 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. WNetAddConnection2 in a service (repost)

2. NT Service and WNetAddConnection2 problem

3. Problem w/ nt service and WNetAddConnection2

4. Using WMI to obtain dependent services (restarting services and all dependent services)

5. Help: Logging into NT using WNetAddConnection2

6. DCOM: error 1312 on WNetAddConnection2

7. WNetAddConnection2 API Call ????????

8. WNetAddConnection2 & /user:domain\username

9. WNetAddConnection2 Question

10. WNetAddConnection2 Error Codes?

11. HELP: WNetAddConnection2 and VB - SOLUTION FOUND

12. Q: Win API - usage of WNetAddConnection2

 

 
Powered by phpBB® Forum Software