Article View: borland.public.cppbuilder.nativeapi
Article #15921force a form to be on top
From: Mike
Date: Sun, 08 Jun 2003 10:06
Date: Sun, 08 Jun 2003 10:06
74 lines
2684 bytes
2684 bytes
Hello,
I had create a DLL (check.dll) for my customers. They include this to their
software project. My DLL shows a form, weather this software products is not
registrated.
In my DLL i show this form via a dynamical function (CheckVersion) by
folliwing code:
TForm1 *form = new TForm1(NULL);
form->ShowModal();
delete form;
On my computer this works fine and the window is on top.
My customer use following code to load my dll and to start the function in
the dll which check weather a function is registered:
this is pcs7 code:
#include "apdefap.h"
void OnClick(char* lpszPictureName, char* lpszObjectName, char*
lpszPropertyName)
{
#pragma code ("user32.DLL");
HWND FindWindow(LPCTSTR lpClassName, LPCTSTR lpWindowName);
BOOL BringWindowToTop(HWND hWnd);
#pragma code();
#pragma code ("check.DLL");
int CheckVersion();
#pragma code();
int val = CheckVersion();
if (val == -1)
{
// nicht registriert
}
else
{
// registriert
#define PIC_1 "Bild_1.pdl"
SSMChangeWorkField(SSMGetScreen(lpszPictureName),PIC_1,TRUE);
}
}
On my customer PC my Code works fine to, but my window of the DLL is not on
top, but it has to.
Now i thought about how to force my form to be on top. So i use
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(WM_KILLFOCUS, TMessage, OnKillFocus)
END_MESSAGE_MAP(TForm)
and
void __fastcall TForm1::OnKillFocus(TMessage& Msg)
{
Sleep(500);
SetForegroundWindow(Handle);
BringWindowToTop(Handle);
}
But when I compile my dll now, i get warning: (translated to english)
W8027 Functions, which includes switch, will not be expand as inline
As is try to use my dll now it does not work.
Does anybody have any idea what to do, that my form is really on top?
Mike
Technical Details
Message-ID:
<3ee30abc@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,937603d7f68e8363,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-06-08 03:20:57 PST From: "Mike" <mike@joylimsli.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: force a form to be on top Date: Sun, 8 Jun 2003 12:06:50 +0200 Lines: 76 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 213.7.124.53 Message-ID: <3ee30abc@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1055066812 213.7.124.53 (8 Jun 2003 03:06:52 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail