Click here to Skip to main content
15,895,256 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CListCtrl and Ado RecordSet Pin
David Crow8-Dec-04 2:45
David Crow8-Dec-04 2:45 
GeneralRe: CListCtrl and Ado RecordSet Pin
shiraztk8-Dec-04 3:02
shiraztk8-Dec-04 3:02 
GeneralRe: CListCtrl and Ado RecordSet Pin
David Crow8-Dec-04 3:29
David Crow8-Dec-04 3:29 
GeneralNTGraph2D and VC++ .NET Pin
doneirik8-Dec-04 2:32
doneirik8-Dec-04 2:32 
QuestionHow to retrieve a VCProject object? Pin
Franz Klein8-Dec-04 2:17
Franz Klein8-Dec-04 2:17 
QuestionHow to convert BD_ADDR to BT_ADDR? Pin
eli150219798-Dec-04 1:20
eli150219798-Dec-04 1:20 
Questionusing ipconfig....help required??? Pin
shkhan8-Dec-04 0:43
shkhan8-Dec-04 0:43 
QuestionHow to copy files to another computer using Window XP by programming? Pin
dungle308-Dec-04 0:40
dungle308-Dec-04 0:40 
Hi all,

I've a problem: copy files to remote computer using Window XP by programming.

I have found WNetAddConnection2 function, but when I try to use this function connect to remote computer use WinXP with user has administrator right, it alway return "5" (Access Denied).

Here is my code

==================RemoteConnect.cpp=======================
#include <windows.h>
#include <stdio.h>
#include <winnetwk.h>

void main(){
NETRESOURCE nr;
DWORD res;
TCHAR szUserName[32] = "administrator",
szPassword[32] = "",
szLocalName[32] = "Q",
szRemoteName[MAX_PATH] = "\\\\sas\\C$";

//
// Assign values to the NETRESOURCE structure.
//
nr.dwType = RESOURCETYPE_DISK;
nr.lpLocalName = szLocalName;
nr.lpRemoteName = szRemoteName;
nr.lpProvider = NULL;

printf("%s\n", nr.lpRemoteName);

//
// Call the WNetAddConnection2 function to assign
// a drive letter to the share.
//
res = WNetAddConnection2(&nr, szPassword, szUserName, FALSE);
//
// If the call succeeds, inform the user; otherwise,
// print the error.
//
if (res == NO_ERROR)
printf("Connection added %s\n", szRemoteName);
else
printf("Error: %ld\n", res);
return;
}
==========================================================

Anyone know why this function failed?

If possible, please show me the solution to connect to remote computer using Win XP by programming (using WNetAddConnection or the other solutions).

I've hear about tftp, but i wonder that, if the remote computer don't have tftp listening, how can i use tftp to copy the files to it?

Please, help me find the right solution to do that.

Many thanks.


.::LDLP::.
AnswerRe: How to copy files to another computer using Window XP by programming? Pin
David Crow8-Dec-04 2:38
David Crow8-Dec-04 2:38 
GeneralRe: How to copy files to another computer using Window XP by programming? Pin
dungle308-Dec-04 15:08
dungle308-Dec-04 15:08 
GeneralRe: How to copy files to another computer using Window XP by programming? Pin
David Crow9-Dec-04 2:31
David Crow9-Dec-04 2:31 
QuestionHow to minimize the window? Pin
ting6688-Dec-04 0:30
ting6688-Dec-04 0:30 
AnswerRe: How to minimize the window? Pin
ThatsAlok8-Dec-04 1:29
ThatsAlok8-Dec-04 1:29 
AnswerRe: How to minimize the window? Pin
David Crow8-Dec-04 2:40
David Crow8-Dec-04 2:40 
AnswerRe: How to minimize the window? Pin
toxcct8-Dec-04 21:42
toxcct8-Dec-04 21:42 
GeneralLstCtrl::FindItem() doubt Pin
xcavin8-Dec-04 0:08
xcavin8-Dec-04 0:08 
GeneralRe: LstCtrl::FindItem() doubt Pin
David Crow8-Dec-04 2:43
David Crow8-Dec-04 2:43 
GeneralQuestion concerning IO file Pin
tpndtbk7-Dec-04 22:19
tpndtbk7-Dec-04 22:19 
GeneralRe: Question concerning IO file Pin
ThatsAlok8-Dec-04 1:25
ThatsAlok8-Dec-04 1:25 
GeneralRe: Question concerning IO file Pin
tpndtbk8-Dec-04 4:18
tpndtbk8-Dec-04 4:18 
GeneralRe: Question concerning IO file Pin
David Crow8-Dec-04 5:06
David Crow8-Dec-04 5:06 
GeneralRe: Question concerning IO file Pin
RChin8-Dec-04 5:53
RChin8-Dec-04 5:53 
GeneralRe: Question concerning IO file Pin
tpndtbk8-Dec-04 21:36
tpndtbk8-Dec-04 21:36 
GeneralRe: Question concerning IO file Pin
tpndtbk9-Dec-04 0:57
tpndtbk9-Dec-04 0:57 
GeneralHelppppppp Pin
eli150219797-Dec-04 21:45
eli150219797-Dec-04 21:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.