summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-09-26 11:28:57 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-09-30 11:23:41 +0200
commit362a21d3a129b90149f6ef645c127f5e86e0ba61 (patch)
tree8583cb29b33de56e4489cb8950d2714a1fb2957e /extensions
parent81ce629c9e8a4fc26ded9d49157e3f3263991e03 (diff)
Use explicit function names for fooA/fooW WinAPI; prefer fooW
We should only use generic foo function name when it takes params that are also dependent on UNICODE define, like LoadCursor( nullptr, IDC_ARROW ) where IDC_ARROW is defined in MSVC headers synchronised with LoadCursor definition. We should always use Unicode API for any file paths operations, because otherwise we will get "?" for any character in path that is not in current non-unicode codepage, which will result in failed file operations. Change-Id: I3a7f453ca0f893002d8a9764318919709fd8b633 Reviewed-on: https://gerrit.libreoffice.org/42935 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/activex/SOActiveX.cxx20
-rw-r--r--extensions/source/activex/SOActiveX.h2
-rw-r--r--extensions/source/scanner/scanwin.cxx10
3 files changed, 16 insertions, 16 deletions
diff --git a/extensions/source/activex/SOActiveX.cxx b/extensions/source/activex/SOActiveX.cxx
index 436700851200..304b74812756 100644
--- a/extensions/source/activex/SOActiveX.cxx
+++ b/extensions/source/activex/SOActiveX.cxx
@@ -39,23 +39,23 @@
#pragma warning (pop)
-#define STAROFFICE_WINDOWCLASS "SOParentWindow"
+#define STAROFFICE_WINDOWCLASS L"SOParentWindow"
void OutputError_Impl( HWND hw, HRESULT ErrorCode )
{
- LPTSTR sMessage;
- FormatMessageA(
+ LPWSTR sMessage;
+ FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
nullptr,
ErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- reinterpret_cast<LPTSTR>(&sMessage),
+ reinterpret_cast<LPWSTR>(&sMessage),
0,
nullptr
);
- ::MessageBoxA( hw, sMessage, nullptr, MB_OK | MB_ICONINFORMATION );
+ MessageBoxW( hw, sMessage, nullptr, MB_OK | MB_ICONINFORMATION );
LocalFree( sMessage );
}
@@ -164,17 +164,17 @@ CSOActiveX::CSOActiveX()
OutputError_Impl( nullptr, hr );
mPWinClass.style = CS_HREDRAW|CS_VREDRAW;
- mPWinClass.lpfnWndProc = ::DefWindowProc;
+ mPWinClass.lpfnWndProc = DefWindowProcW;
mPWinClass.cbClsExtra = 0;
mPWinClass.cbWndExtra = 0;
- mPWinClass.hInstance = GetModuleHandle(nullptr); //myInstance;
+ mPWinClass.hInstance = GetModuleHandleW(nullptr); //myInstance;
mPWinClass.hIcon = nullptr;
mPWinClass.hCursor = nullptr;
mPWinClass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_BACKGROUND);
mPWinClass.lpszMenuName = nullptr;
mPWinClass.lpszClassName = STAROFFICE_WINDOWCLASS;
- RegisterClass(&mPWinClass);
+ RegisterClassW(&mPWinClass);
}
CSOActiveX::~CSOActiveX()
@@ -991,9 +991,9 @@ HRESULT CSOActiveX::OnDrawAdvanced( ATL_DRAWINFO& di )
}
mParentWin = hwnd;
- mOffWin = CreateWindow(
+ mOffWin = CreateWindowW(
STAROFFICE_WINDOWCLASS,
- "OfficeContainer",
+ L"OfficeContainer",
WS_CHILD | WS_CLIPCHILDREN | WS_BORDER,
di.prcBounds->left,
di.prcBounds->top,
diff --git a/extensions/source/activex/SOActiveX.h b/extensions/source/activex/SOActiveX.h
index 14451fcdbf51..5f652e6b6752 100644
--- a/extensions/source/activex/SOActiveX.h
+++ b/extensions/source/activex/SOActiveX.h
@@ -90,7 +90,7 @@ protected:
OLECHAR const * mCurFileUrl;
BOOL mbLoad;
BOOL mbViewOnly;
- WNDCLASS mPWinClass;
+ WNDCLASSW mPWinClass;
HWND mParentWin;
HWND mOffWin;
diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx
index 117e8d55f80e..437b408a6918 100644
--- a/extensions/source/scanner/scanwin.cxx
+++ b/extensions/source/scanner/scanwin.cxx
@@ -127,7 +127,7 @@ static ImpTwain* pImpTwainInstance = nullptr;
LRESULT CALLBACK TwainWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 )
{
- return DefWindowProc( hWnd, nMsg, nPar1, nPar2 );
+ return DefWindowProcW( hWnd, nMsg, nPar1, nPar2 );
}
LRESULT CALLBACK TwainMsgProc( int nCode, WPARAM wParam, LPARAM lParam )
@@ -235,11 +235,11 @@ ImpTwain::ImpTwain( ScannerManager& rMgr, const Link<unsigned long,void>& rNotif
strncpy( aAppIdent.ProductName, "Office", 32 );
aAppIdent.ProductName[32] = aAppIdent.ProductName[33] = 0;
- WNDCLASS aWc = { 0, &TwainWndProc, 0, sizeof( WNDCLASS ), GetModuleHandle( nullptr ), nullptr, nullptr, nullptr, nullptr, "TwainClass" };
- RegisterClass( &aWc );
+ WNDCLASSW aWc = { 0, &TwainWndProc, 0, sizeof( WNDCLASSW ), GetModuleHandleW( nullptr ), nullptr, nullptr, nullptr, nullptr, L"TwainClass" };
+ RegisterClassW( &aWc );
- hTwainWnd = CreateWindowEx( WS_EX_TOPMOST, aWc.lpszClassName, "TWAIN", 0, 0, 0, 0, 0, HWND_DESKTOP, nullptr, aWc.hInstance, nullptr );
- hTwainHook = SetWindowsHookEx( WH_GETMESSAGE, &TwainMsgProc, nullptr, GetCurrentThreadId() );
+ hTwainWnd = CreateWindowExW( WS_EX_TOPMOST, aWc.lpszClassName, L"TWAIN", 0, 0, 0, 0, 0, HWND_DESKTOP, nullptr, aWc.hInstance, nullptr );
+ hTwainHook = SetWindowsHookExW( WH_GETMESSAGE, &TwainMsgProc, nullptr, GetCurrentThreadId() );
// block destruction until ImplDestroyHdl is called
mxSelfRef = static_cast< ::cppu::OWeakObject* >( this );