Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Libraries and TheIDE: i18n, Unicode and Internationalization » about the using of unicode in win32 platform
about the using of unicode in win32 platform [message #39016] Thu, 07 February 2013 05:40 Go to next message
LeiMing is currently offline  LeiMing
Messages: 16
Registered: September 2009
Location: China
Promising Member

today I'm thinking about how to deal with commandline parameter,
and finding that ultimate++ currently using WinMain with LPSTR lpCmdLine parameter.

I think it's better to using unicode via wWinMain with LPWSTR lpCmdLine parameter. I change the macro a little, becoming

C:\upp\uppsrc\CtrlCore\Win32GuiA.h
#define GUI_APP_MAIN \
void GuiMainFn_();\
\
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int nCmdShow) \
{ \
	UPP::Ctrl::InitWin32(hInstance); \
	UPP::coreCmdLine__() = UPP::SplitCmdLine__(UPP::ToUtf8(lpCmdLine)); \
	UPP::AppInitEnvironment__(); \
	UPP::AppExecute__(GuiMainFn_); \
	UPP::Ctrl::CloseTopCtrls(); \
	UPP::Ctrl::ExitWin32(); \
	UPP::AppExit__(); \
	return UPP::GetExitCode(); \
} \
\
void GuiMainFn_()


It works fine for me.
Do you consider about this? I think it's a improvement in internalization.

by the way, is there any official way to get access to argument of execute commandline? I don't know if coreCmdLine__ is the interface for library user.

regards,
LeiMing

[Updated on: Thu, 07 February 2013 05:45]

Report message to a moderator

Re: about the using of unicode in win32 platform [message #39017 is a reply to message #39016] Thu, 07 February 2013 07:09 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1778
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

LeiMing wrote on Thu, 07 February 2013 05:40

by the way, is there any official way to get access to argument of execute commandline? I don't know if coreCmdLine__ is the interface for library user.

There is CommandLine() function, which returns Vector containing the command line arguments, stripped of the zeroth argument (the executable name, which has its own method GetExeTitle()). Also this method is aware of charset, so probably the utf8 should be handled in there rather than in wWinMain.

Best regards,
Honza
Re: about the using of unicode in win32 platform [message #39073 is a reply to message #39017] Tue, 12 February 2013 16:40 Go to previous messageGo to next message
LeiMing is currently offline  LeiMing
Messages: 16
Registered: September 2009
Location: China
Promising Member

since windows has the function CreateProcessW, it's necessary to handle parameters in unicode: WinMain has commandline encoded in local charset, which may not be able to present some chars: they can be out of current charset. While wWinMain can properly handle the situation: the parameters are stored in wchar_t[].
Re: about the using of unicode in win32 platform [message #39075 is a reply to message #39073] Tue, 12 February 2013 18:05 Go to previous message
mirek is currently offline  mirek
Messages: 12841
Registered: November 2005
Ultimate Member
LeiMing wrote on Tue, 12 February 2013 10:40

since windows has the function CreateProcessW, it's necessary to handle parameters in unicode: WinMain has commandline encoded in local charset, which may not be able to present some chars: they can be out of current charset. While wWinMain can properly handle the situation: the parameters are stored in wchar_t[].


Well, I would say it is about time to finally drop last bits of Win98 support Wink

Mirek
Previous Topic: compiler's output message of vc10free Chinese edition
Next Topic: 'Upp::Value::Value' : ambiguous call to overloaded function,why?
Goto Forum:
  


Current Time: Thu Oct 29 03:21:25 CET 2020

Total time taken to generate the page: 0.01172 seconds