1、在VC里,要打开一个文件,获取文件路径,只要用CFileDialog类来实现。
现在我想让用户选择一个文件夹,获取这个文件夹的路径,应该怎么实现?
是否有类似CFileDialog选择打开文件的对话框那样,可以选择文件夹的类?2、在局域网内,程序要访问另一台机器某个固定的共享文件,
如果这台机器启动后未曾访问过那台机器(访问要验证用户名和密码),程序将访问失败!
请问在这种情况下能否在程序中验证另一台机器的用户名密码,如何实现?
现在我想让用户选择一个文件夹,获取这个文件夹的路径,应该怎么实现?
是否有类似CFileDialog选择打开文件的对话框那样,可以选择文件夹的类?2、在局域网内,程序要访问另一台机器某个固定的共享文件,
如果这台机器启动后未曾访问过那台机器(访问要验证用户名和密码),程序将访问失败!
请问在这种情况下能否在程序中验证另一台机器的用户名密码,如何实现?
解决方案 »
- 求如何实现全屏透明窗口
- 怎么设置Excel单元格颜色呀
- 問個關於PreSubclassWindow的問題
- 别人写的VC源代码
- 请问怎么在一MFC程序中同时用CSocket\CAsynSocket 类和用WSASocket函数
- 抄《ATL 开发指南》第四章的例子,用nmake编译proxy/stub DLL失败,为什么?
- 最近来了各工程 老板让我重用户需求中建立一个数据库 因该看那方面的资料?
- WIN98下作的软件想升级到WIN2000该怎么办啊??(很急、很急!~)
- 如何让每次模态对话框在响应菜单命令的时候都正常显示出来呢?[/
- ATL高手请进-__(不好意思,只有这么多分了)
- vc+ado+oledb+Oracle 为什么记录集无法更新?(100分,在线等.....)
- 怎么去掉一个CListCtrl的水平滚动条?
LPMALLOC pMalloc;
/* Gets the Shell's default allocator */
if (::SHGetMalloc(&pMalloc) == NOERROR)
{
BROWSEINFO bi;
char pszBuffer[MAX_PATH];
LPITEMIDLIST pidl;
// Get help on BROWSEINFO struct - it's got all the bit settings.
bi.hwndOwner = GetSafeHwnd();
bi.pidlRoot = NULL;
bi.pszDisplayName = pszBuffer;
bi.lpszTitle = _T("get the directory for input");
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
// This next call issues the dialog box.
if ((pidl = ::SHBrowseForFolder(&bi)) != NULL)
{
if (::SHGetPathFromIDList(pidl, pszBuffer))
{
// At this point pszBuffer contains the selected path */.
//DoingSomethingUseful(pszBuffer);
this->SetDlgItemText (IDC_IN,pszBuffer); }
// Free the PIDL allocated by SHBrowseForFolder.
pMalloc->Free(pidl);
}
// Release the shell's allocator.
pMalloc->Release();
}
2.net api,NetShareAdd...
http://www.codeguru.com/Cpp/W-D/dislog/ 先查看Dialog for selecting folders类2
DWORD WNetAddConnection2(
LPNETRESOURCE lpNetResource, // connection details
LPCTSTR lpPassword, // password
LPCTSTR lpUsername, // user name
DWORD dwFlags // connection options
);
-------------
lpLocalName :Points to a null-terminated string that specifies the name of a local device to redirect, such as "F:" or "LPT1". The string is treated in a case-insensitive manner.
If the string is empty, or if lpLocalName is NULL, the function makes a connection to the network resource without redirecting a local device.