From: Hector Santos on
L"Here's a thought - Why need it at all? :)"

Tom Serface wrote:

> I use the L"" version all the time now since I never want to go back to
> ANSI and it is much easier to type. I wish there was a compile switch
> that just assumed all strings were Unicode unless specified to be ANSI.
> I know... it would break someone's program :o)


>
> Tom
>
> "Giovanni Dicanio" <giovanniDOTdicanio(a)REMOVEMEgmail.com> wrote in
> message news:OoWrdKV5KHA.1888(a)TK2MSFTNGP05.phx.gbl...
>> "Mikel" <mikel.luri(a)gmail.com> wrote:
>>
>>>> CString file=L"/select,";
>>>> file= file + _mFilePath
>>>> ShellExecute(NULL,L"open",L"explorer",file,NULL,SW_SHOWNORMAL);
>> [...]
>>> However, I would like to point out one thing about your code: if you
>>> are using CString and ShellExecute, and not CStringW and
>>> ShellExecuteW, you should type _T("open") and not L"open". Otherwise,
>>> you are passing Unicode strings to generic-text functions, which is
>>> working now because you have defined UNICODE and _UNICODE, but is not
>>> right, and can lead to problems.
>>
>> I think in these days is just fine to use Unicode-only string literals
>> (i.e. those with L"..." decoration) instead of generic text (i.e.
>> _T("...")), without specifying the 'W' suffix.
>> I mean, I think that:
>>
>> ShellExecute(..., L"open", L"explorer", ...)
>>
>> is just fine, and I don't like uglifying the code with ShellExecuteW...
>>
>> I agree with what you wrote only if you have to maintain *both* ANSI
>> and Unicode builds.
>> (Note also that modern Win32 APIs tend to be Unicode only.)
>>
>> My 2 cents,
>> Giovanni
>>
>>



--
HLS
From: Tom Serface on
Yes. I brought that up a few times since C# "only" does Unicode except for
reading and writing files, but apparently it's too ingrained in legacy C++
code. So I suggested a switch, like we have for so many other things. I'm
sure it would break a lot of MFC classes though, so I'm not holding out any
hope.

Tom

"Hector Santos" <sant9442(a)nospam.gmail.com> wrote in message
news:O404NKa5KHA.1424(a)TK2MSFTNGP04.phx.gbl...
> L"Here's a thought - Why need it at all? :)"
>
> Tom Serface wrote:
>
>> I use the L"" version all the time now since I never want to go back to
>> ANSI and it is much easier to type. I wish there was a compile switch
>> that just assumed all strings were Unicode unless specified to be ANSI.
>> I know... it would break someone's program :o)
>
>
>>
>> Tom
>>
>> "Giovanni Dicanio" <giovanniDOTdicanio(a)REMOVEMEgmail.com> wrote in
>> message news:OoWrdKV5KHA.1888(a)TK2MSFTNGP05.phx.gbl...
>>> "Mikel" <mikel.luri(a)gmail.com> wrote:
>>>
>>>>> CString file=L"/select,";
>>>>> file= file + _mFilePath
>>>>> ShellExecute(NULL,L"open",L"explorer",file,NULL,SW_SHOWNORMAL);
>>> [...]
>>>> However, I would like to point out one thing about your code: if you
>>>> are using CString and ShellExecute, and not CStringW and
>>>> ShellExecuteW, you should type _T("open") and not L"open". Otherwise,
>>>> you are passing Unicode strings to generic-text functions, which is
>>>> working now because you have defined UNICODE and _UNICODE, but is not
>>>> right, and can lead to problems.
>>>
>>> I think in these days is just fine to use Unicode-only string literals
>>> (i.e. those with L"..." decoration) instead of generic text (i.e.
>>> _T("...")), without specifying the 'W' suffix.
>>> I mean, I think that:
>>>
>>> ShellExecute(..., L"open", L"explorer", ...)
>>>
>>> is just fine, and I don't like uglifying the code with ShellExecuteW...
>>>
>>> I agree with what you wrote only if you have to maintain *both* ANSI and
>>> Unicode builds.
>>> (Note also that modern Win32 APIs tend to be Unicode only.)
>>>
>>> My 2 cents,
>>> Giovanni
>>>
>>>
>
>
>
> --
> HLS

From: hellokareem on
Thanks ...
From: hellokareem on
any alternative?how it is possible through CFileDialog ?my
requirement like this, if user rendered out a movie file through my
app, folder should open and select that movie file.
From: Tom Serface on
OK, I'm confused then... apologies. In that case why not just use
ShellExecuteEx to open the file directly without using Explorer at all.
Then the registered app will just be run for the file type.

if ((int)ShellExecute(NULL, _T("open"), szFile, NULL, NULL, SW_SHOWNORMAL) >
32)


Tom

"hellokareem" <kareem.tk(a)gmail.com> wrote in message
news:30830364-4987-461d-8ed3-78757926fdaa(a)i37g2000yqn.googlegroups.com...
> any alternative?how it is possible through CFileDialog ?my
> requirement like this, if user rendered out a movie file through my
> app, folder should open and select that movie file.