Where to call SetWindowPos

In my SDI, can I place the following in CMainFrame::OnCreate( )? Or is there 
a better place?

 // ensure window opens on top when called by other applications, esp. the 
installer
 SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); 


0
srussell2458 (497)
8/11/2007 9:04:00 PM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
1538 Views

Similar Articles

[PageSpeed] 24

Note that wndTopMost really means it is always on top and can never have another app come
on top of it.  So wndTopMost is often a poor choice.  SetWindowPos would not be the best
choice here; SetForegroundWindow would be better.
					joe

On Sat, 11 Aug 2007 17:04:00 -0400, "SteveR" <srussell@removethisinnernet.net> wrote:

>In my SDI, can I place the following in CMainFrame::OnCreate( )? Or is there 
>a better place?
>
> // ensure window opens on top when called by other applications, esp. the 
>installer
> SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); 
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
8/12/2007 4:17:37 AM
I forgot to add the &wndTop would be the reasonable alternative.

For example, I use &wndTopMost to make sure my cat-watching-the-mouse app always stays on
top no matter what app is actually active, and my minimized clock always stays on top.
Task manager uses this to stay on top.  But it should be used with caution, because the
window will then be permanently on top, even if it is not active.
					joe
On Sat, 11 Aug 2007 17:04:00 -0400, "SteveR" <srussell@removethisinnernet.net> wrote:

>In my SDI, can I place the following in CMainFrame::OnCreate( )? Or is there 
>a better place?
>
> // ensure window opens on top when called by other applications, esp. the 
>installer
> SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); 
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
8/12/2007 4:19:29 AM
I typically use topmost for things I really want the user to see regardless. 
It is annoying, but there are times when you want to be annoying (like 
something goes wrong with a server and you want to alert the user).  I would 
only use this with a dialog they would close by clicking a button after 
seeing the alert or warning.

I don't know why, but I alway have to call SetForegroundWindow() and 
BringWindowToTop() together to get a dialog to pop to the top.  I do this 
all the time with modeless windows that get stranded behind other windows 
that started later.  If the user presses the toolbar button to "see" the 
original window, you can just pop it to the top again (since it's really 
still open, just under something else).

I think making an application's mainframe topmost (like Task Manager does) 
is annoying and I would never do it to any of my users.

Tom

"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:3d2tb31olh9festofnls93li1vcadqbrn9@4ax.com...
> Note that wndTopMost really means it is always on top and can never have 
> another app come
> on top of it.  So wndTopMost is often a poor choice.  SetWindowPos would 
> not be the best
> choice here; SetForegroundWindow would be better.
> joe
>
> On Sat, 11 Aug 2007 17:04:00 -0400, "SteveR" 
> <srussell@removethisinnernet.net> wrote:
>
>>In my SDI, can I place the following in CMainFrame::OnCreate( )? Or is 
>>there
>>a better place?
>>
>> // ensure window opens on top when called by other applications, esp. the
>>installer
>> SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
>>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm 

0
tom.nospam (3240)
8/12/2007 5:48:40 AM
Thanks, Tom and Joe.  I have also studied your comments in a similar thread.

This call is not keeping my application on top at all times.  I've never 
been sure of its effect; but the primary intent is to get it on top when 
launched from the installer, which seems to be successful.
------------
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:8f2tb3l0sv7f6o9l2td03kseafdgicur66@4ax.com...
>I forgot to add the &wndTop would be the reasonable alternative.
>
> For example, I use &wndTopMost to make sure my cat-watching-the-mouse app 
> always stays on
> top no matter what app is actually active, and my minimized clock always 
> stays on top.
> Task manager uses this to stay on top.  But it should be used with 
> caution, because the
> window will then be permanently on top, even if it is not active.
> joe
> On Sat, 11 Aug 2007 17:04:00 -0400, "SteveR" 
> <srussell@removethisinnernet.net> wrote:
>
>>In my SDI, can I place the following in CMainFrame::OnCreate( )? Or is 
>>there
>>a better place?
>>
>> // ensure window opens on top when called by other applications, esp. the
>>installer
>> SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
>>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm 


0
srussell2458 (497)
8/12/2007 12:22:24 PM
But I did go ahead and switch to SetForegroundWindow().  Thanks again.
------------------
"SteveR" <srussell@removethisinnernet.net> wrote in message 
news:up377sN3HHA.5424@TK2MSFTNGP02.phx.gbl...
> Thanks, Tom and Joe.  I have also studied your comments in a similar 
> thread.
>
> This call is not keeping my application on top at all times.  I've never 
> been sure of its effect; but the primary intent is to get it on top when 
> launched from the installer, which seems to be successful.
> ------------
> "Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
> news:8f2tb3l0sv7f6o9l2td03kseafdgicur66@4ax.com...
>>I forgot to add the &wndTop would be the reasonable alternative.
>>
>> For example, I use &wndTopMost to make sure my cat-watching-the-mouse app 
>> always stays on
>> top no matter what app is actually active, and my minimized clock always 
>> stays on top.
>> Task manager uses this to stay on top.  But it should be used with 
>> caution, because the
>> window will then be permanently on top, even if it is not active.
>> joe
>> On Sat, 11 Aug 2007 17:04:00 -0400, "SteveR" 
>> <srussell@removethisinnernet.net> wrote:
>>
>>>In my SDI, can I place the following in CMainFrame::OnCreate( )? Or is 
>>>there
>>>a better place?
>>>
>>> // ensure window opens on top when called by other applications, esp. 
>>> the
>>>installer
>>> SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
>>>
>> Joseph M. Newcomer [MVP]
>> email: newcomer@flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>
> 


0
srussell2458 (497)
8/12/2007 12:31:09 PM
I use it for the same purposes.  Typically I do this when the window or dialog is small,
and therefore can be moved out of the way if required.
					joe

On Sat, 11 Aug 2007 22:48:40 -0700, "Tom Serface" <tom.nospam@camaswood.com> wrote:

>I typically use topmost for things I really want the user to see regardless. 
>It is annoying, but there are times when you want to be annoying (like 
>something goes wrong with a server and you want to alert the user).  I would 
>only use this with a dialog they would close by clicking a button after 
>seeing the alert or warning.
>
>I don't know why, but I alway have to call SetForegroundWindow() and 
>BringWindowToTop() together to get a dialog to pop to the top.  I do this 
>all the time with modeless windows that get stranded behind other windows 
>that started later.  If the user presses the toolbar button to "see" the 
>original window, you can just pop it to the top again (since it's really 
>still open, just under something else).
>
>I think making an application's mainframe topmost (like Task Manager does) 
>is annoying and I would never do it to any of my users.
>
>Tom
>
>"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
>news:3d2tb31olh9festofnls93li1vcadqbrn9@4ax.com...
>> Note that wndTopMost really means it is always on top and can never have 
>> another app come
>> on top of it.  So wndTopMost is often a poor choice.  SetWindowPos would 
>> not be the best
>> choice here; SetForegroundWindow would be better.
>> joe
>>
>> On Sat, 11 Aug 2007 17:04:00 -0400, "SteveR" 
>> <srussell@removethisinnernet.net> wrote:
>>
>>>In my SDI, can I place the following in CMainFrame::OnCreate( )? Or is 
>>>there
>>>a better place?
>>>
>>> // ensure window opens on top when called by other applications, esp. the
>>>installer
>>> SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
>>>
>> Joseph M. Newcomer [MVP]
>> email: newcomer@flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm 
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
8/12/2007 6:41:13 PM
Reply:

Similar Artilces:

Phone calls from my modem
I've asked this question before but have lost the answer. On my last phone bill, i was charged for two calls to Chile which I queried with BT. They tell me that the number is a data line which has been accessed from my modem using international dialling which terminates the call to my ISP and connects via the international number. How do i protect against this happening again? Many thanks ...

Integrate Ericsson Call Center Client into Microsoft CRM 3.0
Hi! the call center client application have API in COM Object (build in C++), all the call features and fucntion can call from the API, i have no idea's on how to integrate this com object into the CRM Client so that when have an incoming service call, the CRM client will pop up the call case window and the user also able to answer or hang up the call from the CRM client interface. i have study the CRM SDK but still can find the solution. Appriciate can give me some clues to start. Thanks! ...

Who could tell me about LPC(Local Procedure Call) and provide some examples?
Hello all: Who could give me some documents about LPC(Local Procedure Call) and provide some examples?There are examples on server and client.Thanks very muvh. ...

Phone Call
Is there are way to change the Call Initiator on a batch of phone call activities? When Leads are reassigned the activities are reassigned but the Call Initiator field remains set to value of the phone call creator. ...

static object destructor not getting called
hi I have a static object in a file. For some reasons its destructor is not getting called, this object is supposed to free up the memory, and because of the destructor not getting called , visual studio reports all of them as memory leaks. I am using VS 2005. Any suggestions? Regards Chimanrao On 20 May 2007 21:12:50 -0700, Chimanrao <chimanrao@gmail.com> wrote: >I have a static object in a file. >For some reasons its destructor is not getting called, It seems strange. Static objects are deleted (so the destructor is called) when global variables are deallocated, so when t...

Covered calls etc.
Have they taught Money to handle downloads from your broker of items like covered calls and bull-put spreads etc. etc.? In microsoft.public.money, az-willie wrote: >Have they taught Money to handle downloads from your broker of items >like covered calls and bull-put spreads etc. etc.? No. Cal Learner-- MVP wrote: >In microsoft.public.money, az-willie wrote: > > > >>Have they taught Money to handle downloads from your broker of items >>like covered calls and bull-put spreads etc. etc.? >> >> > >No. > > ======= Quicken 2004 d...

Call in?
Do new owners of Office X have to call up Microsoft to register their copy? If yes, what's the number? thanks. Ming <asdf@asdf.com> wrote: > Do new owners of Office X have to call up Microsoft to register their > copy? If yes, what's the number? thanks. Nope. We're not using Windoze :->>> This version does not require activation. Corentin -- - Mac:MS MVP (Francophone) - (MS) MVP: http://support.microsoft.com/default.aspx?ln=FR&scid=fh;FR;mvp Newsgroups produits MS: http://support.microsoft.com/newsgroups/?ln=FR ...

Calling a webservice with parameter from contacts
Hi, I would like to call a webservice when i am in a contact form (I made an icon in the left bar to launch it) ; my problem is to get an information from the form to be verified in the webservice : how can i pass the parameters? (I am not yet a great developper in .net...) Thanks for your help this line of course in C# will get you the id of the object calling the code string id=Request.Params["oId"]; -- John O'Donnell Microsoft CRM MVP http://www.microsoft.com/BusinessSolutions/Community/CRMFaqLanding.aspx "B. Guillout" <BGuillout@discussions.microsoft.com&...

Telephone number for Telefonica Windows Live Call
Hi. Having trouble adding minutes to my account. Anyone have a phone number or e-mail for either Telefonica or Windows Live Call that I can contact for help? Thanks! Greetings, Supposedly, if you head over to: http://support.live.us.telefonica.com/?Country=US&Language=en Choose Payment and Balance Problems on the side, and then choose one of the "problems" listed, then choose " If you are still having trouble after the above steps, please Click Here ", you'll reach a form to assist. -- Jonathan Kay Microsoft MVP - Windows Live Messenger MSN Mes...

Initiate Phone Calls from CRM
Anyone know of an add-on that will enable CRM clients (browsers or SFO ideally) to click on a phone number or link button to initiate a phone call via a modem in local user's computer? Several clients ask for this - esp. whe nthey are dealing with long (international) numbers. Thanks Roger On Fri, 19 Aug 2005 09:22:32 +0100, "Roger" <roger_id@hotmail.com> wrote: >Anyone know of an add-on that will enable CRM clients (browsers or SFO >ideally) to click on a phone number or link button to initiate a phone call >via a modem in local user's computer? &...

FRX Report Launcher Error: 5 Invalid procedure call or argument
I am currently having an issue with receiving an error message when attempting to launch FRX Report Launcher. Error: 5 Invalid procedure call or argument. followed by OK FRx launcher will not Launch. I am able to launch FRx designer, and Drilldown viewer, just not launcher. The version of frx is 6.7.7032. We work in a citrix environment pointing back to a SQL server for Great Plains and FRx data. Any assistance would be appreciated as this is month end. -- Bonnie Pitchford Systems Accounting Manager Mercury Companies, Inc. There are multiple possibilities for an Error 5 Invalid p...

Passing value back to calling form (cntl) from popup
Hi all, I have a form that contains order info with subform (datasheet view) that contains order detail. In the itemname combo box of the subform the user can select the item name. The combo box rowsource is the itemsQ and the Control source is the ordersDtlQ (itemname) field. I have a field in itemsQ query called subcat which is a subcategory field . Here is what I am trying to do. When the user enters a new item in the table user can decide to make item a sub categoring of another record. The default subcat is the itemid if no subcat is assigned. Lets say the user selects "wrench"...

Does anyone have a call log to track calls?
We need to create a call log that would include date received, caller's name, address, phone number, type of problem/complaint, department that handled, date completed. We would like to be able to analyze the types of calls received and how efficiently they are handled. ...

JScript call preUpdate
Hi, anybody know how to call Jscript preUpdate method on onSave event and stop Update? This article on Ronald Lemmen's blog might be helpful: http://ronaldlemmen.blogspot.com/2008/03/stopping-and-continuing-save-event.html -- Matt Wittemann, CRM MVP http://icu-mscrm.blogspot.com "Mykhailo Medynskyi" wrote: > Hi, anybody know how to call Jscript preUpdate method on onSave event and > stop Update? Not sure if this answers your question, but you can stop the save operation in the OnSave event by setting event.returnValue = false follow by a return statement. -- M...

Econnect Service Call
Can anybody give me an example code for service call management Thanks in advance ...

Fix phone follow up of a phone call
A normal way of using phonecall activities according to my own experience is to create lots of them with a quick campaign. However, when a customer/lead is called they might often ask you to call back in a couple of months. This is where the "follow up" button is great. Just create a new phone call that is due a lot later and save it. One would think that since it is based on a old phone call, it will get the sender, reciever and phone number information automatically. It doesn't. Instead you get a phone call activity with no sender, reciever and an empty phone number fie...

Who do I call?
Sorry this is off topic, but the windows xp home edition cd i bought is all damaged and i cant use it. I have my Product key on that silver sticker thing. Does anyone know how can i contact Microsoft for a new cd? If you call MS support and give them the license key, they'll send you a new cd for a couple of bucks. HTH Frank "ilan`" <ilanbm@hotmail.com> wrote in message news:09ca01c35be7$a9f11d30$a101280a@phx.gbl... > Sorry this is off topic, but the windows xp home edition > cd i bought is all damaged and i cant use it. I have my > Product key on that sil...

How to call CreateInstance?
Hello! I need to call IClassFactory::CreateInstance to create a new IPersistMessage instance. In my MAPI form server exe code (I'm using MFC): Where do I get the IClassFactory pointer from? Eric I think this article may help you get started. It's a little dated, but still valid. http://www.pluralsight.com/articlecontent/cpprep0198.htm Tom "Eric" <bauersachs@kull.ch.cuthere.nospam.me.com> wrote in message news:O9Ff$KKQHHA.4364@TK2MSFTNGP03.phx.gbl... > Hello! I need to call IClassFactory::CreateInstance to create a new > IPersistMessage instance. In my...

Attn: Dave P. Question re Pix Calls via Macro
Dave, the solution you provided is working wonderfully...of course now I have to stretch the envelope again! I was wondering, if I have another cell on the same sheet where I want to put another set of graphics called via a VLOOKUP as before, what code do I put in the first sheet since I can't use the same VLOOKUP as the first one. I tried plugging the same code into sheet a second time, only specifying the second cell location & VLOOKUP code but it faults on the second "Worksheet_Calculation liine. You only get one of those worksheet_calculate events per worksheet. So ...

SetWaitableTimer/SetTimer call back is not getting called
I have created a worker thread using CreateThread() function. I created a Timer Event using CreateWaitableTimer. I set the timer event using SetWaitableTimer and I include a call back function to be called when the timer expired. However, I do not hit the call back function. Is there any special code I need to add for this? Here is the snippet from my code. void CreateSTEventsAndThreads() { DWORD IDThread; stThreadEvents[0] = CreateEvent(NULL, FALSE, FALSE, NULL); timerEvent = CreateWaitableTimer(NULL, FALSE, "WaitableTimer"); stThreadHandle = CreateThread(NULL, 0,...

Money 2003 Deluxe Call Progress
When I attempt to update prices on line, Money appears to get hung up. The call progress window says that it is updating securities but it stays on screen and nothing is downloaded. Even when I try to cancel the call, the window will not close. The only way for me to stop the call is for me to shut Money down using ctrl-alt-delete. This happens about 75% of the time that I try to update prices. I am connected through a cable modem. You're not alone Bill. It happens to me frequently as well. Prior to 2003 version, the update was fast. Once I installed the 2003 version, it seem...

API call to turn off monitor
I want to turn off the monitor from within my application through a WIN32 API call when a user presses a button. Is there any specific call(s) to do this? What this will do is set the timeout for the monitor to 1 second SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT,1,0,0); The tricky part would be setting it back to whatever it is set to once it comes back, or else it will keep turning off after 1 second. AliR. "George" <George@discussions.microsoft.com> wrote in message news:96F3E562-E18D-4EFE-8951-484B17BB1C44@microsoft.com... > I want to turn off the monitor from withi...

Distinguish help calls
On a dialog, how can I distinguish between the user pressing F1 and clicking on the context help question mark and then somewhere on my dialog. I would like F1 to bring up the main help system at the appropriate page and the question mark to bring up context help (floating yellow text). At present, pressing F1 lands in my OnHelpInfo method and I open the help system at the appropriate page. Pressing the question mark brings up the context help correctly, then lands in my OnHelpInfo method and I don't want to open the help system, but can't tell which event caused the trigger of ...

Phone Call Accepted by = Sender of Phone Call
Hi I have a workflow where a phone call is created when a new lead is entered and assigned to the leads queue. I want to have a workflow which puts the sender of the phone call = name of the person who accepts the phone call. How do i go about this. I am using crm 4.0. The person who makes the phone call could be different to the person who creates the lead therefore i want to capture the person who makes the phone call. I would really appreciate some help. Kind Regards Snow White ...

How to assign outbound calls to a group of people?
Hi NG, we would like to carry out an outbound call activity in CRM 4.0. A group of call agents ought to call e.g. 100 customers. Every agent picks a customer one after the other from a work list. After or during the call the agent sets a status like "closed", "follow-up" or "in process". This to avoid that a customer is called twice. We took a good look at the possibilities to do that with the phone call activity, marketing lists, quick campaigns and the queues. Above all we couldn't figure out how to assign a working list to a group of people that hav...