Click here to Skip to main content
15,915,164 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ graphics modes Pin
Brendan Tregear9-Nov-00 12:48
Brendan Tregear9-Nov-00 12:48 
Generaltricky question about endl Pin
Erich Ruth7-Nov-00 7:47
Erich Ruth7-Nov-00 7:47 
GeneralRe: tricky question about endl Pin
Michael Dunn7-Nov-00 9:17
sitebuilderMichael Dunn7-Nov-00 9:17 
GeneralRe: tricky question about endl Pin
Erich Ruth7-Nov-00 11:40
Erich Ruth7-Nov-00 11:40 
GeneralRe: tricky question about endl Pin
Michael Dunn7-Nov-00 14:37
sitebuilderMichael Dunn7-Nov-00 14:37 
GeneralRe: tricky question about endl Pin
Erich Ruth8-Nov-00 3:27
Erich Ruth8-Nov-00 3:27 
GeneralRe: tricky question about endl Pin
Erik Funkenbusch8-Nov-00 10:38
Erik Funkenbusch8-Nov-00 10:38 
GeneralProblem to get computer name Pin
Cheickna7-Nov-00 7:11
Cheickna7-Nov-00 7:11 
Hi,

Here is a function (above) to browse Computers names on network.
It work but I have a problem to get the name of machine which is selected.
If i use this call :

CString strDir = BrowseForFolder(m_hWnd, "Select a folder", 0 );

with browseInfo.pidlRoot=NULL;

I obtain the name of folder selected.

BUT WITH THIS CALL

CString strDir = BrowseForFolder(m_hWnd, "selected a computer", BIF_BROWSEFORCOMPUTER );
with browseInfo.pidlRoot=(_ITEMIDLIST *)0x12;

The function browse very match only computer but my variable strDir is empty at the end.
I try to use this other function :

SHGetSpecialFolderPath(hWnd,szBuffer,CSIDL_NETHOOD ,0);

but i have a entry point problem to shell32.dll

Can anybody help me to get computer name?


Function
================================================================================

CString& CTestDlg::BrowseForFolder(HWND hWnd, LPCSTR lpszTitle, UINT nFlags)
{

static CString strResult = "";

LPMALLOC lpMalloc; // pointer to IMalloc

if (::SHGetMalloc(&lpMalloc) != NOERROR)
return strResult; // failed to get allocator

char szDisplayName[_MAX_PATH];
char szBuffer[_MAX_PATH];

BROWSEINFO browseInfo;
browseInfo.hwndOwner = hWnd;
// set root at Network Neighborhood ( if NULL then set root at Desktop )
browseInfo.pidlRoot = (_ITEMIDLIST *)0x12;
browseInfo.pszDisplayName = szDisplayName;
browseInfo.lpszTitle = lpszTitle;
browseInfo.ulFlags = nFlags;
browseInfo.lpfn = NULL; // not used
browseInfo.lParam = 0; // not used

LPITEMIDLIST lpItemIDList;


if ((lpItemIDList = ::SHBrowseForFolder(&browseInfo))
!= NULL)
{

// Get the path of the selected folder from the
// item ID list.
if (::SHGetPathFromIDList(lpItemIDList, szBuffer))
{
// At this point, szBuffer contains the path
// the user chose.
if (szBuffer[0] == '\0')
{
// SHGetPathFromIDList failed, or
// SHBrowseForFolder failed.
//AfxMessageBox(IDP_FAILED_GET_DIRECTORY,MB_ICONSTOP|MB_OK);
return strResult;
}

// We have a path in szBuffer!
// Return it.
strResult = szBuffer;
return strResult;
}
else
{
// The thing referred to by lpItemIDList
// might not have been a file system object.
// For whatever reason, SHGetPathFromIDList
// didn't work!
//AfxMessageBox(IDP_FAILED_GET_DIRECTORY,MB_ICONSTOP|MB_OK);
return strResult; // strResult is empty
}

lpMalloc->Free(lpItemIDList);
lpMalloc->Release();
}

// If we made it this far, SHBrowseForFolder failed.
return strResult;

}
GeneralOpening file resizes the frame Pin
Guillaume Belzile7-Nov-00 5:50
sussGuillaume Belzile7-Nov-00 5:50 
Generalhelp with C++ and TCL Pin
Alejandro7-Nov-00 4:32
Alejandro7-Nov-00 4:32 
GeneralDCOM vs. Sockets Pin
josh7-Nov-00 0:40
josh7-Nov-00 0:40 
GeneralDLL Dialog Misery Pin
Justin Somerville6-Nov-00 20:39
Justin Somerville6-Nov-00 20:39 
GeneralRe: DLL Dialog Misery Pin
David Fedolfi14-Nov-00 3:46
David Fedolfi14-Nov-00 3:46 
GeneralCFileDialog Default Directory Pin
Ron Ginsberg6-Nov-00 13:24
Ron Ginsberg6-Nov-00 13:24 
GeneralRe: CFileDialog Default Directory Pin
Michael Dunn6-Nov-00 16:05
sitebuilderMichael Dunn6-Nov-00 16:05 
GeneralRe: CFileDialog Default Directory Pin
Ron Ginsberg7-Nov-00 5:35
Ron Ginsberg7-Nov-00 5:35 
GeneralRe: CFileDialog Default Directory Pin
Berkut7-Nov-00 6:10
Berkut7-Nov-00 6:10 
GeneralComputers names on network Pin
CHEICKNA TRAORE6-Nov-00 11:08
CHEICKNA TRAORE6-Nov-00 11:08 
GeneralRe: Computers names on network Pin
Christian6-Nov-00 15:07
Christian6-Nov-00 15:07 
GeneralGetDeviceCaps(BITSPIXEL) Pin
kk96-Nov-00 9:12
kk96-Nov-00 9:12 
GeneralSetup INF Help Pin
KrustY6-Nov-00 3:06
KrustY6-Nov-00 3:06 
GeneralRe: Setup INF Help Pin
manish chaudhari6-Nov-00 4:54
manish chaudhari6-Nov-00 4:54 
GeneralSetup INF Help Pin
KrustY6-Nov-00 3:05
KrustY6-Nov-00 3:05 
GeneralDifferentiate Windows Explorer and IE Pin
Eq6-Nov-00 0:04
Eq6-Nov-00 0:04 
GeneralCopying a value from ListCtrl to Clipboard Pin
Ammar5-Nov-00 23:59
Ammar5-Nov-00 23:59 

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.