Old 02-27-2009, 01:36 AM   #1
404NotFound
Human being with feelings
 
404NotFound's Avatar
 
Join Date: Oct 2007
Location: Berlin, GER
Posts: 199
Default What's this?



Basically, I'm trying to build a dockable window using wxWidgets. At the moment I'm able to create windows but docking doesn't work yet. I already managed to have reg->hwnd_main as parent window (a bit tricky since it's no intended use of wxWidgets), but DockWindowAdd() gives the error message shown above. What went wrong?

Here's a piece of code:
Code:
wxWindow *w = new wxWindow(); // dummy parent window
wxWindow *window = w->CreateWindowFromHWND(0, (WXHWND) g_hwndParent); // "cast" main window to wxWindow
wxDialog* dlg = new wxDialog(window,-1,"Hello World",wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE,wxDialogNameStr); // create simple dialog window
dlg->Show(); // show dialog
DockWindowAdd((HWND)dlg->GetHandle(), "Hello World", 40400, true); // add to dock
MessageBox(NULL, "Success!","Info",MB_OK); // this line will not be executed
404NotFound is offline   Reply With Quote
Old 02-27-2009, 09:21 AM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,913
Default

Have you checked from wxwidgets documentation what you get from dlg->GetHandle() is a win32 window handle, not some internal handle from wxwidgets? The cast would seem to indicate the types are maybe not compatible in the first place and thus what is returned from dlg->GetHandle() isn't a valid Windows handle at all.

DockWindowAdd((HWND)dlg->GetHandle(), "Hello World", 40400, true);

A similar problem appears to be in the call :

wxWindow *window = w->CreateWindowFromHWND(0, (WXHWND) g_hwndParent);

You are casting a win32 window handle to what would maybe appear to be wxwidget's own window handle type.
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/

Last edited by Xenakios; 02-27-2009 at 09:25 AM.
Xenakios is offline   Reply With Quote
Old 02-27-2009, 10:17 AM   #3
404NotFound
Human being with feelings
 
404NotFound's Avatar
 
Join Date: Oct 2007
Location: Berlin, GER
Posts: 199
Default

GetHandle() returns a WXHWND which can be safely cast to your platform's window handle - HWND in Windows, GtkWindow* in Linux and so on. Maybe Reaper expects a HWND of a CDialog but wxWidgets uses a CWnd even for dialogs...
404NotFound is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:56 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.