Page 1 of 1
Window Referenceing
Posted: Fri Jun 11, 2004 12:06 pm
by Raven
I've been wondering for a few days, is there a way to setup a Window created outside of PureBASIC to give it access?
it's just the Window commands work by Window Numbers which are obviously internal to PureBASIC; however there doesn't appear to be a way of taking a window handle created outside of PureBASIC and adding it so it's accessible as a Window Number.
i would think it would've been part of the Use Window command but that only uses the Window Numbers too.
Posted: Fri Jun 11, 2004 12:15 pm
by fweil
I guess you can access external windows only using API commands otherwise it will not be possible to know about external windows handles ...
What context do you think to in this post ?
Maybe that would be helpful to have an alternate command to UseWindow(WindowNumber) which could be UseWindowByHandle(WindowID()) or UseWindowByHandle(ExternalWindowHandle) ?
Re: Window Referenceing
Posted: Fri Jun 11, 2004 1:37 pm
by Kale
Raven wrote:I've been wondering for a few days, is there a way to setup a Window created outside of PureBASIC to give it access?
it's just the Window commands work by Window Numbers which are obviously internal to PureBASIC; however there doesn't appear to be a way of taking a window handle created outside of PureBASIC and adding it so it's accessible as a Window Number.
i would think it would've been part of the Use Window command but that only uses the Window Numbers too.
In what way do you want to manipulate the external window?
Posted: Mon Jun 14, 2004 3:43 pm
by Raven
Well basically the context is creating a DLL so that I can use PureBASICs Window commands rather than the WinAPI directly.
I mean it's just a case of adding a Window created outside of PB's Window commands to the list of those Windows available to use.
#Window = UseWindowByHandle( hWnd ) ; would be perfect
Getting the Handle and details of the Window isn't a problem.
The problem lies in
DisplayPopupMenu(), WindowID() and EventWindowID() ... as the popup display seems to crash unless a PB window has been created, and the ID functions return nothing unless again a PB window has been created.
More over ActivateWindow() appears to activate the previously used Window rather than the current one which GetActiveWindow_() will return fine.
This is just a way of adding a very very easy Window Function/API for use with my C++ Programs. As it's alot easier to use PBs than using WinAPI, wxWindow/wxWidget, GTK or MFC.
One solution is to use PB to create the main window, but C++ doesn't appear to like you not using WinAPI WinMain( ) when your creating a Win32 exe.