Board index » cppbuilder » Topmost

Topmost


2003-10-28 02:56:54 AM
cppbuilder112
Hi !
I am trying to make my application Topmost. I thought it is easy, I only
need to get the window hwnd, which is not compilcated as i know my own
application form caption perfectly, and set it top most, but I am not
successfully. Here is the code, what I have at the moment :
//------------------------
HWND hwnd;
AnsiString form_caption = "";
form_caption = main_form->Caption;
hwnd = FindWindow(form_caption.c_str(),NULL);
SetWindowPos (hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
//------------------------
Thanks a lot in advance,
Moore
 
 

Re:Topmost

"D.Moore" < XXXX@XXXXX.COM >wrote in message
Quote
form_caption = main_form->Caption;

hwnd = FindWindow(form_caption.c_str(),NULL);
You do not need to use FindWindow() to find your own windows, you already
have direct access to their HWND via the Handle property:
SetWindowPos(main_form->Handle, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE|SWP_NOSIZE);
Gambit
 

Re:Topmost

THANK YOU, I did not know that, but it is working great !!
Moore
 

{smallsort}