summaryrefslogtreecommitdiff
path: root/dbaccess/win32/source/odbcconfig/odbcconfig.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-09-20 20:20:44 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-09-22 20:53:30 +0200
commiteef4c133e9649ebd690918bd7b83c2d5dc0dfcff (patch)
tree1a8d084c5b16056a15258770a05b9cd2d53a40bc /dbaccess/win32/source/odbcconfig/odbcconfig.cxx
parentbb406680cebd6fa1e1bdb9e2de430cd9a1f44da0 (diff)
Windows: avoid dependence on UNICODE define; prefer W functions
Change-Id: I95b90128e93f0d88ed73601bcc5a7ca9279d4cf1 Reviewed-on: https://gerrit.libreoffice.org/42560 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'dbaccess/win32/source/odbcconfig/odbcconfig.cxx')
-rw-r--r--dbaccess/win32/source/odbcconfig/odbcconfig.cxx21
1 files changed, 8 insertions, 13 deletions
diff --git a/dbaccess/win32/source/odbcconfig/odbcconfig.cxx b/dbaccess/win32/source/odbcconfig/odbcconfig.cxx
index 59e5b67c4424..86f8e67c4071 100644
--- a/dbaccess/win32/source/odbcconfig/odbcconfig.cxx
+++ b/dbaccess/win32/source/odbcconfig/odbcconfig.cxx
@@ -18,10 +18,6 @@
*/
-#define UNICODE
-#define _UNICODE
-#include <tchar.h>
-
#ifdef _MSC_VER
#pragma warning(push, 1)
#pragma warning(disable:4005)
@@ -31,7 +27,6 @@
# define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
-#include <shellapi.h>
#include <sqlext.h>
#ifdef _MSC_VER
@@ -50,19 +45,19 @@ int displayLastError()
DWORD dwError = GetLastError();
LPVOID lpMsgBuf;
- FormatMessage(
+ FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
nullptr,
dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- reinterpret_cast<LPTSTR>(&lpMsgBuf),
+ reinterpret_cast<LPWSTR>(&lpMsgBuf),
0,
nullptr
);
// Display the string.
- MessageBox( nullptr, static_cast<LPCTSTR>(lpMsgBuf), nullptr, MB_OK | MB_ICONERROR );
+ MessageBoxW( nullptr, static_cast<LPCWSTR>(lpMsgBuf), nullptr, MB_OK | MB_ICONERROR );
// Free the buffer.
LocalFree( lpMsgBuf );
@@ -74,11 +69,11 @@ int displayLastError()
*/
BOOL registerWindowClass( HINSTANCE _hAppInstance )
{
- WNDCLASSEX wcx;
+ WNDCLASSEXW wcx;
wcx.cbSize = sizeof(wcx); // size of structure
wcx.style = CS_HREDRAW | CS_VREDRAW; // redraw if size changes
- wcx.lpfnWndProc = DefWindowProc; // points to window procedure
+ wcx.lpfnWndProc = DefWindowProcW; // points to window procedure
wcx.cbClsExtra = 0; // no extra class memory
wcx.cbWndExtra = 0; // no extra window memory
wcx.hInstance = _hAppInstance; // handle to instance
@@ -89,13 +84,13 @@ BOOL registerWindowClass( HINSTANCE _hAppInstance )
wcx.lpszClassName = L"ODBCConfigMainClass"; // name of window class
wcx.hIconSm = nullptr; // small class icon
- return ( !!RegisterClassEx( &wcx ) );
+ return ( !!RegisterClassExW( &wcx ) );
}
/// initializes the application instances
HWND initInstance( HINSTANCE _hAppInstance )
{
- HWND hWindow = CreateWindow(
+ HWND hWindow = CreateWindowW(
L"ODBCConfigMainClass", // name of window class
L"ODBC Config Wrapper", // title-bar string
WS_OVERLAPPEDWINDOW, // top-level window
@@ -114,7 +109,7 @@ HWND initInstance( HINSTANCE _hAppInstance )
}
// main window function
-extern "C" int APIENTRY _tWinMain( HINSTANCE _hAppInstance, HINSTANCE, LPTSTR, int )
+extern "C" int APIENTRY wWinMain( HINSTANCE _hAppInstance, HINSTANCE, LPWSTR, int )
{
if ( !registerWindowClass( _hAppInstance ) )
return FALSE;