For PB: Findwindow

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

PB,

concerning toolbox.

For learning I'am now busy with creating an Autocoder (looks like the
clipwizard of the notetab editor(http://www.notetab.com

How did you find the correct window of Purebasic?

ah, I see whenever a title exists which has PureBasic as active (foreground) you send info to it

I have the following windows open:
Purebasic - "" And a$"Program Manager" ; Ignore "fake" windows and the Desktop.
If IsWindowVisible_(r)=#TRUE And IsWindowEnabled_(r)=#TRUE; We found an open window!
nw=nw+1
wh(nw)=r
wt$(nw)=a$ ; Store its handle/title in variables.
; AddGadgetItem(3,-1,Left(a$,15))
If Left(a$,lentitle)= title ; get part of title to look for
prghandle=r
EndIf
; PrintN("["+Str(r)+"] "+a$) ; Show the handle/title in the console.
EndIf
EndIf
r=GetWindow_(r,#GW_HWNDNEXT) ; Find next window until no more are found.
Until r=0
ProcedureReturn prghandle
EndProcedure


[/code]





Using Windows 98 SE
Registered PB version : 3.2 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> But how do I get the Purebasic IDE, must I search for classname: PB_WindowClass

Yes, you must search for that class (as long as Fred doesn't change it).
The FindWindow API has two parameters: class and window title, in
that order. If you want a small free app that shows information
about all open windows (class name, handle, etc), then I recommend
using ShoWin: http://www.foundstone.com/knowledge/pro ... howin.html

Here's part of PBToolBox's code that makes sure PureBasic is not
running before updating its libraries:

Code: Select all

If FindWindow_("PB_WindowClass",0)0
  MessageBox_(0,"You must exit PureBasic before its libraries can be updated.","PBToolBox Error",#MB_ICONEXCLAMATION)
Else
  ; Do the update here.
EndIf

PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

Question:
Is this 'PB_WindowClass' only valid for the editor or for every GUI app created with PureBasic :)
And if not, what is the class name for every GUI app created with PureBasic :)
It's always the same :)
If I recall it right, Fred said once it changes everytime. Is this right?
How can I obtain the new Class name :)

Oh boy! Questions over questions...

Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> Is this 'PB_WindowClass' only valid for the editor or for every GUI
> app created with PureBasic :)

According to ShoWin (link above), it's only valid for the PureBasic
editor. My vis2pure app created with PureBasic has a class name of
"WindowClass_0".

> How can I obtain the new Class name :)

Via PureBasic, I'm not 100% sure. Download ShoWin and use that. :)


PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

> "WindowClass_0"

So you used OpenWindow(0,..
If you use OpenWindow(1,... it should change the 0 to 1 and so on...

New Window = new Class, so every Window can have
a different Background (SetWinBackgroundColor/Image())
and a separate Skin (SkinWin()).

cya,
...Danilo

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> "WindowClass_0"
> If you use OpenWindow(1,... it should change the 0 to 1 and so on...

I just tested it and you're right! :)

I also notice that the class name can be changed by hex editing the
exe... I don't know what use that would serve, but it can be done.


PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.
Originally posted by PB

> Is this 'PB_WindowClass' only valid for the editor or for every GUI
> app created with PureBasic :)

According to ShoWin (link above), it's only valid for the PureBasic
editor. My vis2pure app created with PureBasic has a class name of
"WindowClass_0".

> How can I obtain the new Class name :)

Via PureBasic, I'm not 100% sure. Download ShoWin and use that. :)


PB - Registered PureBasic Coder
Hi PB just downloaded ShoWin and played with it, nice tool...

You can see any window class on the desktop, even the hidden ones, it's amazing!
Found the hidden 'PBCompiler.exe' window. (Fred the compiler still says 'PureBasic v3.20' instead of 3.3.

Also found a lot of M$ Windows (W2k):
'Notification Wnd for PNSetupMgr'
'Connections Tray'
'NetDDE Agent'
'MS_WebcheckMonitor'
'CSC Notifications Window'
and a lot more...

Seems that a lot of windows are not needed anyway, only consume a lot of resources...

Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
Post Reply