porting Windows C++ to D, a few questions

BLS nanali at nospam-wanadoo.fr
Mon Sep 17 11:56:34 PDT 2007


Hi,

I have/would like to translate a Windows C++ source into D and I have 
questions regarding
Class pointer, casting, and CALLBACK

Okay, here a C++ fragment.
class CWin : public CMsg
{

WNDCLASSEX	wcex;
wcex.hbrBackground= (HBRUSH) (COLOR_BTNFACE+1);
// How to translate this into D ?
// I guess :

//wcex.hbrBackground = cast(HBRUSH) (COLOR_BTNFACE+1);
// Is this correct ????


//Later :
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uID, WPARAM wParam, 
LPARAM lParam)
// Actually I have no idea how to convert this construct into D...
{

   CWin* pWnd=NULL;
   // I think in D using a pointer to a class is not nessesary.
   // Do you agree ? However the next pb. I have is here :

pWnd = 
reinterpret_cast<CWin*>((long)((LPCREATESTRUCT)lParam)->lpCreateParams);

// Now it seems to become difficult. In case that I define
CWin pWind; // instead off CWin* pWnd;
//then casting is impossible. So what can I do ?
}
}
Bjoern


More information about the Digitalmars-d-learn mailing list