RegisterClass; "Parameter is incorrect"

I get the rather cryptic error message "Parameter is incorrect" when trying to register my window class via a macro I made, designed to define a window and a mated structure of the same name. Here is the macro:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#define DEFINE_WINDOW_OBJECT(OBJECT_NAME, WINDOW_NAME, WIN_STYLES, WINEXT_STYLES, WCLASS_STYLES) \
WNDCLASSA class_##OBJECT_NAME## = {0};\
long proc_##OBJECT_NAME##(HWND window, unsigned int msg, WPARAM par1, LPARAM par2);\
struct OBJECT_NAME##_s {\
HWND win_handle;\
void *extra;\
};\
extern CREATESTRUCTA *pre_make();\
extern struct OBJECT_NAME##_s *make_##OBJECT_NAME##_s();\
extern void pre_destroy();\
HWND parent, menu;\
const char *wndclass_name = #OBJECT_NAME;\
void initclass_##OBJECT_NAME##() {\
  static init = 0;\
  assert(init != 1);\
  class_##OBJECT_NAME##.style = WCLASS_STYLES;\
  class_##OBJECT_NAME##.lpfnWndProc = (WNDPROC)proc_##OBJECT_NAME##;\
  class_##OBJECT_NAME##.cbClsExtra = 0;\
  class_##OBJECT_NAME##.cbWndExtra = 4;\
  class_##OBJECT_NAME##.hCursor = LoadCursorA(NULL, MAKEINTRESOURCEA(IDC_ARROW));\
  class_##OBJECT_NAME##.hbrBackground = NULL;\
  class_##OBJECT_NAME##.lpszClassName = wndclass_name;\
  printf("wndclass_name: %s\n", wndclass_name);\
  if(RegisterClassA(&class_##OBJECT_NAME##) == 0)\
  ErrorExit();\
  init = 1;\
}\
HWND get_parent() {\
  return parent;\
}\
HWND get_menu() {\
  return menu;\
}\
struct OBJECT_NAME##_s *make_##OBJECT_NAME##_s() {\
  struct OBJECT_NAME##_s *t;\
  CREATESTRUCTA cr, *cr2;\
  t = malloc(sizeof(struct OBJECT_NAME##_s##));\
  cr2 = pre_make(&cr, t);\
  SetClassLongA(t->win_handle = CreateWindowExA(WINEXT_STYLES, wndclass_name, WINDOW_NAME, WIN_STYLES,\
  0, 0, 0, 0, NULL, NULL, get_app_handle(), cr2), 0, (LONG)t);\
  return t;\
}\
struct OBJECT_NAME##_s destroy_##OBJECT_NAME##_s(struct OBJECT_NAME##_s *t) {\
  pre_destroy(t);\
  DestroyWindow(t->win_handle);\
  free(t);\
} 


(The printf in the above code block is debugging output and shows that it is capturing the string correctly)

and here is the code that uses it:

1
2
3
4
5
6
7
#define WCLASS_STYLES \
CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS|WS_CHILD
#define WIN_EXT_STYLES \
WS_EX_CLIENTEDGE
#define WIN_STYLES \
~WS_BORDER
DEFINE_WINDOW_OBJECT(view, "", WIN_STYLES, WIN_EXT_STYLES, WCLASS_STYLES)


To which I get the error mentioned in the title. What gives?
WS_CHILD is not a class style.
Thanks! I added that today, how careless of me. :)
Topic archived. No new replies allowed.