December 04, 2007 Interfaceing C++ using a Win32 GUI | ||||
---|---|---|---|---|
| ||||
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 |
December 04, 2007 Re: Interfaceing C++ using a Win32 GUI | ||||
---|---|---|---|---|
| ||||
Posted in reply to BLS | On Tue, 04 Dec 2007 22:59:59 +0100, BLS <nanali@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/ |
Copyright © 1999-2021 by the D Language Foundation