Article View: borland.public.cppbuilder.nativeapi
Article #7189Messages, fsStayOnTop and Exception Dialogs
From: Stephen Craig
Date: Tue, 01 Mar 2005 12:23
Date: Tue, 01 Mar 2005 12:23
33 lines
2244 bytes
2244 bytes
Hi
I have forms that I want to stay on top so I have set their form style as
fsStayOnTop. This works pretty well until an exception is raised. The
exception message gets hidden behind the form.
I searched the Newgroups and found an answer to similar problem in a Delphi
newsgroup (Peter Below). Below is my converted code. My understanding of
what is going on is not great, but it appears that the idea is to capture
the WM_ACTIVATE message and then set the associate dialog to TOPMOST. This
works ok for dialogs that I create but not for exception message dialogs.
For exception dialogs, FindControl returns a NULL, and so I never get to set
the exception dialog to TopMost. Why is this happening. Is there a better
solution to my problem?
void __fastcall TCalcForm::WMActivate(TMessage &msg)
{
int actFlag = msg.WParamLo;
if (actFlag == WA_INACTIVE) {
void* window = (void*)msg.LParam;
if (window != NULL) {
// need to find out if the window coming up is a message dialog
TWinControl* form = FindControl(window);
if (form != NULL && form->ClassNameIs("TMessageForm")) {
SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE |
SWP_NOSIZE);
}
}
}
TForm::Dispatch(&msg);
}
Steve Craig
Technical Details
Message-ID:
<42245eab$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,b63441b3c04c0faf,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Stephen Craig" <stevecraig@ozemail.com.au> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Messages, fsStayOnTop and Exception Dialogs Date: Tue, 1 Mar 2005 22:23:07 +1000 Lines: 36 Organization: Cubic Software X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 210.84.71.120 Message-ID: <42245eab$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1109679787 210.84.71.120 (1 Mar 2005 04:23:07 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail