Windows Resources

Prudence via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 5 12:06:13 PDT 2015


I'm trying to create a win32 window. I coped the code pretty much 
directly from msdn:

	MSG msg;
		BOOL bRet;
		WNDCLASS wc;

		// Register the window class for the main window.

		if (!hPrevInstance)
		{
			wc.style = 0;
			wc.lpfnWndProc = cast(WNDPROC)&WndProc;
			wc.cbClsExtra = 0;
			wc.cbWndExtra = 0;
			wc.hInstance = hInstance;
			//wc.hIcon = LoadIcon(cast(HINSTANCE) NULL, IDI_APPLICATION);
			//wc.hCursor = LoadCursor(cast(HINSTANCE) NULL, IDC_ARROW);
			wc.hIcon = NULL;
			wc.hCursor = NULL;
			wc.hbrBackground = GetStockObject(WHITE_BRUSH);
			wc.lpszMenuName =  "MainMenu";
			wc.lpszClassName = "MainWndClass";

			if (!RegisterClass(&wc))
				return FALSE;
		}

		// Create the main window.
		hwndMain = CreateWindow("MainWndClass", "Sample",
								WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
								CW_USEDEFAULT, CW_USEDEFAULT, cast(HWND) NULL,
								cast(HMENU) NULL, hInstance, cast(LPVOID) NULL);
		if (!hwndMain)
		{
			auto x = GetLastError();
			return FALSE;
		}


x is 1812 = ERROR_RESOURCE_DATA_NOT_FOUND

That's about as far as I can get. (what resource data? Where I do 
put it? How, who, when?)




More information about the Digitalmars-d-learn mailing list