From 4a55b8d74132daa7b9c2b09c337532e5b0683cbf Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Mon, 3 Apr 2017 22:26:21 +0900 Subject: win32: add about dialog --- win32/oscilloview.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'win32/oscilloview.c') diff --git a/win32/oscilloview.c b/win32/oscilloview.c index 1478614..12851f4 100644 --- a/win32/oscilloview.c +++ b/win32/oscilloview.c @@ -24,12 +24,15 @@ static struct { struct oscillodata oscillodata[LIBOPNA_OSCILLO_TRACK_COUNT]; UINT mmtimer; HPEN whitepen; + void (*closecb)(void *ptr); + void *cbptr; } g; static void on_destroy(HWND hwnd) { g.oscilloview = 0; timeKillEvent(g.mmtimer); DeleteObject(g.whitepen); + if (g.closecb) g.closecb(g.cbptr); } static void CALLBACK mmtimer_cb(UINT timerid, UINT msg, @@ -111,7 +114,9 @@ static LRESULT CALLBACK wndproc( return DefWindowProc(hwnd, msg, wParam, lParam); } -void show_oscilloview(HINSTANCE hinst, HWND parent) { +void oscilloview_open(HINSTANCE hinst, HWND parent, void (*closecb)(void *ptr), void *cbptr) { + g.closecb = closecb; + g.cbptr = cbptr; g.hinst = hinst; g.parent = parent; if (!g.oscilloview) { @@ -140,3 +145,10 @@ void show_oscilloview(HINSTANCE hinst, HWND parent) { SetForegroundWindow(g.oscilloview); } } + +void oscilloview_close(void) { + if (g.oscilloview) { + g.closecb = 0; + DestroyWindow(g.oscilloview); + } +} -- cgit v1.2.3