Use wxString::t_str() in calls to Windows API functions in wxMSW.

Use t_str() instead of wx_str() to make the code work correctly in UTF-8 build
in which wx_str() returns a pointer to UTF-8 buffer while we need a wchar_t
pointer for Windows.

Closes #14371.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71640 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-06-03 19:16:59 +00:00
parent f40f8e1722
commit 017dc06b50
58 changed files with 164 additions and 164 deletions

View File

@@ -587,7 +587,7 @@ MSW:
- Fix handling of composite windows in wxToolTip (Armel Asselin). - Fix handling of composite windows in wxToolTip (Armel Asselin).
- Add VT_I8 support to wxAutomationObject (PB). - Add VT_I8 support to wxAutomationObject (PB).
- Fix wxListbook size calculations to avoid spurious scrollbars. - Fix wxListbook size calculations to avoid spurious scrollbars.
- Fix non-GUI code compilation with wxUSE_UNICODE_UTF8 (Kolya Kosenko). - Fix code compilation with wxUSE_UNICODE_UTF8 (Kolya Kosenko).
OSX: OSX:

View File

@@ -63,7 +63,7 @@ protected:
// the first 2 HtmlHelp() parameters // the first 2 HtmlHelp() parameters
bool CallHtmlHelp(unsigned cmd, WXWPARAM param) bool CallHtmlHelp(unsigned cmd, WXWPARAM param)
{ {
return CallHtmlHelp(GetParentWindow(), GetValidFilename().wx_str(), return CallHtmlHelp(GetParentWindow(), GetValidFilename().t_str(),
cmd, param); cmd, param);
} }

View File

@@ -796,7 +796,7 @@ public:
{ {
if ( IsRegistered() ) if ( IsRegistered() )
{ {
if ( !::UnregisterClass(m_clsname.wx_str(), wxGetInstance()) ) if ( !::UnregisterClass(m_clsname.t_str(), wxGetInstance()) )
{ {
wxLogLastError(wxT("UnregisterClass")); wxLogLastError(wxT("UnregisterClass"));
} }

View File

@@ -89,7 +89,7 @@ wxAcceleratorTable::wxAcceleratorTable(const wxString& resource)
{ {
m_refData = new wxAcceleratorRefData; m_refData = new wxAcceleratorRefData;
HACCEL hAccel = ::LoadAccelerators(wxGetInstance(), resource.wx_str()); HACCEL hAccel = ::LoadAccelerators(wxGetInstance(), resource.t_str());
M_ACCELDATA->m_hAccel = hAccel; M_ACCELDATA->m_hAccel = hAccel;
M_ACCELDATA->m_ok = hAccel != 0; M_ACCELDATA->m_ok = hAccel != 0;
} }

View File

@@ -813,7 +813,7 @@ void DrawButtonText(HDC hdc,
// first we need to compute its bounding rect // first we need to compute its bounding rect
RECT rc; RECT rc;
::CopyRect(&rc, pRect); ::CopyRect(&rc, pRect);
::DrawText(hdc, text.wx_str(), text.length(), &rc, ::DrawText(hdc, text.t_str(), text.length(), &rc,
DT_CENTER | DT_CALCRECT); DT_CENTER | DT_CALCRECT);
// now center this rect inside the entire button area // now center this rect inside the entire button area
@@ -824,7 +824,7 @@ void DrawButtonText(HDC hdc,
rc.top = pRect->top + (pRect->bottom - pRect->top)/2 - h/2; rc.top = pRect->top + (pRect->bottom - pRect->top)/2 - h/2;
rc.bottom = rc.top+h; rc.bottom = rc.top+h;
::DrawText(hdc, text.wx_str(), text.length(), &rc, flags); ::DrawText(hdc, text.t_str(), text.length(), &rc, flags);
} }
else // single line label else // single line label
{ {
@@ -851,7 +851,7 @@ void DrawButtonText(HDC hdc,
// notice that we must have DT_SINGLELINE for vertical alignment flags // notice that we must have DT_SINGLELINE for vertical alignment flags
// to work // to work
::DrawText(hdc, text.wx_str(), text.length(), pRect, ::DrawText(hdc, text.t_str(), text.length(), pRect,
flags | DT_SINGLELINE ); flags | DT_SINGLELINE );
} }
} }

View File

@@ -557,7 +557,7 @@ bool wxConsoleStderr::Write(const wxString& text)
return false; return false;
} }
if ( !::WriteConsole(m_hStderr, text.wx_str(), text.length(), &ret, NULL) ) if ( !::WriteConsole(m_hStderr, text.t_str(), text.length(), &ret, NULL) )
{ {
wxLogLastError(wxT("WriteConsole")); wxLogLastError(wxT("WriteConsole"));
return false; return false;
@@ -692,7 +692,7 @@ const wxChar *wxApp::GetRegisteredClassName(const wxChar *name,
ClassRegInfo regClass(name); ClassRegInfo regClass(name);
wndclass.lpszClassName = regClass.regname.wx_str(); wndclass.lpszClassName = regClass.regname.t_str();
if ( !::RegisterClass(&wndclass) ) if ( !::RegisterClass(&wndclass) )
{ {
wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"), wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"),
@@ -701,7 +701,7 @@ const wxChar *wxApp::GetRegisteredClassName(const wxChar *name,
} }
wndclass.style &= ~(CS_HREDRAW | CS_VREDRAW); wndclass.style &= ~(CS_HREDRAW | CS_VREDRAW);
wndclass.lpszClassName = regClass.regnameNR.wx_str(); wndclass.lpszClassName = regClass.regnameNR.t_str();
if ( !::RegisterClass(&wndclass) ) if ( !::RegisterClass(&wndclass) )
{ {
wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"), wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"),
@@ -716,7 +716,7 @@ const wxChar *wxApp::GetRegisteredClassName(const wxChar *name,
// function returns (it could be invalidated later if new elements are // function returns (it could be invalidated later if new elements are
// added to the vector and it's reallocated but this shouldn't matter as // added to the vector and it's reallocated but this shouldn't matter as
// this pointer should be used right now, not stored) // this pointer should be used right now, not stored)
return gs_regClassesInfo.back().regname.wx_str(); return gs_regClassesInfo.back().regname.t_str();
} }
bool wxApp::IsRegisteredClassName(const wxString& name) bool wxApp::IsRegisteredClassName(const wxString& name)

View File

@@ -109,7 +109,7 @@ wxCalendarCtrl::Create(wxWindow *parent,
} }
const wxChar * const clsname = s_clsMonthCal.IsRegistered() const wxChar * const clsname = s_clsMonthCal.IsRegistered()
? s_clsMonthCal.GetName().wx_str() ? s_clsMonthCal.GetName().t_str()
: MONTHCAL_CLASS; : MONTHCAL_CLASS;
if ( !MSWCreateControl(clsname, wxEmptyString, pos, size) ) if ( !MSWCreateControl(clsname, wxEmptyString, pos, size) )

View File

@@ -447,7 +447,7 @@ bool wxCheckBox::MSWOnDraw(WXDRAWITEMSTRUCT *item)
// around it // around it
if ( isFocused ) if ( isFocused )
{ {
if ( !::DrawText(hdc, label.wx_str(), label.length(), &rectLabel, if ( !::DrawText(hdc, label.t_str(), label.length(), &rectLabel,
fmt | DT_CALCRECT) ) fmt | DT_CALCRECT) )
{ {
wxLogLastError(wxT("DrawText(DT_CALCRECT)")); wxLogLastError(wxT("DrawText(DT_CALCRECT)"));
@@ -459,7 +459,7 @@ bool wxCheckBox::MSWOnDraw(WXDRAWITEMSTRUCT *item)
::SetTextColor(hdc, ::GetSysColor(COLOR_GRAYTEXT)); ::SetTextColor(hdc, ::GetSysColor(COLOR_GRAYTEXT));
} }
if ( !::DrawText(hdc, label.wx_str(), label.length(), &rectLabel, fmt) ) if ( !::DrawText(hdc, label.t_str(), label.length(), &rectLabel, fmt) )
{ {
wxLogLastError(wxT("DrawText()")); wxLogLastError(wxT("DrawText()"));
} }

View File

@@ -333,7 +333,7 @@ int wxChoice::FindString(const wxString& s, bool bCase) const
else else
{ {
int pos = (int)SendMessage(GetHwnd(), CB_FINDSTRINGEXACT, int pos = (int)SendMessage(GetHwnd(), CB_FINDSTRINGEXACT,
(WPARAM)-1, (LPARAM)s.wx_str()); (WPARAM)-1, wxMSW_CONV_LPARAM(s));
return pos == LB_ERR ? wxNOT_FOUND : pos; return pos == LB_ERR ? wxNOT_FOUND : pos;
} }
@@ -360,7 +360,7 @@ void wxChoice::SetString(unsigned int n, const wxString& s)
const bool wasSelected = static_cast<int>(n) == GetSelection(); const bool wasSelected = static_cast<int>(n) == GetSelection();
::SendMessage(GetHwnd(), CB_DELETESTRING, n, 0); ::SendMessage(GetHwnd(), CB_DELETESTRING, n, 0);
::SendMessage(GetHwnd(), CB_INSERTSTRING, n, (LPARAM)s.wx_str() ); ::SendMessage(GetHwnd(), CB_INSERTSTRING, n, wxMSW_CONV_LPARAM(s) );
// restore the client data // restore the client data
if ( oldData ) if ( oldData )

View File

@@ -79,7 +79,7 @@ wxColourDialogHookProc(HWND hwnd,
const wxString title = dialog->GetTitle(); const wxString title = dialog->GetTitle();
if ( !title.empty() ) if ( !title.empty() )
::SetWindowText(hwnd, title.wx_str()); ::SetWindowText(hwnd, title.t_str());
dialog->MSWOnInitDone((WXHWND)hwnd); dialog->MSWOnInitDone((WXHWND)hwnd);
} }

View File

@@ -308,7 +308,7 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD id)
// this string is going to become the new combobox value soon but // this string is going to become the new combobox value soon but
// we need it to be done right now, otherwise the event handler // we need it to be done right now, otherwise the event handler
// could get a wrong value when it calls our GetValue() // could get a wrong value when it calls our GetValue()
::SetWindowText(GetHwnd(), value.wx_str()); ::SetWindowText(GetHwnd(), value.t_str());
{ {
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, GetId()); wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, GetId());

View File

@@ -92,7 +92,7 @@ wxCommandLinkButton::SetMainLabelAndNote(const wxString& mainLabel,
if ( HasNativeCommandLinkButton() ) if ( HasNativeCommandLinkButton() )
{ {
wxButton::SetLabel(mainLabel); wxButton::SetLabel(mainLabel);
::SendMessage(m_hWnd, BCM_SETNOTE, 0, (LPARAM) note.wx_str()); ::SendMessage(m_hWnd, BCM_SETNOTE, 0, wxMSW_CONV_LPARAM(note));
// Preserve the user-specified label for GetLabel() // Preserve the user-specified label for GetLabel()
m_labelOrig = mainLabel; m_labelOrig = mainLabel;

View File

@@ -132,7 +132,7 @@ bool wxControl::MSWCreateControl(const wxChar *classname,
( (
exstyle, // extended style exstyle, // extended style
classname, // the kind of control to create classname, // the kind of control to create
label.wx_str(), // the window name label.t_str(), // the window name
style, // the window style style, // the window style
x, y, w, h, // the window position and size x, y, w, h, // the window position and size
GetHwndOf(GetParent()), // parent GetHwndOf(GetParent()), // parent
@@ -163,7 +163,7 @@ bool wxControl::MSWCreateControl(const wxChar *classname,
// Notice that 0xffff is not a valid Unicode character so the problem // Notice that 0xffff is not a valid Unicode character so the problem
// doesn't arise in Unicode build. // doesn't arise in Unicode build.
if ( !label.empty() && label[0] == -1 ) if ( !label.empty() && label[0] == -1 )
::SetWindowText(GetHwnd(), label.wx_str()); ::SetWindowText(GetHwnd(), label.t_str());
#endif // !wxUSE_UNICODE #endif // !wxUSE_UNICODE
// saving the label in m_labelOrig to return it verbatim // saving the label in m_labelOrig to return it verbatim
@@ -453,7 +453,7 @@ int wxControlWithItems::MSWInsertOrAppendItem(unsigned pos,
unsigned wm) unsigned wm)
{ {
LRESULT n = SendMessage((HWND)MSWGetItemsHWND(), wm, pos, LRESULT n = SendMessage((HWND)MSWGetItemsHWND(), wm, pos,
(LPARAM)item.wx_str()); wxMSW_CONV_LPARAM(item));
if ( n == CB_ERR || n == CB_ERRSPACE ) if ( n == CB_ERR || n == CB_ERRSPACE )
{ {
wxLogLastError(wxT("SendMessage(XX_ADD/INSERTSTRING)")); wxLogLastError(wxT("SendMessage(XX_ADD/INSERTSTRING)"));

View File

@@ -1871,7 +1871,7 @@ void wxMSWDCImpl::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y
SIZE sizeRect; SIZE sizeRect;
const size_t len = string.length(); const size_t len = string.length();
if ( !::GetTextExtentPoint32(GetHdc(), string.wx_str(), len, &sizeRect) ) if ( !::GetTextExtentPoint32(GetHdc(), string.t_str(), len, &sizeRect) )
{ {
wxLogLastError(wxT("GetTextExtentPoint32()")); wxLogLastError(wxT("GetTextExtentPoint32()"));
} }

View File

@@ -118,8 +118,8 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name,
{ {
if ( !driver_name.empty() && !device_name.empty() && !file.empty() ) if ( !driver_name.empty() && !device_name.empty() && !file.empty() )
{ {
m_hDC = (WXHDC) CreateDC(driver_name.wx_str(), m_hDC = (WXHDC) CreateDC(driver_name.t_str(),
device_name.wx_str(), device_name.t_str(),
file.fn_str(), file.fn_str(),
NULL); NULL);
} }
@@ -186,14 +186,14 @@ bool wxPrinterDCImpl::StartDoc(const wxString& message)
{ {
DOCINFO docinfo; DOCINFO docinfo;
docinfo.cbSize = sizeof(DOCINFO); docinfo.cbSize = sizeof(DOCINFO);
docinfo.lpszDocName = message.wx_str(); docinfo.lpszDocName = message.t_str();
wxString filename(m_printData.GetFilename()); wxString filename(m_printData.GetFilename());
if (filename.empty()) if (filename.empty())
docinfo.lpszOutput = NULL; docinfo.lpszOutput = NULL;
else else
docinfo.lpszOutput = filename.wx_str(); docinfo.lpszOutput = filename.t_str();
docinfo.lpszDatatype = NULL; docinfo.lpszDatatype = NULL;
docinfo.fwType = 0; docinfo.fwType = 0;
@@ -335,7 +335,7 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
HDC hDC = ::CreateDC HDC hDC = ::CreateDC
( (
NULL, // no driver name as we use device name NULL, // no driver name as we use device name
deviceName.wx_str(), deviceName.t_str(),
NULL, // unused NULL, // unused
static_cast<DEVMODE *>(lockDevMode.Get()) static_cast<DEVMODE *>(lockDevMode.Get())
); );

View File

@@ -263,7 +263,7 @@ int wxDirDialog::ShowSHBrowseForFolder(WXHWND owner)
#endif #endif
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT; bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
bi.lpfn = BrowseCallbackProc; bi.lpfn = BrowseCallbackProc;
bi.lParam = (LPARAM)m_path.wx_str(); // param for the callback bi.lParam = wxMSW_CONV_LPARAM(m_path); // param for the callback
static const int verComCtl32 = wxApp::GetComCtl32Version(); static const int verComCtl32 = wxApp::GetComCtl32Version();
@@ -490,7 +490,7 @@ BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
} }
SendMessage(hwnd, BFFM_SETSTATUSTEXT, SendMessage(hwnd, BFFM_SETSTATUSTEXT,
0, (LPARAM)strDir.wx_str()); 0, wxMSW_CONV_LPARAM(strDir));
} }
} }
break; break;

View File

@@ -431,7 +431,7 @@ bool wxDisplayMSW::ChangeMode(const wxVideoMode& mode)
// do change the mode // do change the mode
switch ( pfnChangeDisplaySettingsEx switch ( pfnChangeDisplaySettingsEx
( (
GetName().wx_str(), // display name GetName().t_str(), // display name
pDevMode, // dev mode or NULL to reset pDevMode, // dev mode or NULL to reset
NULL, // reserved NULL, // reserved
flags, flags,

View File

@@ -59,7 +59,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxEnhMetaFile, wxObject)
// we must pass NULL if the string is empty to metafile functions // we must pass NULL if the string is empty to metafile functions
static inline const wxChar *GetMetaFileName(const wxString& fn) static inline const wxChar *GetMetaFileName(const wxString& fn)
{ return !fn ? (const wxChar *)NULL : (const wxChar*)fn.wx_str(); } { return !fn ? NULL : wxMSW_CONV_LPCTSTR(fn); }
// ============================================================================ // ============================================================================
// implementation // implementation
@@ -291,7 +291,7 @@ void wxEnhMetaFileDCImpl::Create(HDC hdcRef,
} }
m_hDC = (WXHDC)::CreateEnhMetaFile(hdcRef, GetMetaFileName(filename), m_hDC = (WXHDC)::CreateEnhMetaFile(hdcRef, GetMetaFileName(filename),
pRect, description.wx_str()); pRect, description.t_str());
if ( !m_hDC ) if ( !m_hDC )
{ {
wxLogLastError(wxT("CreateEnhMetaFile")); wxLogLastError(wxT("CreateEnhMetaFile"));

View File

@@ -310,7 +310,7 @@ wxFindReplaceDialogHookProc(HWND hwnd,
FINDREPLACE *pFR = (FINDREPLACE *)lParam; FINDREPLACE *pFR = (FINDREPLACE *)lParam;
wxFindReplaceDialog *dialog = (wxFindReplaceDialog *)pFR->lCustData; wxFindReplaceDialog *dialog = (wxFindReplaceDialog *)pFR->lCustData;
::SetWindowText(hwnd, dialog->GetTitle().wx_str()); ::SetWindowText(hwnd, dialog->GetTitle().t_str());
// don't return FALSE from here or the dialog won't be shown // don't return FALSE from here or the dialog won't be shown
return TRUE; return TRUE;

View File

@@ -507,7 +507,7 @@ int wxFileDialog::ShowModal()
of.lStructSize = gs_ofStructSize; of.lStructSize = gs_ofStructSize;
of.hwndOwner = hWnd; of.hwndOwner = hWnd;
of.lpstrTitle = m_message.wx_str(); of.lpstrTitle = m_message.t_str();
of.lpstrFileTitle = titleBuffer; of.lpstrFileTitle = titleBuffer;
of.nMaxFileTitle = wxMAXFILE + 1 + wxMAXEXT; of.nMaxFileTitle = wxMAXFILE + 1 + wxMAXEXT;
@@ -609,7 +609,7 @@ int wxFileDialog::ShowModal()
} }
} }
of.lpstrFilter = (LPTSTR)filterBuffer.wx_str(); of.lpstrFilter = filterBuffer.t_str();
of.nFilterIndex = m_filterIndex + 1; of.nFilterIndex = m_filterIndex + 1;
//=== Setting defaultFileName >>========================================= //=== Setting defaultFileName >>=========================================
@@ -626,7 +626,7 @@ int wxFileDialog::ShowModal()
wxString defextBuffer; // we need it to be alive until GetSaveFileName()! wxString defextBuffer; // we need it to be alive until GetSaveFileName()!
if (HasFdFlag(wxFD_SAVE)) if (HasFdFlag(wxFD_SAVE))
{ {
const wxChar* extension = filterBuffer.wx_str(); const wxChar* extension = filterBuffer.t_str();
int maxFilter = (int)(of.nFilterIndex*2L) - 1; int maxFilter = (int)(of.nFilterIndex*2L) - 1;
for( int i = 0; i < maxFilter; i++ ) // get extension for( int i = 0; i < maxFilter; i++ ) // get extension
@@ -708,7 +708,7 @@ int wxFileDialog::ShowModal()
(of.nFileExtension && fileNameBuffer[of.nFileExtension] == wxT('\0')) ) (of.nFileExtension && fileNameBuffer[of.nFileExtension] == wxT('\0')) )
{ {
// User has typed a filename without an extension: // User has typed a filename without an extension:
const wxChar* extension = filterBuffer.wx_str(); const wxChar* extension = filterBuffer.t_str();
int maxFilter = (int)(of.nFilterIndex*2L) - 1; int maxFilter = (int)(of.nFilterIndex*2L) - 1;
for( int i = 0; i < maxFilter; i++ ) // get extension for( int i = 0; i < maxFilter; i++ ) // get extension

View File

@@ -160,7 +160,7 @@ void wxFontEnumeratorHelper::DoEnumerate()
#ifdef __WXWINCE__ #ifdef __WXWINCE__
::EnumFontFamilies(hDC, ::EnumFontFamilies(hDC,
m_facename.empty() ? NULL : m_facename.wx_str(), m_facename.empty() ? NULL : wxMSW_CONV_LPCTSTR(m_facename),
(wxFONTENUMPROC)wxFontEnumeratorProc, (wxFONTENUMPROC)wxFontEnumeratorProc,
(LPARAM)this) ; (LPARAM)this) ;
#else // __WIN32__ #else // __WIN32__

View File

@@ -323,7 +323,7 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap,
int WXUNUSED(desiredHeight)) int WXUNUSED(desiredHeight))
{ {
// TODO: load colourmap. // TODO: load colourmap.
bitmap->SetHBITMAP((WXHBITMAP)::LoadBitmap(wxGetInstance(), name.wx_str())); bitmap->SetHBITMAP((WXHBITMAP)::LoadBitmap(wxGetInstance(), name.t_str()));
if ( !bitmap->IsOk() ) if ( !bitmap->IsOk() )
{ {
@@ -438,7 +438,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
desiredHeight == ::GetSystemMetrics(SM_CYICON) ) desiredHeight == ::GetSystemMetrics(SM_CYICON) )
{ {
// get the specified large icon from file // get the specified large icon from file
if ( !::ExtractIconEx(nameReal.wx_str(), iconIndex, &hicon, NULL, 1) ) if ( !::ExtractIconEx(nameReal.t_str(), iconIndex, &hicon, NULL, 1) )
{ {
// it is not an error, but it might still be useful to be informed // it is not an error, but it might still be useful to be informed
// about it optionally // about it optionally
@@ -451,7 +451,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
desiredHeight == ::GetSystemMetrics(SM_CYSMICON) ) desiredHeight == ::GetSystemMetrics(SM_CYSMICON) )
{ {
// get the specified small icon from file // get the specified small icon from file
if ( !::ExtractIconEx(nameReal.wx_str(), iconIndex, NULL, &hicon, 1) ) if ( !::ExtractIconEx(nameReal.t_str(), iconIndex, NULL, &hicon, 1) )
{ {
wxLogTrace(wxT("iconload"), wxLogTrace(wxT("iconload"),
wxT("No small icons found in the file '%s'."), wxT("No small icons found in the file '%s'."),
@@ -464,7 +464,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
if ( !hicon ) if ( !hicon )
{ {
// take any size icon from the file by index // take any size icon from the file by index
hicon = ::ExtractIcon(wxGetInstance(), nameReal.wx_str(), iconIndex); hicon = ::ExtractIcon(wxGetInstance(), nameReal.t_str(), iconIndex);
} }
#endif #endif
@@ -518,13 +518,13 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon,
// some icon rescaling internally which results in very ugly 16x16 icons // some icon rescaling internally which results in very ugly 16x16 icons
if ( hasSize ) if ( hasSize )
{ {
hicon = (HICON)::LoadImage(wxGetInstance(), name.wx_str(), IMAGE_ICON, hicon = (HICON)::LoadImage(wxGetInstance(), name.t_str(), IMAGE_ICON,
desiredWidth, desiredHeight, desiredWidth, desiredHeight,
LR_DEFAULTCOLOR); LR_DEFAULTCOLOR);
} }
else else
{ {
hicon = ::LoadIcon(wxGetInstance(), name.wx_str()); hicon = ::LoadIcon(wxGetInstance(), name.t_str());
} }
// next check if it's not a standard icon // next check if it's not a standard icon

View File

@@ -268,7 +268,7 @@ void wxHeaderCtrl::DoInsertItem(const wxHeaderColumn& col, unsigned int idx)
// notice that we need to store the string we use the pointer to until we // notice that we need to store the string we use the pointer to until we
// pass it to the control // pass it to the control
hdi.mask |= HDI_TEXT; hdi.mask |= HDI_TEXT;
wxWxCharBuffer buf = col.GetTitle().wx_str(); wxWxCharBuffer buf = col.GetTitle().t_str();
hdi.pszText = buf.data(); hdi.pszText = buf.data();
hdi.cchTextMax = wxStrlen(buf); hdi.cchTextMax = wxStrlen(buf);

View File

@@ -127,7 +127,7 @@ bool wxCHMHelpController::DisplaySection(const wxString& section)
if ( section.Find(wxT(".htm")) != wxNOT_FOUND ) if ( section.Find(wxT(".htm")) != wxNOT_FOUND )
{ {
// interpret as a file name // interpret as a file name
return CallHtmlHelp(HH_DISPLAY_TOPIC, section.wx_str()); return CallHtmlHelp(HH_DISPLAY_TOPIC, wxMSW_CONV_LPCTSTR(section));
} }
return KeywordSearch(section); return KeywordSearch(section);
@@ -184,7 +184,7 @@ bool wxCHMHelpController::ShowContextHelpPopup(const wxString& text,
const wxPoint& pos, const wxPoint& pos,
wxWindow *window) wxWindow *window)
{ {
return DoDisplayTextPopup(text.wx_str(), pos, 0, window); return DoDisplayTextPopup(text.t_str(), pos, 0, window);
} }
bool wxCHMHelpController::DisplayBlock(long block) bool wxCHMHelpController::DisplayBlock(long block)
@@ -201,7 +201,7 @@ bool wxCHMHelpController::KeywordSearch(const wxString& k,
HH_AKLINK link; HH_AKLINK link;
link.cbStruct = sizeof(HH_AKLINK); link.cbStruct = sizeof(HH_AKLINK);
link.fReserved = FALSE; link.fReserved = FALSE;
link.pszKeywords = k.wx_str(); link.pszKeywords = k.t_str();
link.pszUrl = NULL; link.pszUrl = NULL;
link.pszMsgText = NULL; link.pszMsgText = NULL;
link.pszMsgTitle = NULL; link.pszMsgTitle = NULL;

View File

@@ -63,7 +63,7 @@ bool wxWinHelpController::DisplayContents(void)
wxString str = GetValidFilename(m_helpFile); wxString str = GetValidFilename(m_helpFile);
return (WinHelp(GetSuitableHWND(this), str.wx_str(), HELP_FINDER, 0L) != 0); return (WinHelp(GetSuitableHWND(this), str.t_str(), HELP_FINDER, 0L) != 0);
} }
bool wxWinHelpController::DisplaySection(int section) bool wxWinHelpController::DisplaySection(int section)
@@ -73,7 +73,7 @@ bool wxWinHelpController::DisplaySection(int section)
wxString str = GetValidFilename(m_helpFile); wxString str = GetValidFilename(m_helpFile);
return (WinHelp(GetSuitableHWND(this), str.wx_str(), HELP_CONTEXT, (DWORD)section) != 0); return (WinHelp(GetSuitableHWND(this), str.t_str(), HELP_CONTEXT, (DWORD)section) != 0);
} }
bool wxWinHelpController::DisplayContextPopup(int contextId) bool wxWinHelpController::DisplayContextPopup(int contextId)
@@ -82,7 +82,7 @@ bool wxWinHelpController::DisplayContextPopup(int contextId)
wxString str = GetValidFilename(m_helpFile); wxString str = GetValidFilename(m_helpFile);
return (WinHelp(GetSuitableHWND(this), str.wx_str(), HELP_CONTEXTPOPUP, (DWORD) contextId) != 0); return (WinHelp(GetSuitableHWND(this), str.t_str(), HELP_CONTEXTPOPUP, (DWORD) contextId) != 0);
} }
bool wxWinHelpController::DisplayBlock(long block) bool wxWinHelpController::DisplayBlock(long block)
@@ -98,8 +98,8 @@ bool wxWinHelpController::KeywordSearch(const wxString& k,
wxString str = GetValidFilename(m_helpFile); wxString str = GetValidFilename(m_helpFile);
return WinHelp(GetSuitableHWND(this), str.wx_str(), HELP_PARTIALKEY, return WinHelp(GetSuitableHWND(this), str.t_str(), HELP_PARTIALKEY,
(ULONG_PTR)k.wx_str()) != 0; (ULONG_PTR)wxMSW_CONV_LPCTSTR(k)) != 0;
} }
// Can't close the help window explicitly in WinHelp // Can't close the help window explicitly in WinHelp

View File

@@ -257,13 +257,13 @@ bool wxIniConfig::IsEmpty() const
{ {
wxChar szBuf[1024]; wxChar szBuf[1024];
GetPrivateProfileString(m_strGroup.wx_str(), NULL, wxT(""), GetPrivateProfileString(m_strGroup.t_str(), NULL, wxT(""),
szBuf, WXSIZEOF(szBuf), szBuf, WXSIZEOF(szBuf),
m_strLocalFilename.wx_str()); m_strLocalFilename.t_str());
if ( !wxIsEmpty(szBuf) ) if ( !wxIsEmpty(szBuf) )
return false; return false;
GetProfileString(m_strGroup.wx_str(), NULL, wxT(""), szBuf, WXSIZEOF(szBuf)); GetProfileString(m_strGroup.t_str(), NULL, wxT(""), szBuf, WXSIZEOF(szBuf));
if ( !wxIsEmpty(szBuf) ) if ( !wxIsEmpty(szBuf) )
return false; return false;
@@ -284,13 +284,13 @@ bool wxIniConfig::DoReadString(const wxString& szKey, wxString *pstr) const
// first look in the private INI file // first look in the private INI file
// NB: the lpDefault param to GetPrivateProfileString can't be NULL // NB: the lpDefault param to GetPrivateProfileString can't be NULL
GetPrivateProfileString(m_strGroup.wx_str(), strKey.wx_str(), wxT(""), GetPrivateProfileString(m_strGroup.t_str(), strKey.t_str(), wxT(""),
szBuf, WXSIZEOF(szBuf), szBuf, WXSIZEOF(szBuf),
m_strLocalFilename.wx_str()); m_strLocalFilename.t_str());
if ( wxIsEmpty(szBuf) ) { if ( wxIsEmpty(szBuf) ) {
// now look in win.ini // now look in win.ini
wxString strKey = GetKeyName(path.Name()); wxString strKey = GetKeyName(path.Name());
GetProfileString(m_strGroup.wx_str(), strKey.wx_str(), GetProfileString(m_strGroup.t_str(), strKey.t_str(),
wxT(""), szBuf, WXSIZEOF(szBuf)); wxT(""), szBuf, WXSIZEOF(szBuf));
} }
@@ -311,8 +311,8 @@ bool wxIniConfig::DoReadLong(const wxString& szKey, long *pl) const
static const int nMagic = 17; // 17 is some "rare" number static const int nMagic = 17; // 17 is some "rare" number
static const int nMagic2 = 28; // arbitrary number != nMagic static const int nMagic2 = 28; // arbitrary number != nMagic
long lVal = GetPrivateProfileInt(m_strGroup.wx_str(), strKey.wx_str(), long lVal = GetPrivateProfileInt(m_strGroup.t_str(), strKey.t_str(),
nMagic, m_strLocalFilename.wx_str()); nMagic, m_strLocalFilename.t_str());
if ( lVal != nMagic ) { if ( lVal != nMagic ) {
// the value was read from the file // the value was read from the file
*pl = lVal; *pl = lVal;
@@ -320,8 +320,8 @@ bool wxIniConfig::DoReadLong(const wxString& szKey, long *pl) const
} }
// is it really nMagic? // is it really nMagic?
lVal = GetPrivateProfileInt(m_strGroup.wx_str(), strKey.wx_str(), lVal = GetPrivateProfileInt(m_strGroup.t_str(), strKey.t_str(),
nMagic2, m_strLocalFilename.wx_str()); nMagic2, m_strLocalFilename.t_str());
if ( lVal != nMagic2 ) { if ( lVal != nMagic2 ) {
// the nMagic it returned was indeed read from the file // the nMagic it returned was indeed read from the file
*pl = lVal; *pl = lVal;
@@ -345,9 +345,9 @@ bool wxIniConfig::DoWriteString(const wxString& szKey, const wxString& szValue)
wxConfigPathChanger path(this, szKey); wxConfigPathChanger path(this, szKey);
wxString strKey = GetPrivateKeyName(path.Name()); wxString strKey = GetPrivateKeyName(path.Name());
bool bOk = WritePrivateProfileString(m_strGroup.wx_str(), strKey.wx_str(), bool bOk = WritePrivateProfileString(m_strGroup.t_str(), strKey.t_str(),
szValue.wx_str(), szValue.t_str(),
m_strLocalFilename.wx_str()) != 0; m_strLocalFilename.t_str()) != 0;
if ( !bOk ) if ( !bOk )
{ {
@@ -382,7 +382,7 @@ bool wxIniConfig::Flush(bool /* bCurrentOnly */)
{ {
// this is just the way it works // this is just the way it works
return WritePrivateProfileString(NULL, NULL, NULL, return WritePrivateProfileString(NULL, NULL, NULL,
m_strLocalFilename.wx_str()) != 0; m_strLocalFilename.t_str()) != 0;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -395,16 +395,16 @@ bool wxIniConfig::DeleteEntry(const wxString& szKey, bool bGroupIfEmptyAlso)
wxConfigPathChanger path(this, szKey); wxConfigPathChanger path(this, szKey);
wxString strKey = GetPrivateKeyName(path.Name()); wxString strKey = GetPrivateKeyName(path.Name());
if (WritePrivateProfileString(m_strGroup.wx_str(), strKey.wx_str(), if (WritePrivateProfileString(m_strGroup.t_str(), strKey.t_str(),
NULL, m_strLocalFilename.wx_str()) == 0) NULL, m_strLocalFilename.t_str()) == 0)
return false; return false;
if ( !bGroupIfEmptyAlso || !IsEmpty() ) if ( !bGroupIfEmptyAlso || !IsEmpty() )
return true; return true;
// delete the current group too // delete the current group too
bool bOk = WritePrivateProfileString(m_strGroup.wx_str(), NULL, bool bOk = WritePrivateProfileString(m_strGroup.t_str(), NULL,
NULL, m_strLocalFilename.wx_str()) != 0; NULL, m_strLocalFilename.t_str()) != 0;
if ( !bOk ) if ( !bOk )
{ {
@@ -420,8 +420,8 @@ bool wxIniConfig::DeleteGroup(const wxString& szKey)
// passing NULL as section name to WritePrivateProfileString deletes the // passing NULL as section name to WritePrivateProfileString deletes the
// whole section according to the docs // whole section according to the docs
bool bOk = WritePrivateProfileString(path.Name().wx_str(), NULL, bool bOk = WritePrivateProfileString(path.Name().t_str(), NULL,
NULL, m_strLocalFilename.wx_str()) != 0; NULL, m_strLocalFilename.t_str()) != 0;
if ( !bOk ) if ( !bOk )
{ {
@@ -438,7 +438,7 @@ bool wxIniConfig::DeleteGroup(const wxString& szKey)
bool wxIniConfig::DeleteAll() bool wxIniConfig::DeleteAll()
{ {
// first delete our group in win.ini // first delete our group in win.ini
WriteProfileString(GetVendorName().wx_str(), NULL, NULL); WriteProfileString(GetVendorName().t_str(), NULL, NULL);
// then delete our own ini file // then delete our own ini file
wxChar szBuf[MAX_PATH]; wxChar szBuf[MAX_PATH];

View File

@@ -251,7 +251,7 @@ int wxListBox::FindString(const wxString& s, bool bCase) const
if (bCase) if (bCase)
return wxItemContainerImmutable::FindString( s, bCase ); return wxItemContainerImmutable::FindString( s, bCase );
int pos = ListBox_FindStringExact(GetHwnd(), -1, s.wx_str()); int pos = ListBox_FindStringExact(GetHwnd(), -1, s.t_str());
if (pos == LB_ERR) if (pos == LB_ERR)
return wxNOT_FOUND; return wxNOT_FOUND;
else else
@@ -473,7 +473,7 @@ void wxListBox::SetString(unsigned int n, const wxString& s)
if ( n == (m_noItems - 1) ) if ( n == (m_noItems - 1) )
newN = -1; newN = -1;
ListBox_InsertString(GetHwnd(), newN, s.wx_str()); ListBox_InsertString(GetHwnd(), newN, s.t_str());
// restore the client data // restore the client data
if ( oldData ) if ( oldData )

View File

@@ -1542,7 +1542,7 @@ long wxListCtrl::FindItem(long start, const wxString& str, bool partial)
findInfo.flags = LVFI_STRING; findInfo.flags = LVFI_STRING;
if ( partial ) if ( partial )
findInfo.flags |= LVFI_PARTIAL; findInfo.flags |= LVFI_PARTIAL;
findInfo.psz = str.wx_str(); findInfo.psz = str.t_str();
// ListView_FindItem() excludes the first item from search and to look // ListView_FindItem() excludes the first item from search and to look
// through all the items you need to start from -1 which is unnatural and // through all the items you need to start from -1 which is unnatural and
@@ -3279,7 +3279,7 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl,
else else
{ {
// pszText is not const, hence the cast // pszText is not const, hence the cast
lvItem.pszText = (wxChar *)info.m_text.wx_str(); lvItem.pszText = wxMSW_CONV_LPTSTR(info.m_text);
if ( lvItem.pszText ) if ( lvItem.pszText )
lvItem.cchTextMax = info.m_text.length(); lvItem.cchTextMax = info.m_text.length();
else else
@@ -3300,7 +3300,7 @@ static void wxConvertToMSWListCol(HWND hwndList,
if ( item.m_mask & wxLIST_MASK_TEXT ) if ( item.m_mask & wxLIST_MASK_TEXT )
{ {
lvCol.mask |= LVCF_TEXT; lvCol.mask |= LVCF_TEXT;
lvCol.pszText = (wxChar *)item.m_text.wx_str(); // cast is safe lvCol.pszText = wxMSW_CONV_LPTSTR(item.m_text);
} }
if ( item.m_mask & wxLIST_MASK_FORMAT ) if ( item.m_mask & wxLIST_MASK_FORMAT )

View File

@@ -316,7 +316,7 @@ struct wxMSWCommandLineArguments
argv = new wxChar *[argc + 1]; argv = new wxChar *[argc + 1];
for ( int i = 0; i < argc; i++ ) for ( int i = 0; i < argc; i++ )
{ {
argv[i] = wxStrdup(args[i].wx_str()); argv[i] = wxStrdup(args[i].t_str());
} }
// argv[] must be NULL-terminated // argv[] must be NULL-terminated

View File

@@ -190,7 +190,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
msflags &= ~WS_HSCROLL; msflags &= ~WS_HSCROLL;
if ( !wxWindow::MSWCreate(wxApp::GetRegisteredClassName(wxT("wxMDIFrame")), if ( !wxWindow::MSWCreate(wxApp::GetRegisteredClassName(wxT("wxMDIFrame")),
title.wx_str(), title.t_str(),
pos, size, pos, size,
msflags, msflags,
exflags) ) exflags) )
@@ -795,8 +795,8 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
if ( !(style & wxFULL_REPAINT_ON_RESIZE) ) if ( !(style & wxFULL_REPAINT_ON_RESIZE) )
className += wxApp::GetNoRedrawClassSuffix(); className += wxApp::GetNoRedrawClassSuffix();
mcs.szClass = className.wx_str(); mcs.szClass = className.t_str();
mcs.szTitle = title.wx_str(); mcs.szTitle = title.t_str();
mcs.hOwner = wxGetInstance(); mcs.hOwner = wxGetInstance();
if (x != wxDefaultCoord) if (x != wxDefaultCoord)
mcs.x = x; mcs.x = x;
@@ -1473,7 +1473,7 @@ void MDIInsertWindowMenu(wxWindow *win, WXHMENU hMenu, HMENU menuWin)
inserted = true; inserted = true;
::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING, ::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING,
(UINT_PTR)menuWin, (UINT_PTR)menuWin,
wxString(wxGetTranslation(WINDOW_MENU_LABEL)).wx_str()); wxString(wxGetTranslation(WINDOW_MENU_LABEL)).t_str());
break; break;
} }
} }
@@ -1482,7 +1482,7 @@ void MDIInsertWindowMenu(wxWindow *win, WXHMENU hMenu, HMENU menuWin)
{ {
::AppendMenu(hmenu, MF_POPUP, ::AppendMenu(hmenu, MF_POPUP,
(UINT_PTR)menuWin, (UINT_PTR)menuWin,
wxString(wxGetTranslation(WINDOW_MENU_LABEL)).wx_str()); wxString(wxGetTranslation(WINDOW_MENU_LABEL)).t_str());
} }
} }

View File

@@ -592,7 +592,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
} }
mii.cch = itemText.length(); mii.cch = itemText.length();
mii.dwTypeData = const_cast<wxChar *>(itemText.wx_str()); mii.dwTypeData = wxMSW_CONV_LPTSTR(itemText);
if ( flags & MF_POPUP ) if ( flags & MF_POPUP )
{ {
@@ -715,7 +715,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
itemText = wxMenuItem::GetLabelText(itemText); itemText = wxMenuItem::GetLabelText(itemText);
#endif #endif
pData = (wxChar*)itemText.wx_str(); pData = itemText.t_str();
} }
// item might have already been inserted by InsertMenuItem() above // item might have already been inserted by InsertMenuItem() above
@@ -885,7 +885,7 @@ void wxMenu::SetTitle(const wxString& label)
if ( !label.empty() ) if ( !label.empty() )
{ {
if ( !::InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING, if ( !::InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING,
(UINT_PTR)idMenuTitle, m_title.wx_str()) || (UINT_PTR)idMenuTitle, m_title.t_str()) ||
!::InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) ) !::InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) )
{ {
wxLogLastError(wxT("InsertMenu")); wxLogLastError(wxT("InsertMenu"));
@@ -911,7 +911,7 @@ void wxMenu::SetTitle(const wxString& label)
info.fMask = MIIM_TYPE; info.fMask = MIIM_TYPE;
info.fType = MFT_STRING; info.fType = MFT_STRING;
info.cch = m_title.length(); info.cch = m_title.length();
info.dwTypeData = const_cast<wxChar *>(m_title.wx_str()); info.dwTypeData = wxMSW_CONV_LPTSTR(m_title);
if ( !SetMenuItemInfo(hMenu, 0, TRUE, & info) ) if ( !SetMenuItemInfo(hMenu, 0, TRUE, & info) )
{ {
wxLogLastError(wxT("SetMenuItemInfo")); wxLogLastError(wxT("SetMenuItemInfo"));
@@ -919,7 +919,7 @@ void wxMenu::SetTitle(const wxString& label)
#else #else
if ( !ModifyMenu(hMenu, 0u, if ( !ModifyMenu(hMenu, 0u,
MF_BYPOSITION | MF_STRING, MF_BYPOSITION | MF_STRING,
(UINT_PTR)idMenuTitle, m_title.wx_str()) ) (UINT_PTR)idMenuTitle, m_title.t_str()) )
{ {
wxLogLastError(wxT("ModifyMenu")); wxLogLastError(wxT("ModifyMenu"));
} }
@@ -1127,7 +1127,7 @@ WXHMENU wxMenuBar::Create()
HMENU hPopupMenu = (HMENU) GetMenu(i)->GetHMenu(); HMENU hPopupMenu = (HMENU) GetMenu(i)->GetHMenu();
tbButton.dwData = (DWORD)hPopupMenu; tbButton.dwData = (DWORD)hPopupMenu;
wxString label = wxStripMenuCodes(GetMenuLabel(i)); wxString label = wxStripMenuCodes(GetMenuLabel(i));
tbButton.iString = (int) label.wx_str(); tbButton.iString = (int) wxMSW_CONV_LPCTSTR(label);
tbButton.idCommand = NewControlId(); tbButton.idCommand = NewControlId();
if ( !::SendMessage(hCommandBar, TB_INSERTBUTTON, i, (LPARAM)&tbButton) ) if ( !::SendMessage(hCommandBar, TB_INSERTBUTTON, i, (LPARAM)&tbButton) )
@@ -1156,7 +1156,7 @@ WXHMENU wxMenuBar::Create()
{ {
if ( !::AppendMenu((HMENU)m_hMenu, MF_POPUP | MF_STRING, if ( !::AppendMenu((HMENU)m_hMenu, MF_POPUP | MF_STRING,
(UINT_PTR)(*it)->GetHMenu(), (UINT_PTR)(*it)->GetHMenu(),
(*it)->GetTitle().wx_str()) ) (*it)->GetTitle().t_str()) )
{ {
wxLogLastError(wxT("AppendMenu")); wxLogLastError(wxT("AppendMenu"));
} }
@@ -1265,7 +1265,7 @@ void wxMenuBar::SetMenuLabel(size_t pos, const wxString& label)
info.fMask = MIIM_TYPE; info.fMask = MIIM_TYPE;
info.fType = MFT_STRING; info.fType = MFT_STRING;
info.cch = label.length(); info.cch = label.length();
info.dwTypeData = const_cast<wxChar *>(label.wx_str()); info.dwTypeData = wxMSW_CONV_LPTSTR(label);
if ( !SetMenuItemInfo(GetHmenu(), id, TRUE, &info) ) if ( !SetMenuItemInfo(GetHmenu(), id, TRUE, &info) )
{ {
wxLogLastError(wxT("SetMenuItemInfo")); wxLogLastError(wxT("SetMenuItemInfo"));
@@ -1273,7 +1273,7 @@ void wxMenuBar::SetMenuLabel(size_t pos, const wxString& label)
#else #else
if ( ::ModifyMenu(GetHmenu(), mswpos, MF_BYPOSITION | MF_STRING | flagsOld, if ( ::ModifyMenu(GetHmenu(), mswpos, MF_BYPOSITION | MF_STRING | flagsOld,
id, label.wx_str()) == (int)0xFFFFFFFF ) id, label.t_str()) == (int)0xFFFFFFFF )
{ {
wxLogLastError(wxT("ModifyMenu")); wxLogLastError(wxT("ModifyMenu"));
} }
@@ -1318,7 +1318,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
if ( !::InsertMenu(GetHmenu(), (UINT)mswpos, if ( !::InsertMenu(GetHmenu(), (UINT)mswpos,
MF_BYPOSITION | MF_POPUP | MF_STRING, MF_BYPOSITION | MF_POPUP | MF_STRING,
(UINT_PTR)GetHmenuOf(menu), title.wx_str()) ) (UINT_PTR)GetHmenuOf(menu), title.t_str()) )
{ {
wxLogLastError(wxT("InsertMenu")); wxLogLastError(wxT("InsertMenu"));
} }
@@ -1373,7 +1373,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
HMENU hPopupMenu = (HMENU) menu->GetHMenu() ; HMENU hPopupMenu = (HMENU) menu->GetHMenu() ;
tbButton.dwData = (DWORD)hPopupMenu; tbButton.dwData = (DWORD)hPopupMenu;
wxString label = wxStripMenuCodes(title); wxString label = wxStripMenuCodes(title);
tbButton.iString = (int) label.wx_str(); tbButton.iString = (int) wxMSW_CONV_LPCTSTR(label);
tbButton.idCommand = NewControlId(); tbButton.idCommand = NewControlId();
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton)) if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton))
@@ -1385,7 +1385,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
#else #else
if ( !::InsertMenu(GetHmenu(), mswpos, if ( !::InsertMenu(GetHmenu(), mswpos,
MF_BYPOSITION | MF_POPUP | MF_STRING, MF_BYPOSITION | MF_POPUP | MF_STRING,
(UINT_PTR)GetHmenuOf(menu), title.wx_str()) ) (UINT_PTR)GetHmenuOf(menu), title.t_str()) )
{ {
wxLogLastError(wxT("InsertMenu")); wxLogLastError(wxT("InsertMenu"));
} }
@@ -1434,7 +1434,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
HMENU hPopupMenu = (HMENU) menu->GetHMenu() ; HMENU hPopupMenu = (HMENU) menu->GetHMenu() ;
tbButton.dwData = (DWORD)hPopupMenu; tbButton.dwData = (DWORD)hPopupMenu;
wxString label = wxStripMenuCodes(title); wxString label = wxStripMenuCodes(title);
tbButton.iString = (int) label.wx_str(); tbButton.iString = (int) wxMSW_CONV_LPCTSTR(label);
tbButton.idCommand = NewControlId(); tbButton.idCommand = NewControlId();
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton)) if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton))
@@ -1444,7 +1444,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
} }
#else #else
if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING, if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING,
(UINT_PTR)submenu, title.wx_str()) ) (UINT_PTR)submenu, title.t_str()) )
{ {
wxLogLastError(wxT("AppendMenu")); wxLogLastError(wxT("AppendMenu"));
} }

View File

@@ -715,7 +715,7 @@ void wxMenuItem::SetItemLabel(const wxString& txt)
if ( isLaterThanWin95 ) if ( isLaterThanWin95 )
info.fMask |= MIIM_STRING; info.fMask |= MIIM_STRING;
//else: MIIM_TYPE already specified //else: MIIM_TYPE already specified
info.dwTypeData = (LPTSTR)m_text.wx_str(); info.dwTypeData = wxMSW_CONV_LPTSTR(m_text);
info.cch = m_text.length(); info.cch = m_text.length();
if ( !::SetMenuItemInfo(hMenu, id, FALSE, &info) ) if ( !::SetMenuItemInfo(hMenu, id, FALSE, &info) )
{ {
@@ -975,7 +975,7 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc,
int x = rcText.left; int x = rcText.left;
int y = rcText.top + (rcText.bottom - rcText.top - textSize.cy) / 2; int y = rcText.top + (rcText.bottom - rcText.top - textSize.cy) / 2;
::DrawState(hdc, NULL, NULL, (LPARAM)text.wx_str(), ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(text),
text.length(), x, y, 0, 0, flags); text.length(), x, y, 0, 0, flags);
// ::SetTextAlign(hdc, TA_RIGHT) doesn't work with DSS_DISABLED or DSS_MONO // ::SetTextAlign(hdc, TA_RIGHT) doesn't work with DSS_DISABLED or DSS_MONO
@@ -1005,7 +1005,7 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc,
int y = rcText.top + (rcText.bottom - rcText.top - accelSize.cy) / 2; int y = rcText.top + (rcText.bottom - rcText.top - accelSize.cy) / 2;
::DrawState(hdc, NULL, NULL, (LPARAM)accel.wx_str(), ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(accel),
accel.length(), x, y, 0, 0, flags); accel.length(), x, y, 0, 0, flags);
} }
} }

View File

@@ -205,7 +205,7 @@ wxMetafileDCImpl::wxMetafileDCImpl(wxDC *owner, const wxString& file,
m_maxY = -10000; m_maxY = -10000;
if ( !file.empty() && wxFileExists(file) ) if ( !file.empty() && wxFileExists(file) )
wxRemoveFile(file); wxRemoveFile(file);
m_hDC = (WXHDC) CreateMetaFile(file.empty() ? NULL : file.wx_str()); m_hDC = (WXHDC) CreateMetaFile(file.empty() ? NULL : wxMSW_CONV_LPCTSTR(file));
m_ok = true; m_ok = true;

View File

@@ -271,7 +271,7 @@ void wxMessageDialog::ReplaceStaticWithEdit()
HWND hwndEdit = ::CreateWindow HWND hwndEdit = ::CreateWindow
( (
wxT("EDIT"), wxT("EDIT"),
wxTextBuffer::Translate(text).wx_str(), wxTextBuffer::Translate(text).t_str(),
WS_CHILD | WS_VSCROLL | WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_VISIBLE |
ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL, ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL,
rc.left, rc.top, rc.left, rc.top,
@@ -373,7 +373,7 @@ void wxMessageDialog::AdjustButtonLabels()
if ( widthNeeded > wBtnNew ) if ( widthNeeded > wBtnNew )
wBtnNew = widthNeeded; wBtnNew = widthNeeded;
::SetWindowText(hwndBtn, label.wx_str()); ::SetWindowText(hwndBtn, label.t_str());
} }
if ( wBtnNew <= wBtnOld ) if ( wBtnNew <= wBtnOld )
@@ -584,7 +584,7 @@ int wxMessageDialog::ShowMessageBox()
#endif // wxUSE_MSGBOX_HOOK #endif // wxUSE_MSGBOX_HOOK
// do show the dialog // do show the dialog
int msAns = MessageBox(hWnd, message.wx_str(), m_caption.wx_str(), msStyle); int msAns = MessageBox(hWnd, message.t_str(), m_caption.t_str(), msStyle);
return MSWTranslateReturnCode(msAns); return MSWTranslateReturnCode(msAns);
} }
@@ -696,7 +696,7 @@ void wxMSWTaskDialogConfig::MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc)
TDF_POSITION_RELATIVE_TO_WINDOW | TDF_POSITION_RELATIVE_TO_WINDOW |
TDF_SIZE_TO_CONTENT; TDF_SIZE_TO_CONTENT;
tdc.hInstance = wxGetInstance(); tdc.hInstance = wxGetInstance();
tdc.pszWindowTitle = caption.wx_str(); tdc.pszWindowTitle = caption.t_str();
// use the top level window as parent if none specified // use the top level window as parent if none specified
tdc.hwndParent = parent ? GetHwndOf(parent) : NULL; tdc.hwndParent = parent ? GetHwndOf(parent) : NULL;
@@ -713,12 +713,12 @@ void wxMSWTaskDialogConfig::MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc)
// message in our ctor, see comment there. // message in our ctor, see comment there.
if ( !extendedMessage.empty() ) if ( !extendedMessage.empty() )
{ {
tdc.pszMainInstruction = message.wx_str(); tdc.pszMainInstruction = message.t_str();
tdc.pszContent = extendedMessage.wx_str(); tdc.pszContent = extendedMessage.t_str();
} }
else else
{ {
tdc.pszContent = message.wx_str(); tdc.pszContent = message.t_str();
} }
// set an icon to be used, if possible // set an icon to be used, if possible
@@ -802,7 +802,7 @@ void wxMSWTaskDialogConfig::AddTaskDialogButton(TASKDIALOGCONFIG &tdc,
TASKDIALOG_BUTTON &tdBtn = buttons[tdc.cButtons]; TASKDIALOG_BUTTON &tdBtn = buttons[tdc.cButtons];
tdBtn.nButtonID = btnCustomId; tdBtn.nButtonID = btnCustomId;
tdBtn.pszButtonText = customLabel.wx_str(); tdBtn.pszButtonText = customLabel.t_str();
tdc.cButtons++; tdc.cButtons++;
// We should never have more than 4 buttons currently as this is the // We should never have more than 4 buttons currently as this is the

View File

@@ -412,7 +412,7 @@ bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
TC_ITEM tcItem; TC_ITEM tcItem;
tcItem.mask = TCIF_TEXT; tcItem.mask = TCIF_TEXT;
tcItem.pszText = (wxChar *)strText.wx_str(); tcItem.pszText = wxMSW_CONV_LPTSTR(strText);
if ( !HasFlag(wxNB_MULTILINE) ) if ( !HasFlag(wxNB_MULTILINE) )
return TabCtrl_SetItem(GetHwnd(), nPage, &tcItem) != 0; return TabCtrl_SetItem(GetHwnd(), nPage, &tcItem) != 0;
@@ -686,7 +686,7 @@ bool wxNotebook::InsertPage(size_t nPage,
if ( !strText.empty() ) if ( !strText.empty() )
{ {
tcItem.mask |= TCIF_TEXT; tcItem.mask |= TCIF_TEXT;
tcItem.pszText = const_cast<wxChar *>(strText.wx_str()); tcItem.pszText = wxMSW_CONV_LPTSTR(strText);
} }
// hide the page: unless it is selected, it shouldn't be shown (and if it // hide the page: unless it is selected, it shouldn't be shown (and if it

View File

@@ -154,7 +154,7 @@ private:
void wxDataFormat::SetId(const wxString& format) void wxDataFormat::SetId(const wxString& format)
{ {
m_format = (wxDataFormat::NativeFormat)::RegisterClipboardFormat(format.wx_str()); m_format = (wxDataFormat::NativeFormat)::RegisterClipboardFormat(format.t_str());
if ( !m_format ) if ( !m_format )
{ {
wxLogError(_("Couldn't register clipboard format '%s'."), format); wxLogError(_("Couldn't register clipboard format '%s'."), format);
@@ -1152,7 +1152,7 @@ bool wxFileDataObject::GetDataHere(void *WXUNUSED_IN_WINCE(pData)) const
#endif // wxUSE_UNICODE_MSLU #endif // wxUSE_UNICODE_MSLU
{ {
len = m_filenames[i].length(); len = m_filenames[i].length();
memcpy(pbuf, m_filenames[i].wx_str(), len*sizeOfChar); memcpy(pbuf, m_filenames[i].t_str(), len*sizeOfChar);
} }
pbuf += len*sizeOfChar; pbuf += len*sizeOfChar;

View File

@@ -90,7 +90,7 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc, const wxRect& rc,
int cx = rc.GetWidth() - GetMarginWidth(); int cx = rc.GetWidth() - GetMarginWidth();
int cy = sizeRect.cy; int cy = sizeRect.cy;
::DrawState(hdc, NULL, NULL, (LPARAM)text.wx_str(), ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(text),
text.length(), x, y, cx, cy, flags); text.length(), x, y, cx, cy, flags);
} // reset to default the font, colors and brush } // reset to default the font, colors and brush

View File

@@ -65,7 +65,7 @@ public:
BOOL Open( const wxString& printerName, LPPRINTER_DEFAULTS pDefault=(LPPRINTER_DEFAULTS)NULL ) BOOL Open( const wxString& printerName, LPPRINTER_DEFAULTS pDefault=(LPPRINTER_DEFAULTS)NULL )
{ {
Close(); Close();
return OpenPrinter( (LPTSTR)printerName.wx_str(), &m_hPrinter, pDefault ); return OpenPrinter( wxMSW_CONV_LPTSTR(printerName), &m_hPrinter, pDefault );
} }
BOOL Close() BOOL Close()
@@ -391,7 +391,7 @@ void wxWindowsPrintNativeData::InitializeDevMode(const wxString& printerName, Wi
if (m_devMode) if (m_devMode)
return; return;
LPTSTR szPrinterName = (LPTSTR)printerName.wx_str(); LPTSTR szPrinterName = wxMSW_CONV_LPTSTR(printerName);
// From MSDN: How To Modify Printer Settings with the DocumentProperties() Function // From MSDN: How To Modify Printer Settings with the DocumentProperties() Function
// The purpose of this is to fill the DEVMODE with privdata from printer driver. // The purpose of this is to fill the DEVMODE with privdata from printer driver.
@@ -494,7 +494,7 @@ void wxWindowsPrintNativeData::InitializeDevMode(const wxString& printerName, Wi
bool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data ) bool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data )
{ {
WinPrinter printer; WinPrinter printer;
LPTSTR szPrinterName = (LPTSTR)data.GetPrinterName().wx_str(); LPTSTR szPrinterName = wxMSW_CONV_LPTSTR(data.GetPrinterName());
if (!m_devMode) if (!m_devMode)
InitializeDevMode(data.GetPrinterName(), &printer); InitializeDevMode(data.GetPrinterName(), &printer);
@@ -524,7 +524,7 @@ bool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data )
// NB: the cast is needed in the ANSI build, strangely enough // NB: the cast is needed in the ANSI build, strangely enough
// dmDeviceName is BYTE[] and not char[] there // dmDeviceName is BYTE[] and not char[] there
wxStrlcpy(reinterpret_cast<wxChar *>(devMode->dmDeviceName), wxStrlcpy(reinterpret_cast<wxChar *>(devMode->dmDeviceName),
name.wx_str(), name.t_str(),
WXSIZEOF(devMode->dmDeviceName)); WXSIZEOF(devMode->dmDeviceName));
} }

View File

@@ -170,7 +170,7 @@ BOOL CALLBACK DisplayCloseButton(HWND hwnd, LPARAM lParam)
{ {
sharedData->m_labelCancel = _("Close"); sharedData->m_labelCancel = _("Close");
SendMessage( hwnd, WM_SETTEXT, 0, SendMessage( hwnd, WM_SETTEXT, 0,
(LPARAM) sharedData->m_labelCancel.wx_str() ); wxMSW_CONV_LPARAM(sharedData->m_labelCancel) );
return FALSE; return FALSE;
} }
@@ -212,7 +212,7 @@ void PerformNotificationUpdates(HWND hwnd,
} }
if ( sharedData->m_notifications & wxSPDD_TITLE_CHANGED ) if ( sharedData->m_notifications & wxSPDD_TITLE_CHANGED )
::SetWindowText( hwnd, sharedData->m_title.wx_str() ); ::SetWindowText( hwnd, sharedData->m_title.t_str() );
if ( sharedData->m_notifications & wxSPDD_MESSAGE_CHANGED ) if ( sharedData->m_notifications & wxSPDD_MESSAGE_CHANGED )
{ {
@@ -245,12 +245,12 @@ void PerformNotificationUpdates(HWND hwnd,
::SendMessage( hwnd, ::SendMessage( hwnd,
TDM_SET_ELEMENT_TEXT, TDM_SET_ELEMENT_TEXT,
TDE_MAIN_INSTRUCTION, TDE_MAIN_INSTRUCTION,
(LPARAM) title.wx_str() ); wxMSW_CONV_LPARAM(title) );
::SendMessage( hwnd, ::SendMessage( hwnd,
TDM_SET_ELEMENT_TEXT, TDM_SET_ELEMENT_TEXT,
TDE_CONTENT, TDE_CONTENT,
(LPARAM) body.wx_str() ); wxMSW_CONV_LPARAM(body) );
} }
if ( sharedData->m_notifications & wxSPDD_EXPINFO_CHANGED ) if ( sharedData->m_notifications & wxSPDD_EXPINFO_CHANGED )
@@ -262,7 +262,7 @@ void PerformNotificationUpdates(HWND hwnd,
::SendMessage( hwnd, ::SendMessage( hwnd,
TDM_SET_ELEMENT_TEXT, TDM_SET_ELEMENT_TEXT,
TDE_EXPANDED_INFORMATION, TDE_EXPANDED_INFORMATION,
(LPARAM) expandedInformation.wx_str() ); wxMSW_CONV_LPARAM(expandedInformation) );
} }
} }
@@ -806,7 +806,7 @@ void* wxProgressDialogTaskRunner::Entry()
if ( !m_sharedData.m_expandedInformation.empty() ) if ( !m_sharedData.m_expandedInformation.empty() )
{ {
tdc.pszExpandedInformation = tdc.pszExpandedInformation =
m_sharedData.m_expandedInformation.wx_str(); m_sharedData.m_expandedInformation.t_str();
} }
} }

View File

@@ -203,7 +203,7 @@ bool wxRadioBox::Create(wxWindow *parent,
wxWindowIDRef subid = NewControlId(); wxWindowIDRef subid = NewControlId();
HWND hwndBtn = ::CreateWindow(wxT("BUTTON"), HWND hwndBtn = ::CreateWindow(wxT("BUTTON"),
choices[i].wx_str(), choices[i].t_str(),
styleBtn, styleBtn,
0, 0, 0, 0, // will be set in SetSize() 0, 0, 0, 0, // will be set in SetSize()
GetHwndOf(parent), GetHwndOf(parent),

View File

@@ -33,10 +33,10 @@
#include "wx/dynlib.h" #include "wx/dynlib.h"
#include "wx/file.h" #include "wx/file.h"
#include "wx/wfstream.h" #include "wx/wfstream.h"
#include "wx/msw/private.h"
// Windows headers // Windows headers
#ifdef __WXWINCE__ #ifdef __WXWINCE__
#include "wx/msw/private.h"
#include <winbase.h> #include <winbase.h>
#include <winreg.h> #include <winreg.h>
#endif #endif

View File

@@ -47,14 +47,14 @@ int wxRichMessageDialog::ShowModal()
// add a checkbox // add a checkbox
if ( !m_checkBoxText.empty() ) if ( !m_checkBoxText.empty() )
{ {
tdc.pszVerificationText = m_checkBoxText.wx_str(); tdc.pszVerificationText = m_checkBoxText.t_str();
if ( m_checkBoxValue ) if ( m_checkBoxValue )
tdc.dwFlags |= TDF_VERIFICATION_FLAG_CHECKED; tdc.dwFlags |= TDF_VERIFICATION_FLAG_CHECKED;
} }
// add collapsible footer // add collapsible footer
if ( !m_detailedText.empty() ) if ( !m_detailedText.empty() )
tdc.pszExpandedInformation = m_detailedText.wx_str(); tdc.pszExpandedInformation = m_detailedText.t_str();
TaskDialogIndirect_t taskDialogIndirect = GetTaskDialogIndirectFunc(); TaskDialogIndirect_t taskDialogIndirect = GetTaskDialogIndirectFunc();
if ( !taskDialogIndirect ) if ( !taskDialogIndirect )

View File

@@ -583,7 +583,7 @@ void wxSlider::SetValue(int value)
if ( m_labels ) if ( m_labels )
{ {
::SetWindowText((*m_labels)[SliderLabel_Value], Format(value).wx_str()); ::SetWindowText((*m_labels)[SliderLabel_Value], Format(value).t_str());
} }
} }
@@ -603,9 +603,9 @@ void wxSlider::SetRange(int minValue, int maxValue)
if ( m_labels ) if ( m_labels )
{ {
::SetWindowText((*m_labels)[SliderLabel_Min], ::SetWindowText((*m_labels)[SliderLabel_Min],
Format(ValueInvertOrNot(m_rangeMin)).wx_str()); Format(ValueInvertOrNot(m_rangeMin)).t_str());
::SetWindowText((*m_labels)[SliderLabel_Max], ::SetWindowText((*m_labels)[SliderLabel_Max],
Format(ValueInvertOrNot(m_rangeMax)).wx_str()); Format(ValueInvertOrNot(m_rangeMax)).t_str());
} }
// When emulating wxSL_INVERSE style in wxWidgets, we need to update the // When emulating wxSL_INVERSE style in wxWidgets, we need to update the

View File

@@ -452,7 +452,7 @@ void wxSpinCtrl::SetValue(int val)
// to leave it like this, while we really want to always show the // to leave it like this, while we really want to always show the
// current value in the control, so do it manually // current value in the control, so do it manually
::SetWindowText(GetBuddyHwnd(), ::SetWindowText(GetBuddyHwnd(),
wxString::Format(wxT("%d"), val).wx_str()); wxString::Format(wxT("%d"), val).t_str());
} }
m_oldValue = GetValue(); m_oldValue = GetValue();

View File

@@ -460,13 +460,13 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT& rc)
if ( !rtl ) if ( !rtl )
{ {
RECT rc2 = { x, 0, x + width, y }; RECT rc2 = { x, 0, x + width, y };
::DrawText(hdc, label.wx_str(), label.length(), &rc2, ::DrawText(hdc, label.t_str(), label.length(), &rc2,
drawTextFlags); drawTextFlags);
} }
else // RTL else // RTL
{ {
RECT rc2 = { x, 0, x - width, y }; RECT rc2 = { x, 0, x - width, y };
::DrawText(hdc, label.wx_str(), label.length(), &rc2, ::DrawText(hdc, label.t_str(), label.length(), &rc2,
drawTextFlags | DT_RTLREADING); drawTextFlags | DT_RTLREADING);
} }
} }

View File

@@ -317,7 +317,7 @@ void wxStatusBar::DoUpdateStatusText(int nField)
// Set the status text in the native control passing both field number and style. // Set the status text in the native control passing both field number and style.
// NOTE: MSDN library doesn't mention that nField and style have to be 'ORed' // NOTE: MSDN library doesn't mention that nField and style have to be 'ORed'
if ( !StatusBar_SetText(GetHwnd(), nField | style, text.wx_str()) ) if ( !StatusBar_SetText(GetHwnd(), nField | style, text.t_str()) )
{ {
wxLogLastError("StatusBar_SetText"); wxLogLastError("StatusBar_SetText");
} }
@@ -563,7 +563,7 @@ void wxStatusBar::SetStatusStyles(int n, const int styles[])
// the fields' styles. // the fields' styles.
// NOTE: MSDN library doesn't mention that nField and style have to be 'ORed' // NOTE: MSDN library doesn't mention that nField and style have to be 'ORed'
wxString text = GetStatusText(i); wxString text = GetStatusText(i);
if (!StatusBar_SetText(GetHwnd(), style | i, text.wx_str())) if (!StatusBar_SetText(GetHwnd(), style | i, text.t_str()))
{ {
wxLogLastError("StatusBar_SetText"); wxLogLastError("StatusBar_SetText");
} }

View File

@@ -226,7 +226,7 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
notifyData.uFlags |= NIF_TIP; notifyData.uFlags |= NIF_TIP;
if ( !tooltip.empty() ) if ( !tooltip.empty() )
{ {
wxStrlcpy(notifyData.szTip, tooltip.wx_str(), WXSIZEOF(notifyData.szTip)); wxStrlcpy(notifyData.szTip, tooltip.t_str(), WXSIZEOF(notifyData.szTip));
} }
bool ok = wxShellNotifyIcon(m_iconAdded ? NIM_MODIFY bool ok = wxShellNotifyIcon(m_iconAdded ? NIM_MODIFY
@@ -271,8 +271,8 @@ wxTaskBarIcon::ShowBalloon(const wxString& title,
notifyData = NotifyIconData(hwnd); notifyData = NotifyIconData(hwnd);
notifyData.uFlags |= NIF_INFO; notifyData.uFlags |= NIF_INFO;
notifyData.uTimeout = msec; notifyData.uTimeout = msec;
wxStrlcpy(notifyData.szInfo, text.wx_str(), WXSIZEOF(notifyData.szInfo)); wxStrlcpy(notifyData.szInfo, text.t_str(), WXSIZEOF(notifyData.szInfo));
wxStrlcpy(notifyData.szInfoTitle, title.wx_str(), wxStrlcpy(notifyData.szInfoTitle, title.t_str(),
WXSIZEOF(notifyData.szInfoTitle)); WXSIZEOF(notifyData.szInfoTitle));
if ( flags & wxICON_INFORMATION ) if ( flags & wxICON_INFORMATION )

View File

@@ -427,7 +427,7 @@ bool wxTextCtrl::MSWCreateText(const wxString& value,
// implementation detail // implementation detail
m_updatesCount = -2; m_updatesCount = -2;
if ( !MSWCreateControl(windowClass.wx_str(), msStyle, pos, size, valueWin) ) if ( !MSWCreateControl(windowClass.t_str(), msStyle, pos, size, valueWin) )
return false; return false;
m_updatesCount = -1; m_updatesCount = -1;
@@ -1109,7 +1109,7 @@ void wxTextCtrl::DoWriteText(const wxString& value, int flags)
::SendMessage(GetHwnd(), selectionOnly ? EM_REPLACESEL : WM_SETTEXT, ::SendMessage(GetHwnd(), selectionOnly ? EM_REPLACESEL : WM_SETTEXT,
// EM_REPLACESEL takes 1 to indicate the operation should be redoable // EM_REPLACESEL takes 1 to indicate the operation should be redoable
selectionOnly ? 1 : 0, (LPARAM)valueDos.wx_str()); selectionOnly ? 1 : 0, wxMSW_CONV_LPARAM(valueDos));
if ( !ucf.GotUpdate() && (flags & SetValue_SendEvent) ) if ( !ucf.GotUpdate() && (flags & SetValue_SendEvent) )
{ {

View File

@@ -625,7 +625,7 @@ wxTextEntry::~wxTextEntry()
void wxTextEntry::WriteText(const wxString& text) void wxTextEntry::WriteText(const wxString& text)
{ {
::SendMessage(GetEditHwnd(), EM_REPLACESEL, 0, (LPARAM)text.wx_str()); ::SendMessage(GetEditHwnd(), EM_REPLACESEL, 0, wxMSW_CONV_LPARAM(text));
} }
wxString wxTextEntry::DoGetValue() const wxString wxTextEntry::DoGetValue() const

View File

@@ -985,7 +985,7 @@ bool wxToolBar::Realize()
{ {
const wxString& label = tool->GetLabel(); const wxString& label = tool->GetLabel();
if ( !label.empty() ) if ( !label.empty() )
button.iString = (INT_PTR)label.wx_str(); button.iString = (INT_PTR) wxMSW_CONV_LPCTSTR(label);
} }
button.idCommand = tool->GetId(); button.idCommand = tool->GetId();

View File

@@ -397,7 +397,7 @@ void wxToolTip::DoAddHWND(WXHWND hWnd)
// NMTTDISPINFO struct -- and setting the tooltip here we can have tooltips // NMTTDISPINFO struct -- and setting the tooltip here we can have tooltips
// of any length // of any length
ti.hwnd = hwnd; ti.hwnd = hwnd;
ti.lpszText = const_cast<wxChar *>(m_text.wx_str()); ti.lpszText = wxMSW_CONV_LPTSTR(m_text);
if ( !SendTooltipMessage(GetToolTipCtrl(), TTM_ADDTOOL, &ti) ) if ( !SendTooltipMessage(GetToolTipCtrl(), TTM_ADDTOOL, &ti) )
{ {
@@ -442,7 +442,7 @@ void wxToolTip::DoAddHWND(WXHWND hWnd)
const wxString token = tokenizer.GetNextToken(); const wxString token = tokenizer.GetNextToken();
SIZE sz; SIZE sz;
if ( !::GetTextExtentPoint32(hdc, token.wx_str(), if ( !::GetTextExtentPoint32(hdc, token.t_str(),
token.length(), &sz) ) token.length(), &sz) )
{ {
wxLogLastError(wxT("GetTextExtentPoint32")); wxLogLastError(wxT("GetTextExtentPoint32"));
@@ -484,7 +484,7 @@ void wxToolTip::DoAddHWND(WXHWND hWnd)
// replace the '\n's with spaces because otherwise they appear as // replace the '\n's with spaces because otherwise they appear as
// unprintable characters in the tooltip string // unprintable characters in the tooltip string
m_text.Replace(wxT("\n"), wxT(" ")); m_text.Replace(wxT("\n"), wxT(" "));
ti.lpszText = const_cast<wxChar *>(m_text.wx_str()); ti.lpszText = wxMSW_CONV_LPTSTR(m_text);
if ( !SendTooltipMessage(GetToolTipCtrl(), TTM_ADDTOOL, &ti) ) if ( !SendTooltipMessage(GetToolTipCtrl(), TTM_ADDTOOL, &ti) )
{ {
@@ -561,7 +561,7 @@ void wxToolTip::DoSetTip(WXHWND hWnd)
ti.lpszText = const_cast<wxChar *>(wxT("")); ti.lpszText = const_cast<wxChar *>(wxT(""));
(void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, &ti); (void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, &ti);
ti.lpszText = const_cast<wxChar *>(m_text.wx_str()); ti.lpszText = wxMSW_CONV_LPTSTR(m_text);
(void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, &ti); (void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, &ti);
} }

View File

@@ -473,7 +473,7 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate,
if ( !title.empty() ) if ( !title.empty() )
{ {
::SetWindowText(GetHwnd(), title.wx_str()); ::SetWindowText(GetHwnd(), title.t_str());
} }
SubclassWin(m_hWnd); SubclassWin(m_hWnd);
@@ -523,7 +523,7 @@ bool wxTopLevelWindowMSW::CreateFrame(const wxString& title,
#endif #endif
return MSWCreate(MSWGetRegisteredClassName(), return MSWCreate(MSWGetRegisteredClassName(),
title.wx_str(), pos, sz, flags, exflags); title.t_str(), pos, sz, flags, exflags);
} }
bool wxTopLevelWindowMSW::Create(wxWindow *parent, bool wxTopLevelWindowMSW::Create(wxWindow *parent,

View File

@@ -959,7 +959,7 @@ void wxTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text)
return; return;
wxTreeViewItem tvItem(item, TVIF_TEXT); wxTreeViewItem tvItem(item, TVIF_TEXT);
tvItem.pszText = (wxChar *)text.wx_str(); // conversion is ok tvItem.pszText = wxMSW_CONV_LPTSTR(text);
DoSetItem(&tvItem); DoSetItem(&tvItem);
// when setting the text of the item being edited, the text control should // when setting the text of the item being edited, the text control should
@@ -972,7 +972,7 @@ void wxTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text)
{ {
if ( item == m_idEdited ) if ( item == m_idEdited )
{ {
::SetWindowText(hwndEdit, text.wx_str()); ::SetWindowText(hwndEdit, text.t_str());
} }
} }
} }
@@ -1476,7 +1476,7 @@ wxTreeItemId wxTreeCtrl::DoInsertAfter(const wxTreeItemId& parent,
if ( !text.empty() ) if ( !text.empty() )
{ {
mask |= TVIF_TEXT; mask |= TVIF_TEXT;
tvIns.item.pszText = (wxChar *)text.wx_str(); // cast is ok tvIns.item.pszText = wxMSW_CONV_LPTSTR(text);
} }
else else
{ {

View File

@@ -141,7 +141,7 @@ bool wxGetHostName(wxChar *buf, int maxSize)
!regKey.QueryValue(wxT("Name"), hostName) ) !regKey.QueryValue(wxT("Name"), hostName) )
return false; return false;
wxStrlcpy(buf, hostName.wx_str(), maxSize); wxStrlcpy(buf, hostName.t_str(), maxSize);
#else // !__WXWINCE__ #else // !__WXWINCE__
DWORD nSize = maxSize; DWORD nSize = maxSize;
if ( !::GetComputerName(buf, &nSize) ) if ( !::GetComputerName(buf, &nSize) )

View File

@@ -373,7 +373,7 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags)
wxUnusedVar(flags); wxUnusedVar(flags);
WinStruct<SHELLEXECUTEINFO> sei; WinStruct<SHELLEXECUTEINFO> sei;
sei.lpFile = document.wx_str(); sei.lpFile = document.t_str();
#ifdef __WXWINCE__ #ifdef __WXWINCE__
sei.nShow = SW_SHOWNORMAL; // SW_SHOWDEFAULT not defined under CE (#10216) sei.nShow = SW_SHOWNORMAL; // SW_SHOWDEFAULT not defined under CE (#10216)
#else #else

View File

@@ -612,7 +612,7 @@ wxIcon wxFSVolume::GetIcon(wxFSIconType type) const
} }
SHFILEINFO fi; SHFILEINFO fi;
long rc = SHGetFileInfo(m_volName.wx_str(), 0, &fi, sizeof(fi), flags); long rc = SHGetFileInfo(m_volName.t_str(), 0, &fi, sizeof(fi), flags);
m_icons[type].SetHICON((WXHICON)fi.hIcon); m_icons[type].SetHICON((WXHICON)fi.hIcon);
if (!rc || !fi.hIcon) if (!rc || !fi.hIcon)
{ {

View File

@@ -403,7 +403,7 @@ bool wxToolMenuBar::Realize()
const wxString& label = tool->GetLabel(); const wxString& label = tool->GetLabel();
if ( !label.empty() ) if ( !label.empty() )
{ {
button.iString = (int)label.wx_str(); button.iString = (int) wxMSW_CONV_LPCTSTR(label);
} }
} }

View File

@@ -2174,7 +2174,7 @@ void wxWindowMSW::DoGetTextExtent(const wxString& string,
SIZE sizeRect; SIZE sizeRect;
TEXTMETRIC tm; TEXTMETRIC tm;
::GetTextExtentPoint32(hdc, string.wx_str(), string.length(), &sizeRect); ::GetTextExtentPoint32(hdc, string.t_str(), string.length(), &sizeRect);
GetTextMetrics(hdc, &tm); GetTextMetrics(hdc, &tm);
if ( x ) if ( x )
@@ -3761,8 +3761,8 @@ bool wxWindowMSW::MSWCreate(const wxChar *wclass,
m_hWnd = (WXHWND)::CreateWindowEx m_hWnd = (WXHWND)::CreateWindowEx
( (
extendedStyle, extendedStyle,
className.wx_str(), className.t_str(),
title ? title : m_windowName.wx_str(), title ? title : m_windowName.t_str(),
style, style,
x, y, w, h, x, y, w, h,
(HWND)MSWGetParent(), (HWND)MSWGetParent(),
@@ -3882,7 +3882,7 @@ bool wxWindowMSW::HandleTooltipNotify(WXUINT code,
( (
CP_ACP, CP_ACP,
0, // no flags 0, // no flags
ttip.wx_str(), ttip.t_str(),
tipLength, tipLength,
buf, buf,
WXSIZEOF(buf) - 1 WXSIZEOF(buf) - 1
@@ -5826,7 +5826,7 @@ int wxWindowMSW::HandleMenuChar(int WXUNUSED_IN_WINCE(chAccel),
wxMenuItem *item = (wxMenuItem*)mii.dwItemData; wxMenuItem *item = (wxMenuItem*)mii.dwItemData;
const wxString label(item->GetItemLabel()); const wxString label(item->GetItemLabel());
const wxChar *p = wxStrchr(label.wx_str(), wxT('&')); const wxChar *p = wxStrchr(label.t_str(), wxT('&'));
while ( p++ ) while ( p++ )
{ {
if ( *p == wxT('&') ) if ( *p == wxT('&') )