|
hi,
I want to bring inactive application to foregound. I used setforegoundwindow but when i searched in the web i found it works upto windows nt. Then i tried to get the process id and used AllowSetForegroundWindow. but this is giving compilcation erros. I am using windows 2003.
Sny help is appreciated
|
|
|
|
|
Hi,
try using
SetForeGroundWindow then call SetActiveWindow
|
|
|
|
|
SetForegroundWindow works with NT 3.1 and later which includes Windows 2003 (NT 5.2).
|
|
|
|
|
Hi,
This is the code snippet
HWND aWnd =FindWindow ("Wmak Class",NULL);
BOOL atest =SetForegroundWindow(aWnd);
FindWindow is returning a valid handle but SetForegroundWindow is returning zero.
What's wrong with the code
Regards
|
|
|
|
|
The problem might be this:
(from the SetForegroundWindow() documentation)
Windows NT 5.0 and later: An application cannot force a window to the foreground while the user is working with another window. Instead, SetForegroundWindow will activate the window (see SetActiveWindow) and call the FlashWindowEx function to notify the user.
|
|
|
|
|
Thanks for your reply. The problem could be as you said. Is there any other alternate to bring inactive window to active window while working with another app?
Regards
|
|
|
|
|
I actually turn off this flashing setting in Windows so I never experienced this problem.
Try to google, there should be a solution out there.
|
|
|
|
|
venkat.kupunaram wrote: I want to bring inactive application to foregound. I
Does this help -> http://www.codeproject.com/KB/dialog/dlgboxtricks.aspx[^]
Look at the section -> How to steal focus on 2K/XP. There is a hidden bug corrected by one of the forum members.
Here is the correct one!
DWORD ForeGroundID = GetWindowThreadProcessId(::GetForegroundWindow(),NULL);
DWORD CurrentID = GetCurrentThreadId();
AttachThreadInput ( ForeGroundID, CurrentID, TRUE );
SetForegroundWindow();
SetFocus();
AttachThreadInput ( ForeGroundID, CurrentID, FALSE );
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
modified on Thursday, May 8, 2008 6:57 AM
|
|
|
|
|
Hi,
I am working on two applications. I want to get the handle of the inactive window. As i cannot get the handle of inactive window i am using setforegroundwindow. But in your solution how to get the hwnd parameter which i have to pass to setforegoundwindow and setfocus. I wrote the code like this. But it is not working as i am not able to get the hwnd paramter.
DWORD ForeGroundID = GetWindowThreadProcessId(::FindWindow ("Wmak Class",NULL),NULL);
DWORD CurrentID = GetCurrentThreadId();
AttachThreadInput ( ForeGroundID, CurrentID, TRUE );//Do our stuff here
BOOL btest =SetForegroundWindow(hWnd);
SetFocus(hWnd); //Just playing safe//Detach the attached thread
AttachThreadInput ( ForeGroundID, CurrentID, FALSE );
Regards
|
|
|
|
|
Dear developers,
I'm using the Testrunner which is delivered with the package of Cppunit (Version: 1.12.1).
All works fine, but I get memory leaks reported by the debugger after closing the test-application.
It seems that macros as "CPPUNIT_REGISTRY_ADD_TO_..." create some instances in background which are not cleaned up later.
Does somebody have some experience with this problem?
Kind regards
|
|
|
|
|
Hi all,
I want to get hard drive manufacturer name and slot information
whether it is primary master-slave or secondary master-slave using VC+
+.
I am trying to get these details by using win32_diskdrive class(WMI
classes). As there is one property of this class ie "manufacturer"
that give the name of hard drive manufacturer name. But when I execute
my program it gives "standard disk drive" instead of giving "seagate",
"samsung" or whatever it is.
Is there any setting that i am missing?
I am using windows XP Professional and visual studio 2005.
If there is any win32 api that can give me these information, Please
provide me the name of these api.
Please provide me some guideline.
Thanks in advance.
|
|
|
|
|
Since it is urgent, I suggest you a screwdriver.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Good joke....
Every one has the right to express views... Dont mind.
|
|
|
|
|
Except the RULES OF THE FORUM say not to use 'urgent' in your title or message. Not to mention this is the second time you have asked this question!!!!
|
|
|
|
|
I had to adjust the troll's vote, my friend.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Dear sir could you please provide me the solution of my problem.
|
|
|
|
|
Hi Madan,
I don't answer urgent queries. Just let me know if I can take my own time. I will write back to you if I find a solution then.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Thanks sir, I will wait for your reply.
|
|
|
|
|
Thanks.
BTW plz plz plz help urgent the OP.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I just got to work and already I'm filling up with more names.
|
|
|
|
|
Wow, 3:27 PM here!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
So you already know how my day went. How was it?
|
|
|
|
|
Slow and sunny.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
You're probably right although there is a chance of rain. The PM meeting for product launch is probably not going to go well.
|
|
|
|
|
Good luck.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|