| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | window allways on top |
Hy Rinat and Jefffrey,
Antwort auf eine Message von Rinat Sadretdinow an Andreas Just:
RS> Hello Andreas!
AJ>>> I'm searching for a solution to put a window allways on top of an
AJ>>> unknown window (StarOffice Writer).
JH>> You could use a WM_TIMER and do a WinSetWindowPos every second or
JH>> so.. But then it fill float on top of all windows ofcourse. Don't
JH>> know if you want that.
RS> I wouldn't recommend to use timer, it will be "flicking".
Try to set
RS> some hook instead and catch exactly time when your window is about to
RS> be placed under another.
I've now used IWindow.isShowing() (the same as WinIsWindowShowing) to
query respositioning the window. The parent of the window is HWND_DESKTOP and
the function is called by an ITimerMemberFn.
This works nice and if the window is on top there is no flicking.
The only problem - it works only if the window is complettly unvisible.
Searching with PMSPY (from DevCon) for any message which will be send to
the window (if it is behind any window) was not successfull (?).
Now I'm looking for a function which will give me a rectangle of the
visible area of the window. Comparing this value with the complette window
size should work.
The handler is really simple so I will post it here - may be someone has
the idea what to
to do (at the time I've to develop some more important functions ;-)):
// HDLTOTOP.HPP
#ifndef _HDL_WINALLWAYSTOTOP_
#define _HDL_WINALLWAYSTOTOP_
#include
#include
#include
#ifndef WM_CLOSE // WM_CLOSE - close Command from CLOSE notification
#define WM_CLOSE 0x0029
#endif
#ifndef SC_CLOSE // SC_CLOSE - SystemCommand from Systemmenue
#define SC_CLOSE 0xF060
#endif
// Align classes on four byte boundary.
#pragma pack(4)
class HDL_WinAllwaysToTop : public IHandler
{
public:
//constructor: default timerfrequency = 0,1 sec
HDL_WinAllwaysToTop(unsigned long intrval = 100)
{
thisWin = (IWindow*)0;
itrv = intrval;
};
void winToTop()
{
if(!thisWin->isShowing()) //not every time
{
thisWin->positionOnSiblings(); //Z-Order TOP
}
}
ITimer* toTopTimer; // used Timer
IWindow* thisWin; // for this window
char lastCall; // flag for last call
unsigned long itrv; // refresh intervall
protected:
virtual
Boolean dispatchHandlerEvent(IEvent& evt)
{
if(!thisWin)
{
lastCall = 0;
thisWin = (IWindow*) evt.window();
thisWin->setParent(thisWin->desktopWindow());
toTopTimer = new ITimer(new
ITimerMemberFn0(*this,
HDL_WinAllwaysToTop::winToTop), itrv);
return false;
}
// CLOSE Request : two ways
if (((evt.eventId() == WM_CLOSE) ||
(evt.parameter1().number1() == SC_CLOSE))
&& !lastCall)
{
lastCall = 1;
if(toTopTimer != (ITimer*)0)
{
toTopTimer->stop();
delete toTopTimer;
thisWin->sendEvent(WM_CLOSE,0,0); //behind the last timermsg
}
return true;
}
return false;
}
};
#pragma pack()
#endif
The last call flag is used to avoid the problem that there may be a
timermsg on the way
after this class was deleted -> result was a call to a notexisting memberfunction.
For ViusalBuilder this is the
HDLTOTOP.VBE:
//VBBeginPartInfo: HDL_WinAllwaysToTop,"Handler: Window allways to top"
//VBParent: IHandler
//VBIncludes: "HDLToTop.hpp"
//VBPartDataFile: HDLTOTOP.VBB
//VBConstructor: HDL_WinAllwaysToTop(unsigned long intrval = 100)
//VBComposerInfo: class,204,dde4vr30
//VBPreferredFeatures: this
//VBEndPartInfo: HDL_WinAllwaysToTop
TschuesS/2
Andreas
--- FleetStreet 1.02 NR
* Origin: (2:241/53.33)SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934 SEEN-BY: 711/955 712/407 515 624 628 713/317 800/1 @PATH: 241/53 1000 24/999 888 396/1 270/101 712/515 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.