summaryrefslogtreecommitdiff
path: root/alf
diff options
context:
space:
mode:
Diffstat (limited to 'alf')
-rw-r--r--alf/alf.cpp26
-rw-r--r--alf/alf.h2
2 files changed, 25 insertions, 3 deletions
diff --git a/alf/alf.cpp b/alf/alf.cpp
index 78eed99..fbc7822 100644
--- a/alf/alf.cpp
+++ b/alf/alf.cpp
@@ -1,5 +1,7 @@
#include "alfpriv.h"
+#include <rpc.h>
+
/* ALF App and Window */
static void
@@ -527,13 +529,33 @@ ALF_RegisterWindowClass(ALFAPP app, const ALFWindowClassParams *params)
WNDCLASS cls;
ZeroMemory(&cls, sizeof(cls));
- // TODO: autogenerate class name
+ const TCHAR *classNamePtr = params->className;
+ TCHAR classNameBuf[256];
+ if (!classNamePtr) {
+ ZeroMemory(classNameBuf, sizeof(classNameBuf));
+ classNamePtr = classNameBuf;
+
+ UUID uuid;
+ UuidCreate(&uuid);
+
+#ifdef UNICODE
+ unsigned short *uuidstr = NULL;
+#else
+ unsigned char *uuidstr = NULL;
+#endif
+ UuidToString(&uuid, &uuidstr);
+
+ lstrcpy(classNameBuf, TEXT("ALFWindow."));
+ lstrcat(classNameBuf, (LPCTSTR)uuidstr);
+
+ RpcStringFree(&uuidstr);
+ }
cls.style = params->classStyle;
cls.hInstance = app->hInstance;
cls.hCursor = LoadCursor(NULL, (LPTSTR)IDC_ARROW);
cls.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
- cls.lpszClassName = params->className;
+ cls.lpszClassName = classNamePtr;
cls.cbWndExtra = sizeof(void*);
cls.cbClsExtra = sizeof(void*)*2;
cls.lpfnWndProc = DefWindowProc;
diff --git a/alf/alf.h b/alf/alf.h
index 6730445..5f7ce61 100644
--- a/alf/alf.h
+++ b/alf/alf.h
@@ -47,7 +47,7 @@ typedef struct {
#define ALF_WM_APPLYSIZE (ALF_WM__BASE + 12)
typedef struct {
- const WCHAR *className;
+ const TCHAR *className;
UINT classStyle;
ALFWindowVTable vtbl;
} ALFWindowClassParams;