diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/nu/MainThread.cpp | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/nu/MainThread.cpp')
-rw-r--r-- | Src/nu/MainThread.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Src/nu/MainThread.cpp b/Src/nu/MainThread.cpp new file mode 100644 index 00000000..520ebc4c --- /dev/null +++ b/Src/nu/MainThread.cpp @@ -0,0 +1,42 @@ +#include "MainThread.h" + + +LRESULT CALLBACK MarshallProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_USER: + { + Lambda *lambda = (Lambda *)wParam; + lambda->Run(); + delete lambda; + return 0; + } + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + + +MainThread::MainThread() +{ + WNDCLASSEX wcex; + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = 0; + wcex.lpfnWndProc = (WNDPROC)MarshallProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = GetModuleHandle(0); + wcex.hIcon = 0; + wcex.hCursor = 0; + wcex.hbrBackground = 0; + wcex.lpszMenuName = 0; + wcex.lpszClassName = "MainWindowMarshaller"; + wcex.hIconSm = 0; + RegisterClassEx(&wcex); + + mainWindow = CreateWindow( "MainWindowMarshaller", "MainWindowMarshaller", WS_DISABLED, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(0), NULL); +} + +MainThread mainThread; |