Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > [WinApi] How to raise program from background?

Reply
Thread Tools

[WinApi] How to raise program from background?

 
 
Szyk
Guest
Posts: n/a
 
      03-11-2011
Hi

I want to write text editor. So at the very begining I must send command
line parameters to running program in the case it is already running. I
do this by local socket. But I have problem with raising my app from
background to foreground and set focus on it. I write my app under
Windows 7 32bit and use Qt library. There are functions:
QWidget::raise() and QWidget::activateWindow() which should do what I
want, but they only cause blinking app icon on task bar. I asked about
this at Qt Centre, and they give me WinApi solution, but it does not
work in the case when program is NOT minimized.

How to raise my program from background to foreground with WinApi?


thanks
Szyk
 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      03-11-2011
On 3/11/2011 2:05 PM, Szyk wrote:
> I want to write text editor. [..] But I have problem with raising my app from
> background to foreground and set focus on it. I write my app under
> Windows 7 32bit and use Qt library. There are functions:
> QWidget::raise() and QWidget::activateWindow() which should do what I
> want, but they only cause blinking app icon on task bar. I asked about
> this at Qt Centre, and they give me WinApi solution, but it does not
> work in the case when program is NOT minimized.
>
> How to raise my program from background to foreground with WinApi?


People in a Windows programming newsgroup should know. Here we talk C++
language, not WinAPI, sorry.

V
--
I do not respond to top-posted replies, please don't ask
 
Reply With Quote
 
 
 
 
Alf P. Steinbach /Usenet
Guest
Posts: n/a
 
      03-11-2011
* Szyk, on 11.03.2011 20:05:
> Hi
>
> I want to write text editor. So at the very begining I must send command line
> parameters to running program in the case it is already running. I do this by
> local socket. But I have problem with raising my app from background to
> foreground and set focus on it. I write my app under Windows 7 32bit and use Qt
> library. There are functions: QWidget::raise() and QWidget::activateWindow()
> which should do what I want, but they only cause blinking app icon on task bar.
> I asked about this at Qt Centre, and they give me WinApi solution, but it does
> not work in the case when program is NOT minimized.
>
> How to raise my program from background to foreground with WinApi?


Please tell the group how you arrived at this question.

I have seen so many questions like this, always from someone anonymous. "how do
I display a *message box* using the Windows API?". There are many more ways to
do it than using the MessageBox API function, but the fact that the question
includes wording almost identical to the most well-known related API function,
makes it clear that somehow the question was constructed to arrive at a specific
single answer.

So, how/where did your such question originate?

Did you start with the name of the API function?

Or is this a homework question (where you teacher started with the API function)?

If, against all expection, it is a real question, then what prevented you from
googling or accessing your local documentation?

And, also in the case of real question, why do you think others should do the
documentation look-up for you, i.e. why is *your* time more valuable than ours?

And why are you posting in an off-topic newsgroup?



Cheers, and thanks in advance for answers to all of the above,

- Alf

--
blog at <url: http://alfps.wordpress.com>
 
Reply With Quote
 
Geoff
Guest
Posts: n/a
 
      03-12-2011
On Fri, 11 Mar 2011 20:05:53 +0100, Szyk <(E-Mail Removed)> wrote:

>
>How to raise my program from background to foreground with WinApi?


Question is OT for this group.

The answer is documented in the in the Windows API documentation that
comes with your development toolset.
 
Reply With Quote
 
Öö Tiib
Guest
Posts: n/a
 
      03-12-2011
On Mar 11, 10:58*pm, "Alf P. Steinbach /Usenet" <alf.p.steinbach
(E-Mail Removed)> wrote:
> * Szyk, on 11.03.2011 20:05:
>
> > Bla-blah, QT, bla-blah Windows 7.

>
> Please tell the group how you arrived at this question.


Oh, but it is Szyk, he is a spy master. He uses usenet to spread
encoded commands to his agents who are writing software for US
government. Reading comp.lang.c++ is not considered suspicious
activity of them. The questions sure look idiotic for real specialists
but have been very carefully crafted.
 
Reply With Quote
 
RaZiel
Guest
Posts: n/a
 
      03-12-2011
On 11.03.2011 20:05, Szyk wrote:
> Hi
>
> I want to write text editor. So at the very begining I must send command
> line parameters to running program in the case it is already running. I
> do this by local socket. But I have problem with raising my app from
> background to foreground and set focus on it. I write my app under
> Windows 7 32bit and use Qt library. There are functions:
> QWidget::raise() and QWidget::activateWindow() which should do what I
> want, but they only cause blinking app icon on task bar. I asked about
> this at Qt Centre, and they give me WinApi solution, but it does not
> work in the case when program is NOT minimized.
>
> How to raise my program from background to foreground with WinApi?
>
>
> thanks
> Szyk


You should realize the question is OT. But I'll give you a hint, since
the answer you're looking for is not common knowledge nor documented
anywhere in the API docs. Here it is: "Stealing focus" +
AttachThreadInput. Other solutions will not work on all 3 platforms (XP,
Vista, Win7). Good luck.

- RaZ
 
Reply With Quote
 
Geoff
Guest
Posts: n/a
 
      03-12-2011
On Sat, 12 Mar 2011 02:52:57 +0100, RaZiel <(E-Mail Removed)>
wrote:


>
>You should realize the question is OT. But I'll give you a hint, since
>the answer you're looking for is not common knowledge nor documented
>anywhere in the API docs. Here it is: "Stealing focus" +
>AttachThreadInput. Other solutions will not work on all 3 platforms (XP,
>Vista, Win7). Good luck.
>
>- RaZ


SetWindowPos, SetForegroundWindow; Windows 2000 and up.
 
Reply With Quote
 
RaZiel
Guest
Posts: n/a
 
      03-12-2011
On 12.03.2011 07:05, Geoff wrote:
> On Sat, 12 Mar 2011 02:52:57 +0100, RaZiel<(E-Mail Removed)>
> wrote:
>
>
>>
>> You should realize the question is OT. But I'll give you a hint, since
>> the answer you're looking for is not common knowledge nor documented
>> anywhere in the API docs. Here it is: "Stealing focus" +
>> AttachThreadInput. Other solutions will not work on all 3 platforms (XP,
>> Vista, Win7). Good luck.
>>
>> - RaZ

>
> SetWindowPos, SetForegroundWindow; Windows 2000 and up.


Incorrect. Won't work well on Vista and Win7. He wants to bring a window
from another process to the foreground.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Raise X or Raise X()? bvdp Python 10 03-12-2012 04:08 PM
"raise (type, value, traceback)" and "raise type, value, traceback" Jack Bates Python 0 05-02-2011 05:23 PM
raise Exception or raise Exception() ernest Python 2 11-14-2010 08:14 PM
raise or not to raise [Newbie] Jacol Python 5 02-05-2007 11:46 PM



Advertisments