Click here to Skip to main content
15,912,329 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to Convert CString to TChAR Pin
David Crow1-May-08 10:27
David Crow1-May-08 10:27 
AnswerRe: How to Convert CString to TChAR Pin
Randor 1-May-08 16:57
professional Randor 1-May-08 16:57 
AnswerRe: How to Convert CString to TChAR Pin
Rajkumar R1-May-08 20:30
Rajkumar R1-May-08 20:30 
Questionvs2008 problem, about F1 and type mismatch Pin
followait1-May-08 8:44
followait1-May-08 8:44 
Questionhow can i do this with C++ Pin
reteset1-May-08 4:22
reteset1-May-08 4:22 
AnswerRe: how can i do this with C++ Pin
led mike1-May-08 6:21
led mike1-May-08 6:21 
AnswerRe: how can i do this with C++ Pin
Maximilien1-May-08 7:03
Maximilien1-May-08 7:03 
AnswerRe: how can i do this with C++ [modified] PinPopular
Rajkumar R1-May-08 7:10
Rajkumar R1-May-08 7:10 
reteset wrote:
i am a new bie

hope the following gives a start, assuming you are not c/c++ newbie but the shell interface newbie,

C++ example for the example[^],

#include <shlobj.h>
#include <shlwapi.h>
#include <stdio.h>
#include <tchar.h>

#pragma comment (lib, "shlwapi.lib")

#define SAFE_RELEASE(_x) if (_x){_x->Release(); _x = NULL;}

int main()
{
	LPMALLOC        pMalloc			= NULL;
	IShellFolder	*psfShell		= NULL;
	IShellFolder2	*psfWindowsFolder	= NULL;
	LPITEMIDLIST	pidlWindowsFolder	= NULL;
	LPITEMIDLIST	pidlFile		= NULL;
	TCHAR		szDisplayName[MAX_PATH];
	SHELLDETAILS	shDetails;

	HRESULT hr = E_FAIL;

	hr = SHGetMalloc(&pMalloc);
	if(FAILED(hr))
		goto END;

	hr = SHGetDesktopFolder(&psfShell);
	if(FAILED(hr))
		goto END;

	hr = SHGetFolderLocation(NULL, CSIDL_WINDOWS, NULL, NULL, 
		&pidlWindowsFolder);
	if(FAILED(hr))
		goto END;

	hr = psfShell->BindToObject(pidlWindowsFolder, NULL, 
		IID_IShellFolder2, (VOID **)&psfWindowsFolder);
	if(FAILED(hr))
		goto END;

	hr = psfWindowsFolder->ParseDisplayName(NULL,
		NULL,
		_T("clock.avi"),
		NULL,  // This can be NULL
		&pidlFile,
		NULL);
	if(FAILED(hr))
		goto END;

	hr = psfWindowsFolder->GetDetailsOf(pidlFile, 2, &shDetails);
	if(FAILED(hr))
		goto END;
	
	hr = StrRetToBuf(&shDetails.str, pidlFile, szDisplayName, sizeof(szDisplayName));
	if(FAILED(hr))
		goto END;

	_tprintf(_T("Details at Column 2 : %s \n"), szDisplayName);

END:
	
	if (pMalloc)
	{
		if (pidlFile) pMalloc->Free(pidlFile);
		if (pidlWindowsFolder) pMalloc->Free(pidlWindowsFolder);
	}
	SAFE_RELEASE(psfWindowsFolder);
	SAFE_RELEASE(psfShell);
	SAFE_RELEASE(pMalloc);

	return 0;
}


modified on Friday, May 2, 2008 1:31 AM

GeneralRe: how can i do this with C++ Pin
Randor 1-May-08 9:14
professional Randor 1-May-08 9:14 
GeneralRe: how can i do this with C++ Pin
Maximilien1-May-08 9:24
Maximilien1-May-08 9:24 
GeneralRe: how can i do this with C++ Pin
JudyL_MD1-May-08 10:27
JudyL_MD1-May-08 10:27 
GeneralRe: how can i do this with C++ Pin
Maximilien1-May-08 10:47
Maximilien1-May-08 10:47 
GeneralRe: how can i do this with C++ Pin
Rajesh R Subramanian1-May-08 18:49
professionalRajesh R Subramanian1-May-08 18:49 
GeneralRe: how can i do this with C++ Pin
JudyL_MD2-May-08 2:12
JudyL_MD2-May-08 2:12 
GeneralRe: how can i do this with C++ Pin
Rajesh R Subramanian1-May-08 19:19
professionalRajesh R Subramanian1-May-08 19:19 
QuestionRe: how can i do this with C++ Pin
Rajkumar R1-May-08 19:28
Rajkumar R1-May-08 19:28 
GeneralRe: how can i do this with C++ Pin
Rajesh R Subramanian1-May-08 19:29
professionalRajesh R Subramanian1-May-08 19:29 
GeneralRe: how can i do this with C++ [modified] Pin
Rajkumar R1-May-08 19:24
Rajkumar R1-May-08 19:24 
GeneralRe: how can i do this with C++ Pin
Randor 2-May-08 5:36
professional Randor 2-May-08 5:36 
GeneralRe: how can i do this with C++ Pin
Daniel Grunwald19-May-08 0:41
Daniel Grunwald19-May-08 0:41 
GeneralRe: how can i do this with C++ Pin
reteset2-May-08 5:14
reteset2-May-08 5:14 
QuestionHow to find tab order dynamically. Pin
Abhijit A1-May-08 0:29
Abhijit A1-May-08 0:29 
AnswerRe: How to find tab order dynamically. Pin
Rajkumar R1-May-08 1:27
Rajkumar R1-May-08 1:27 
AnswerRe: How to find tab order dynamically. Pin
Blake Miller1-May-08 12:01
Blake Miller1-May-08 12:01 
QuestionHow can I know if a 3rd party unmanaged (e.g. cpp )dll is in debug or release ? Pin
Berlus30-Apr-08 23:38
Berlus30-Apr-08 23:38 

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.