Skip to content

Commit

Permalink
Fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
eschan145 committed Nov 3, 2024
1 parent a83472f commit 5671a79
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ class Application {
return;
}

SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
MoveWindow(hwnd, 0, 0, 400, 600, TRUE);

HWND running_button = CreateWindow(
Expand Down Expand Up @@ -285,6 +286,8 @@ class Application {
}

static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
Application* app = reinterpret_cast<Application*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));

switch (uMsg) {
case WM_COMMAND:
if (LOWORD(wParam) == Widgets::RUNNING) {
Expand All @@ -295,7 +298,7 @@ class Application {
}

std::string status = running ? "Stop" : "Start";
SetWindowText(widgets[Widgets::RUNNING], status.c_str());
SetWindowText(app->widgets[Widgets::RUNNING], status.c_str());
}
if (LOWORD(wParam) == Widgets::EXIT) {
DestroyWindow(hwnd);
Expand All @@ -304,7 +307,7 @@ class Application {

case WM_TIMER:
if (wParam == 1) {
update();
app->update();
}
return 0;

Expand Down

0 comments on commit 5671a79

Please sign in to comment.