请教各位,有没有什么api函数,来联接另一台电脑的 ,就好像在网络芳邻里,我们找到一台电脑后,通过输入用户名与密码 ,然后就可以进入该电脑了.
我如果知道另一台电脑的用户名与密码 ,想通过写一个程序,来联上另一台电脑 . 不知windows
有没有这样的API函数啊.请高手指点啊...........
我如果知道另一台电脑的用户名与密码 ,想通过写一个程序,来联上另一台电脑 . 不知windows
有没有这样的API函数啊.请高手指点啊...........
现window 2000系统如果要从对方电脑COPY 点资料过来,首先要在网络芳邻时找到该电脑,然后双击,
出现输入用户名与密码的Dialog, 如果我的电脑或者对方的电脑重新开机了,就得再次重新登入,故我想
写一个程序来替换登入这个动作 .
如:WNetAddConnection2
{
NETRESOURCE ns;
ZeroMemory(&ns, sizeof(ns)); ns.dwScope = RESOURCE_GLOBALNET;
ns.dwType = RESOURCETYPE_ANY;
ns.dwDisplayType = RESOURCEDISPLAYTYPE_GENERIC;
ns.dwUsage = RESOURCEUSAGE_CONNECTABLE;
ns.lpLocalName = "";
ns.lpRemoteName = strHost.GetBuffer(strHost.GetLength());
ns.lpProvider = NULL;
ns.lpComment = NULL;
strHost.ReleaseBuffer(); if(NO_ERROR == WNetAddConnection2(&ns, strPassword, strLogonName, 0))
{
return TRUE;
} return FALSE;
}//*************************call *******************************************
CString strHost = "\\\\192.168.1.7\\test\\temp";
if(Connect(strHost, "Administrator", "******************************"))
{
CString strSource = strHost + "\\Test.txt";
if(CopyFile(strSource, "E:\\TEMP\\WINNT\\TEMP\\test.txt", FALSE))
{
MessageBox("OK!");
}
}
你好!i really appreciate your help !
但我用SDK, 不知包含哪个头文件可以用CString类型 .
LINK : fatal error LNK1104: cannot open file "WNetAddConnection2.obj"
是因为"WNetAddConnection2.obj"未能在指定的位置生成,一般"Rebuild All"就可以解决,
同时注意要链接Mpr.lib库;2.用SDK, 不知包含哪个头文件可以用CString类型
本人对这种做法不太赞成,具体解决如下:// UseCStringInSDK.cpp : Defines the entry point for the application.
//#include "stdafx.h"int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
CString str = "Hello,World!";
MessageBox(NULL, str, "", MB_OK);
return 0;
}
//**********************************************************
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers//#include <windows.h>
#include <afx.h>//包含它,并将stdafx.h文件中的#include <windows.h>去掉即可
// TODO: reference additional headers your program requires here//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
HELLO :
你好!
还请教一下,
copyfile() 只能一个一个文件的COPY ,如果我想把一个文件夹的所有内容全部
都COPY 到另一个文件夹, 应如何解决..http://community.csdn.net/Expert/topic/3992/3992039.xml?temp=.6164209
**********************************************************************
具我所知:没有很好的方法,只有递归枚举目录下的每个文件,一个一个COPY!