How to get the pointer of "this" ?

Vinod K Chandran kcvinu82 at gmail.com
Sun May 24 17:05:16 UTC 2020


Hi all,
I have a class like this.
class Button : Control {
	...
	HWND createButton(){
		...
		SetWindowSubclass(this.mHandle, SUBCLASSPROC(&btnWndProc), 
UINT_PTR(subClsID), cast(DWORD_PTR) this);
	}
}

But compiler says that - "Error: 'this' is not an lvalue and 
cannot be modified"
I've seen many cpp code which uses pointer to 'this' as the last 
parameter in SetWindowSubclass(). Is there something wrong with 
my approach ?


More information about the Digitalmars-d-learn mailing list