Prev: Finding Memory Leaks
Next: How to [transparently] render html over existing background using IWebBrowser2?
From: Hector Santos on 26 Apr 2010 20:42 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 26 Apr 2010 20:54 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 27 Apr 2010 00:59 Thanks ...
From: hellokareem on 27 Apr 2010 10:34 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 27 Apr 2010 21:51 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.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Finding Memory Leaks Next: How to [transparently] render html over existing background using IWebBrowser2? |