Interfaceing C++ using a Win32 GUI

Mike vertex at gmx.at
Tue Dec 4 14:19:15 PST 2007


On Tue, 04 Dec 2007 22:59:59 +0100, BLS <nanali at nospam-wanadoo.fr> wrote:

> Hi,
> I am porting a huge C++ Windows GUI into D1. (no fun at all) But I  
> wonder if it  is possible to keep the original C++ lib using D2's new  
> extern (C++) feature. Advantage is that I have less trouble regarding  
> the win header files, and I guess this approach will require less time.
> BUT - I wonder how to manage the windows callbacks :
>
> C++
> BOOL CWnd::RegisterClassEx(WNDCLASSEX& wcx)
> {
> wcx.lpfnWndProc    = /CWnd::StaticWindowProc/;
> ....
> if (!::RegisterClassEx(&wcx))
> ....
> }
>
> static LRESULT CALLBACK StaticWindowProc(HWND hWnd, UINT uMsg, WPARAM  
> wParam, LPARAM lParam);
>
> Of course this function has to be within the D code as
> extern (windows) static ..., because we need to manage the eventhandling  
> .
>
> Mission impossible, good/bad idea, what do you think ?
> Bjoern

Works if you have the right aliases for HWND etc. I'm doing stuff like  
that a lot lately and there's never been a real problem. The only PITA are  
zero-terminated strings if you need them.

-Mike


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the Digitalmars-d mailing list