digitalmars.D - 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
Dec 04 2007
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 =3D /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 eventhandli=ng =. Mission impossible, good/bad idea, what do you think ? BjoernWorks 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 a= re = zero-terminated strings if you need them. -Mike -- = Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Dec 04 2007