Answer the question
In order to leave comments, you need to log in
SHBrowseForFolder how to force to display computer name?
There is a function to call a dialog box in which the computer name is selected. After that, a window should appear with a message that such a computer is selected.
bool GetFolder(LPTSTR szPath)
{
szPath[0] = 0;
bool result = false;
LPMALLOC pMalloc;
if (::SHGetMalloc(&pMalloc) == NOERROR) {
BROWSEINFO bi = { 0 };
::ZeroMemory(&bi, sizeof bi);
bi.lpszTitle = L"Выберите компьютер для подключения";
bi.ulFlags = BIF_BROWSEFORCOMPUTER;// BIF_RETURNONLYFSDIRS;
LPITEMIDLIST pidl = ::SHBrowseForFolder(&bi); //
if (pidl != NULL) {
if (::SHGetPathFromIDList(pidl, szPath))
result = true;
pMalloc->Free(pidl);
}
pMalloc->Release();
}
return result;
}
Answer the question
In order to leave comments, you need to log in
Do you still need to complete the task? and I hope you #include included?
//------------------------------------------------ ---------------------------
#define NO_WIN32_LEAN_AND_MEAN
#include
#include
#include
#pragma hdrstop
#include "Unit1.h"
//-- -------------------------------------------------- -----------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//------------------------------------------------ ---------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//------------------------------------------------ ---------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
BROWSEINFO info;
char szDir[MAX_PATH];
char szDisplayName[MAX_PATH];
LPITEMIDLIST pidl;
LPMALLOC pShellMalloc;
if(SHGetMalloc(&pShellMalloc) == NO_ERROR)
{
memset(&info, 0x00,sizeof(info));
//info.hwndOwner = Handle;
info.pidlRoot = 0;
info.pszDisplayName = szDisplayName;
info.lpszTitle = "Browse Title";
info.ulFlags = BIF_BROWSEFORCOMPUTER;
info.lpfn = 0;
pidl = SHBrowseForFolder(&info);
if(pidl)
{
if(SHGetPathFromIDList(pidl, szDir))
{
Label1->Caption = szDir;
}
Label2->Caption = info.pszDisplayName;
pShellMalloc->Free(pidl);
}
pShellMalloc->Release();
}
}
//---------------------------------------------- ------------------------------
Selecting directories works.
But here the choice of the network computer is not present.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question