Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A2W conversion

Status
Not open for further replies.

mmfried

Programmer
Sep 17, 2003
33
IL
Hi All,
I need to convert a paths name to a "ITEMIDLIST",
The paths name is a char[MAX_PATH} type,

I use "pShellFolder->ParseDisplayName "
to convert to "ITEMIDLIST"

but the problem is that is uses a LPWSTR (=unsigned short *) as the paths name,

I found that their a A2W macro to convert for LPSTR to LPWSTR, but it's not recognized,
Any other ideas?

Thanks

mmfried
 
why don't you use L"ITEMIDLIST" ?

Ion Filipski
1c.bmp
 
I want to set a starting directory in SHBrowseForFolder, any other ideas?
 
>but it's not recognized

Then youre not using it properly.
You do have a USES_CONVERSION in your code, right?

/Per
[sub]
"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."[/sub]
 
>I want to set a starting directory in SHBrowseForFolder, >any other ideas?

Yes, use function SetCurrentDirectory

Ion Filipski
1c.bmp
 
>Yes, use function SetCurrentDirectory

Please don't make wild guesses. SHBrowseForFolder doesn't care at all about the current directory.

>I want to set a starting directory in SHBrowseForFolder

To have SHBrowseForFolder initially select a certain folder you have to use the callback mechanism supported by the BROWSEINFO structure.

You let the callback catch the BFFM_INITIALIZED message, and then send the BFFM_SETSELECTION message back to the SHBrowseForFolder dialog. When you send the message your set
the wParam to TRUE, that means the lParam should be a pointer to the unicode string holding the path.

See


/Per
[sub]
"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."[/sub]
 
Thanks

IonFilipski, "SetCurrentDirectory " changes the current dir., but "SHBrowseForFolder" doesn't open it as first dir.

PerFnurt, the compiler doen't recognize the "USES_CONVERSION", I've alredy tried that
 
>the compiler doen't recognize the "USES_CONVERSION",

#include "AFXPRIV.H"

/Per
[sub]
"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."[/sub]
 
PerFnurt ,

Still not recognized (an 'undeclared identifier' statement)

 
Strange, because afxpriv.h should include afxconv.h (where they really are defined). Try including the afxconv.h directly then....

/Per
[sub]
"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."[/sub]
 
that is atlconv.h, sorry

/Per
[sub]
"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."[/sub]
 
ok...I give up on that one...

/Per
[sub]
"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."[/sub]
 
USES_CONVERSION is defined when UNICODE is defined (pretty sure this is why you cant see it). You will need to look into the funciton MultiByteToWideChar to get the wide string.

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top