1. how to put window box to foreground? (there is no taskbar button).
2. I want to put wbox to foreground any time when parked mouse cursor on icon in systray.
Thomas Atwood
August 14th, 1999, 02:51 PM
Use SetForegroundWindow(hwnd);
(hwnd is the handle of the window you're moving to the foreground)
krba
August 15th, 1999, 02:15 AM
error C2660: 'SetForegroundWindow' : function does not take 1 parameters
Thomas Atwood
August 15th, 1999, 02:25 AM
Well if you're using mfc instead of win32, you call the function as
cwndclasspointer->SetForeGroundWindow();
or if you're using mfc and have a hwnd handle instead of a class pointer call it as
::SetForeGroundWindow(hwnd);
krba
August 15th, 1999, 04:40 AM
Tried, but without success.
OK, I'm going (still) working on it :) but, what I want: when clicked with LeftButton on icon (which is in Systray), I want to bring me window box up/top. (For case if something hide it/lay of it, well, you know...).
krba
August 15th, 1999, 04:41 AM
Oh, yes, I'm using MFC (dialog box).
krba
August 15th, 1999, 05:16 AM
I found two interesting fuctions:
One is window position, which is a little bit complicated, and the second, more interesting is
BringWindowToTop ().
But, something strange... header bar (this blue bar on top of the window) are still "grayed" - like some "activate" missing. I test this when the window is foreground.
If it is in background - well, it stays there :)
srini_raghav
August 15th, 1999, 07:18 AM
so, u have popped up a dialog when clicking on the systray icon on the systemtray. For this u whd. have captured the message which u whd. have specified in ur NOTIFYICONDATA structure...
While popping the dialog ur code will be like this
CSomeDialog dlg;
dlg.DoModal();
Okay
in the Initdialog of the CSomeDialog u include this line of code
SetForegroundWindow();
At later time when u click leftmousebutton on the icon and u want ur dialog popped already to be in the foreground, u should make the instance of the dialog as a member to the class in which u r capturing the leftmouseclick of icon and use that membervariable and call SetForegroundWindow()
This will solve ur problem...
Thanks lot,
Srini.
krba
August 15th, 1999, 10:41 AM
Wow-ouch...unfortunately I don't use NOTIFYICONDATA.
And now, you asked, for Gratious Sake, then what this man use :)
Well, the first, my intention is, of coarse only to put icon at SysTray. Then I'm searching, searching, and what find - only some pseudo examples. The "Beginner" category means nothing, as I saw. One, example, is near to be The Example, but this one made window box transparent and doesn't work quite well.
So, thanks to God, I exidently press ActiveX - and U know what - can U imagine, find TrayIconPrj.TrayIcon. (VC++ v5.0) - and when I choose that - icon apears in SysTray. This "project" also has mouse buttons - one click, doubleclicks, left, right, middle...So, only what I need was to made Menu and link, properties, what to do when the Exit is choosen (and I put there IDOK). Great! Stuffs works like baby.
But then, wait a minute, what will happend when my prgy be covered by another one (and U know, I turnoff toolbar button), how to bring this mine window up? So, the best way, seems to me is to make leftclick on the icon, which will pull window to front, top.
So, because my logical mechanisam is totally contra of (whole) Microsoft :) and this is because I want to know what I'm doing, it's however clear to me that I'm going to become patient, depender, too. Bla, bla, bla...
So, what I have now:
Only one class (I really don't know what is it, subprogram, what?) named ocdDlg[.cpp] and of coarse start prg "ocd.cpp".
And in ocdDlg.cpp there are key stuffs about what we are talking:
======================================================================================
// this one works correct
}
========================================================================================
What is interesting, when I put SetForegroundWindow(); and click on icon, (and my window is TOP to see it - this "blue ribbon" (header tray, where the name of window is, blinks severel times, (4 times, I think) between blue and gray, and parked to gray - no active.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.