aboutsummaryrefslogtreecommitdiff
path: root/c/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c/main.cpp')
-rw-r--r--c/main.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/c/main.cpp b/c/main.cpp
index c237e31..26cc25d 100644
--- a/c/main.cpp
+++ b/c/main.cpp
@@ -58,7 +58,7 @@ static void UpdateTheme();
void OnTerminate() noexcept
{
const wchar_t* what = L"an exception";
- wchar_ptr why;
+ WcharPtr why;
try {
std::rethrow_exception(std::current_exception());
@@ -67,9 +67,9 @@ void OnTerminate() noexcept
try { why = PlString(t); } catch (...) {}
} catch (const Win32Error& e) {
what = L"a Windows error";
- try { why = wchar_ptr::copy(e.What()); } catch (...) {}
+ try { why = WcharPtr::Copy(e.What()); } catch (...) {}
} catch (const std::exception& e) {
- try { why = wchar_ptr::from_narrow(e.what()); } catch (...) {}
+ try { why = WcharPtr::FromNarrow(e.what()); } catch (...) {}
} catch (...) {}
wchar_t msg[256] = {0};
@@ -99,10 +99,10 @@ int WINAPI WinMain(const HINSTANCE hInstance, const HINSTANCE, char* const, cons
INITCOMMONCONTROLSEX icc;
icc.dwSize = sizeof(icc);
icc.dwICC = ICC_WIN95_CLASSES;
- require(InitCommonControlsEx(&icc));
+ Require(InitCommonControlsEx(&icc));
- g_hMenuPopup = require(LoadMenu((HINSTANCE)NULL, MAKEINTRESOURCE(IDR_POPUPMENU)));
- g_hMenuPopup = require(GetSubMenu(g_hMenuPopup, 0));
+ g_hMenuPopup = Require(LoadMenu((HINSTANCE)NULL, MAKEINTRESOURCE(IDR_POPUPMENU)));
+ g_hMenuPopup = Require(GetSubMenu(g_hMenuPopup, 0));
WNDCLASSEX wc;
memset(&wc, 0, sizeof(WNDCLASSEX));
@@ -115,23 +115,23 @@ int WINAPI WinMain(const HINSTANCE hInstance, const HINSTANCE, char* const, cons
wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU);
wc.lpszClassName = L"Episode Browser";
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
- require(RegisterClassEx(&wc));
+ Require(RegisterClassEx(&wc));
/* Create window. A CBT hook is used to initialize important
* global variables before any messages are sent to the new
* window. It is vital that the hook is set up correctly. */
- const HHOOK hHook = require(SetWindowsHookEx(WH_CBT, CBTProc,
+ const HHOOK hHook = Require(SetWindowsHookEx(WH_CBT, CBTProc,
(HINSTANCE)NULL, GetCurrentThreadId()));
- const HWND hWnd = require(CreateWindowEx(
+ const HWND hWnd = Require(CreateWindowEx(
0,
L"Episode Browser",
L"Episode Browser",
WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT, 0, 0,
(HWND)NULL, (HMENU)NULL, hInstance, (void*)NULL));
- require(UnhookWindowsHookEx(hHook));
+ Require(UnhookWindowsHookEx(hHook));
- g_hWndStatus = require(CreateWindowEx(
+ g_hWndStatus = Require(CreateWindowEx(
0,
STATUSCLASSNAME,
(const wchar_t*)NULL,
@@ -178,16 +178,16 @@ static LRESULT CALLBACK CBTProc(const int nCode, const WPARAM wParam, const LPAR
lib->GetProcAddress<void>("SystemParametersInfoW")) {
NONCLIENTMETRICS m;
m.cbSize = sizeof(NONCLIENTMETRICS);
- require(SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
+ Require(SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICS), &m, 0));
- g_hfNormal = require(CreateFontIndirect(&m.lfMessageFont));
+ g_hfNormal = Require(CreateFontIndirect(&m.lfMessageFont));
} else
- g_hfNormal = static_cast<HFONT>(require(GetStockObject(DEFAULT_GUI_FONT)));
+ g_hfNormal = static_cast<HFONT>(Require(GetStockObject(DEFAULT_GUI_FONT)));
LOGFONT lf;
- require(GetObject(g_hfNormal, sizeof(LOGFONT), &lf));
+ Require(GetObject(g_hfNormal, sizeof(LOGFONT), &lf));
lf.lfWeight = FW_BOLD;
- g_hfBold = require(CreateFontIndirect(&lf));
+ g_hfBold = Require(CreateFontIndirect(&lf));
/* Load theme functions, if available. */
if (HMODULE hModule = LoadLibrary(L"uxtheme.dll")) {
@@ -258,7 +258,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam,
g_dpi = HIWORD(wParam);
Metric<SM_CXVSCROLL> = GetSystemMetrics(SM_CXVSCROLL);
- prefer(SetWindowPos(hWnd, (HWND)NULL,
+ Prefer(SetWindowPos(hWnd, (HWND)NULL,
r->left, r->top,
r->right-r->left,
r->bottom-r->top,
@@ -500,7 +500,7 @@ void WaitFor(const char* mod, const char* pred)
static atom_t aThread;
static int bActive;
static int iTimer;
- static wchar_ptr activePred;
+ static WcharPtr activePred;
if (bActive) {
wchar_t msg[256] = {0};
@@ -535,8 +535,8 @@ void WaitFor(const char* mod, const char* pred)
Plx(mod,"thread_create",pred,&aThread);
SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(1,0), (LPARAM)L".");
- if (prefer(iTimer = SetTimer(NULL, -1, 500, proc))) {
- activePred = wchar_ptr::from_narrow(pred);
+ if (Prefer(iTimer = SetTimer(NULL, -1, 500, proc))) {
+ activePred = WcharPtr::FromNarrow(pred);
bActive = 1;
}
}