string vs. w/char*

Kagamin spam at here.lot
Fri Mar 4 00:28:09 PST 2011


Tyro[a.c.edwards] Wrote:

> class TopWinClass: WinClass
> {
> 	this(ushort resId, HINSTANCE hInst, WNDPROC wndProc)
> 	{
> 		super(resId, hInst, wndProc);
> 		SetResIcons(resId);
> 		wc.lpszMenuName = MAKEINTRESOURCEA(resId);  // [PROBLEM]
> 	}
> }
> 
> Every access to wc.lpszMenuName after this point fails.

Who accesses it?

MAKEINTRESOURCEA just casts int to char* so it's an invalid pointer while still valid resource indentifier, windows can differentiate them by zeroed high word.


More information about the Digitalmars-d-learn mailing list