Add wxMSW_CONV_LPCTSTR() and related macros and use them in wxBase.

Add macros hiding the ugly casts needed to pass wxStrings to Windows API
functions and use them in a couple of places in wxBase to simplify the code.

Closes #14338.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71636 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-06-01 22:34:13 +00:00
parent 784130d290
commit 125afca0c0
4 changed files with 21 additions and 9 deletions

View File

@@ -857,14 +857,11 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler,
// WinCE requires appname to be non null
// Win32 allows for null
#ifdef __WXWINCE__
static_cast<const TCHAR *>(
moduleName.t_str()),// application name
const_cast<TCHAR *>(static_cast<const TCHAR *>(
arguments.t_str())), // arguments
moduleName.t_str(), // application name
wxMSW_CONV_LPTSTR(arguments), // arguments
#else
NULL, // application name (use only cmd line)
const_cast<TCHAR *>(static_cast<const TCHAR *>(
command.t_str())), // full command line
wxMSW_CONV_LPTSTR(command), // full command line
#endif
NULL, // security attributes: defaults for both
NULL, // the process and its main thread
@@ -872,7 +869,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler,
dwFlags, // process creation flags
envBuffer.data(), // environment (may be NULL which is fine)
useCwd // initial working directory
? const_cast<TCHAR *>(static_cast<const TCHAR *>(env->cwd.t_str()))
? wxMSW_CONV_LPTSTR(env->cwd)
: NULL, // (or use the same)
&si, // startup info (unused here)
&pi // process info