d无法初始化WNDCLASSW,WNDCLASSEX,WNDCLASSEXW窗口结构

时间:2013-01-27 10:43:02

标签: winapi window d

WNDCLASS wc; - ok
WNDCLASSA wc; - ok
WNDCLASSW wc; - Error: undefined identifier WNDCLASSW, did you mean alias WNDCLASS?
WNDCLASSEX wc; - Error: undefined identifier WNDCLASSEX, did you mean struct WNDCLASSEXA?
WNDCLASSEXA wc; - ok
WNDCLASSEXW wc; Error: undefined identifier WNDCLASSEXW, did you mean struct WNDCLASSEXA?

代码:

import core.runtime;
import core.sys.windows.windows;
extern(Windows)
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow) {
  WNDCLASSEXA wc;
  return 0;
}

我最关心的是WNDCLASSEXW,这是我打算使用的版本。

1 个答案:

答案 0 :(得分:2)

答案很简单我可以自己定义结构:

struct WNDCLASSEXW {
  UINT      cbSize;
  UINT      style;
  WNDPROC   lpfnWndProc;
  int       cbClsExtra;
  int       cbWndExtra;
  HINSTANCE hInstance;
  HICON     hIcon;
  HCURSOR   hCursor;
  HBRUSH    hbrBackground;
  LPCWSTR   lpszMenuName;
  LPCWSTR   lpszClassName;
  HICON     hIconSm;
}