Next automation question: keeping my app active

When I execute a go-to-slide operation via PowerPoint automation, the PowerPoint
presenation pops to the top (desirable) and becomes the active app (undesirable).  I've
tried all of the tricks I know of to try to get focus back to my app and keep it active,
but none of them seem to work because PowerPoint is off *becoming* active; when it finally
gets around to activating, it steals focus from me.  Short of something grotesque, like a
timer polling for deactivation and forcing reactivation, I'm stuck.  Any automation gurus
have an idea of a better way to handle this?
				thanks
				joe
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
1/4/2008 7:43:00 AM
vc.mfc 33608 articles. 0 followers. Follow

8 Replies
570 Views

Similar Articles

[PageSpeed] 34

"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:iljrn35sub91i7hda5puqaeis03fbgugam@4ax.com...
> When I execute a go-to-slide operation via PowerPoint automation, the 
> PowerPoint
> presenation pops to the top (desirable) and becomes the active app 
> (undesirable).  I've
> tried all of the tricks I know of to try to get focus back to my app and 
> keep it active,
> but none of them seem to work because PowerPoint is off *becoming* active; 
> when it finally
> gets around to activating, it steals focus from me.  Short of something 
> grotesque, like a
> timer polling for deactivation and forcing reactivation, I'm stuck.  Any 
> automation gurus
> have an idea of a better way to handle this?

I don't think it's a question of automation.  Automation merely causes an 
app to execute one of its commands.  You could achieve the same effect by 
launching the app with a specified command-line.  So the question is how to 
prevent PowerPoint from doing a BringWindowToTop() and SetForegroundWindow() 
on itself when it executes the Goto slide command.  I don't think you can 
affect how it processes that command, so you are stuck.  (Well, I suppose 
you could use API hooking to prevent those API's from having an effect 
within PowerPoint, but that is a lot of effort for this little behavior 
change.)

OTOH, there is the Foreground Lock Timeout which you can set to non-zero 
using SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, ...).  This will 
probably prevent Powerpoint from both coming to the top (which is a desired 
behavior, so you have to deal with this some other means) and grabbing the 
focus (good).  You can always call BringWindowToTop() on the PowerPoint 
window yourself.  But this only prevents stealing the focus if user has 
typed or clicked mouse within the past n milliseconds.

Since this should be a user-settable option (although Windows does not have 
a UI except in TweakUI, not available for Vista, to set this), you should 
remember and then set it back to the previous setting when your program is 
done.  I believe this causes the screen to blink as the INIUPDATECHANGED is 
processed by the shell, somewhat undesireable.  (But since even Yahoo 
Messenger did, or used to do, this, it seems quite common).

BTW, all this indicates just how hard it is to provide the user with a 
seemless experience when combining two different apps together.  It's too 
bad you just can't have a PowerPoint ActiveX control in your app!

-- David


0
dc2983 (3206)
1/4/2008 1:50:29 PM
Yes, the problem is detecting when PowerPoint has made itself active so I can wrest
control back from it.  Given this is a response to an "incremental search", I know that
the typing has just occurred, so I'll look into that foreground lock technique.

I really didn't want to get into being a document container.  Besides having no space in
the app to do this (it is a large app with lots of controls and displays of data), this
would lead to a massive time sink...

				thanks
				joe

On Fri, 4 Jan 2008 05:50:29 -0800, "David Ching" <dc@remove-this.dcsoft.com> wrote:

>"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
>news:iljrn35sub91i7hda5puqaeis03fbgugam@4ax.com...
>> When I execute a go-to-slide operation via PowerPoint automation, the 
>> PowerPoint
>> presenation pops to the top (desirable) and becomes the active app 
>> (undesirable).  I've
>> tried all of the tricks I know of to try to get focus back to my app and 
>> keep it active,
>> but none of them seem to work because PowerPoint is off *becoming* active; 
>> when it finally
>> gets around to activating, it steals focus from me.  Short of something 
>> grotesque, like a
>> timer polling for deactivation and forcing reactivation, I'm stuck.  Any 
>> automation gurus
>> have an idea of a better way to handle this?
>
>I don't think it's a question of automation.  Automation merely causes an 
>app to execute one of its commands.  You could achieve the same effect by 
>launching the app with a specified command-line.  So the question is how to 
>prevent PowerPoint from doing a BringWindowToTop() and SetForegroundWindow() 
>on itself when it executes the Goto slide command.  I don't think you can 
>affect how it processes that command, so you are stuck.  (Well, I suppose 
>you could use API hooking to prevent those API's from having an effect 
>within PowerPoint, but that is a lot of effort for this little behavior 
>change.)
>
>OTOH, there is the Foreground Lock Timeout which you can set to non-zero 
>using SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, ...).  This will 
>probably prevent Powerpoint from both coming to the top (which is a desired 
>behavior, so you have to deal with this some other means) and grabbing the 
>focus (good).  You can always call BringWindowToTop() on the PowerPoint 
>window yourself.  But this only prevents stealing the focus if user has 
>typed or clicked mouse within the past n milliseconds.
>
>Since this should be a user-settable option (although Windows does not have 
>a UI except in TweakUI, not available for Vista, to set this), you should 
>remember and then set it back to the previous setting when your program is 
>done.  I believe this causes the screen to blink as the INIUPDATECHANGED is 
>processed by the shell, somewhat undesireable.  (But since even Yahoo 
>Messenger did, or used to do, this, it seems quite common).
>
>BTW, all this indicates just how hard it is to provide the user with a 
>seemless experience when combining two different apps together.  It's too 
>bad you just can't have a PowerPoint ActiveX control in your app!
>
>-- David
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
1/4/2008 3:18:55 PM
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:jbjsn3hlbm9pj45qlr1qko6dep10r0lfom@4ax.com...
> Yes, the problem is detecting when PowerPoint has made itself active so I 
> can wrest
> control back from it.  Given this is a response to an "incremental 
> search", I know that
> the typing has just occurred, so I'll look into that foreground lock 
> technique.
>

The foreground lock will prevent PowerPoint from activating itself in the 
first place.

-- David 


0
dc2983 (3206)
1/4/2008 3:37:31 PM
>The foreground lock will prevent PowerPoint from activating itself in the 
>first place.

Maybe!

MS apps are pretty possessive about getting the limelight ;)

Dave
0
davidl7375 (2060)
1/4/2008 5:10:57 PM
"David Lowndes" <DavidL@example.invalid> wrote in message 
news:83qsn3504bdoq7hjlch74mce4q126m2gci@4ax.com...
> >The foreground lock will prevent PowerPoint from activating itself in the
>>first place.
>
> Maybe!
>
> MS apps are pretty possessive about getting the limelight ;)
>

Yeah, even the Windows OS team is sick of it so they invent new ways of 
preventing apps from stealing the focus, but of course the Windows Apps team 
circumvents their own company!  ;)

-- David 


0
dc2983 (3206)
1/4/2008 5:26:32 PM
Behold the battle of the giants!

"David Ching" <dc@remove-this.dcsoft.com> wrote in message 
news:yZtfj.5840$lo5.805@newssvr19.news.prodigy.net...
> "David Lowndes" <DavidL@example.invalid> wrote in message 
> news:83qsn3504bdoq7hjlch74mce4q126m2gci@4ax.com...
>> >The foreground lock will prevent PowerPoint from activating itself in 
>> >the
>>>first place.
>>
>> Maybe!
>>
>> MS apps are pretty possessive about getting the limelight ;)
>>
>
> Yeah, even the Windows OS team is sick of it so they invent new ways of 
> preventing apps from stealing the focus, but of course the Windows Apps 
> team circumvents their own company!  ;)
>
> -- David
> 


0
alegr (1131)
1/5/2008 4:28:31 AM
Install VMWare and let it steal the focus of a separate VM partition
while your app blissfully monopolizes the focus of its own VM
partition.

On Fri, 04 Jan 2008 02:43:00 -0500, Joseph M. Newcomer
<newcomer@flounder.com> wrote:

>When I execute a go-to-slide operation via PowerPoint automation, the PowerPoint
>presenation pops to the top (desirable) and becomes the active app (undesirable).  I've
>tried all of the tricks I know of to try to get focus back to my app and keep it active,
>but none of them seem to work because PowerPoint is off *becoming* active; when it finally
>gets around to activating, it steals focus from me.  Short of something grotesque, like a
>timer polling for deactivation and forcing reactivation, I'm stuck.  Any automation gurus
>have an idea of a better way to handle this?
>				thanks
>				joe
>Joseph M. Newcomer [MVP]
>email: newcomer@flounder.com
>Web: http://www.flounder.com
>MVP Tips: http://www.flounder.com/mvp_tips.htm
0
spamhater1 (35)
1/7/2008 8:03:43 PM
And how does this solve the problem of a program interacting with PowerPoint via the
automation interface?
					joe

On Mon, 07 Jan 2008 14:03:43 -0600, Geeky Badger <spamhater@superunlikelyurl.net> wrote:

>Install VMWare and let it steal the focus of a separate VM partition
>while your app blissfully monopolizes the focus of its own VM
>partition.
>
>On Fri, 04 Jan 2008 02:43:00 -0500, Joseph M. Newcomer
><newcomer@flounder.com> wrote:
>
>>When I execute a go-to-slide operation via PowerPoint automation, the PowerPoint
>>presenation pops to the top (desirable) and becomes the active app (undesirable).  I've
>>tried all of the tricks I know of to try to get focus back to my app and keep it active,
>>but none of them seem to work because PowerPoint is off *becoming* active; when it finally
>>gets around to activating, it steals focus from me.  Short of something grotesque, like a
>>timer polling for deactivation and forcing reactivation, I'm stuck.  Any automation gurus
>>have an idea of a better way to handle this?
>>				thanks
>>				joe
>>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 (15974)
1/7/2008 8:23:36 PM
Reply:

Similar Artilces:

Automated Attendance Sheets
Hi, I had posted this question a few days ago, and Dave P. replied on Oct 05 2004. let me rephrase the question. A master sheet contains data for all employees shift details for all days of the month . The sheet looks something like this Name 01/10/04 02/10/04 03/10/04 04/10/04 05/10/04 06/10/04 ..... a D N D N D O b N N O D D D .. .. .. What I'd like Excel to do is this: 1. A menu which asks...

How do I keep Outlook from automatically downloading email
I want to open outlook but not have it automatically go and get my email until I tell it to. What version of Outlook are you using? In OL2002 & OL2003 you can control that here: Tools menu > Send/Receive > Send/Receive Settings > Define Send/Receive Groups "Marseldad" <Marseldad@discussions.microsoft.com> wrote in message news:4CA6667C-D50A-4CE1-9E9E-6E8587468C4E@microsoft.com... >I want to open outlook but not have it automatically go and get my email > until I tell it to. Maybe go to 'file', then 'work off line'? Then you have to ...

Blocking Automatic Forward Question - E2K
Hi everyone, I need to stop my users from automatically forwarding mail to external accounts. I know how to do this but need to check some of the specifics: * What is the route of the email? Is there an NDR back to the user? * Does this add to the work that E2K box does? * If they have Inbox Assistants forwarding to internal recipients are those blocked as well? Many thanks in advance, Kou ...

More Flexibility in Customizing the Activity Entity
Currently the activity entity does not allow new attributes to be created, or data to be mapped from other calling entities. Specifically, if an activity is created for a case or opportunity, the contact and/or account associated with that case or opportunity can not be displayed in the Activities view. The activity entity should not be confused with the Task, Phone Call, Fax, Appointment and other specific activity entites. These are quite flexible. What I am requesting is what appears in the Activities view. ---------------- This post is a suggestion for Microsoft, and Microsoft re...

What happens to activities (v3)
When I disqualify a lead or "lose" an opportunity, what happens to the open activities tied to those entities? Are they also closed/cancelled? If not, is there a way to automatically clean them up? Thank you! Jon ------=_NextPart_0001_0DC9037D Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi Jon, Thanks a lot for the post. For both Leads and Opportunities the process is similar. The Activities associated with a Lead will remain in the Owner's Activity List as long as the Lead is in a "Closed" status. A Lead that has been Converted as Disqualif...

Question About Importing Columns From A Datasheet to A Worksheet
I am asking for any help you can give me regarding the best way to import columns from a datasheet into another worksheet. I have many worksheets to construct but I will need to include only a few select columns from the datasheet on each worksheet. Each worksheet will include a different assortment of columns. It is my goal to only continuously update the datasheet information, so all the changes will carry over to all the worksheets without me having to manually update every sheet. I know how to do this function per cell, but I cant figure out how to do it by column. Please...

Simple if question??
Hello all, I'm looking for a simple if function that says basically: IF C39 is greater than B39 then B39-C39... if however B39 is greater than C39 then C39-B39 I'm sure its a fairly simple one but I'm lost. Any and all help greatly appreciated! Thanks! What if they are equal? Try this: =MIN(B39:C39)-MAX(B39:C39) -- Biff Microsoft Excel MVP "Shhhh" <trumpet1120@comcast.net> wrote in message news:f206df49-5e27-45d9-aa4f-1434f4dff531@c58g2000hsc.googlegroups.com... > Hello all, > > I'm looking for a simple if function that says basically: >...

MFC app has only one windows proc?
Hi Experts: I have a few questions on a typical MFC application: 1. Is it true that an MFC app has only one Windows procedure which hadles all windows (UI) of the application? 2. What if there is model dialog or modeless diaglog in the application? 3. If there is a UI thread, will the UI thread have a Windows procdure for itself? Thanks in advance! Polaris On Wed, 4 Apr 2007 09:55:39 -0700, "Polaris" <etpolaris@hotmail.com> wrote: >Hi Experts: > >I have a few questions on a typical MFC application: > >1. Is it true that an MFC app has only one Windows ...

Keeping POP3 mail from disappearing
I have my Outlook set up to receive my web-based email, however once it hits the inbox, it instantly disappears and doesn't stay in the inbox ...

Security Roles question
Hi there! I ' m having a problem finding the meaning of defining the access level "User" in the "Create" priviledge. What does this mean? How does this affect the security roles? Thanks, Elena It means the Create privilege applies only to records owned by the user (access level = scope) Peter "SiEBEN Innovative Solutions" <newsgroup@sieben.gr> wrote in message news:uFC0RXILEHA.988@TK2MSFTNGP11.phx.gbl... > Hi there! > I ' m having a problem finding the meaning of defining the access level > "User" in the "Create" p...

How to activate email hyperlinks
I have a huge list of email address that are not active hyperlinks. I would like to activate them without having to do it one by one. I've trying several formula's, macros, adding mailto, etc. but nothing is working. Any thoughts? Search for 'MakeEmailLinks' on David McRitchie's WebPage. http://www.mvps.org/dmcritchie/excel/buildtoc.htm HTH Paul -------------------------------------------------------------------------------------------------------------- Be advised to back up your WorkBook before attempting to make changes. ---------------------------------------...

Can not open Headquarters Manager keeps asking for the dongle.
Can not open Headquarters Manager keeps asking for the dongle, using the evaluation CDs. Is this a new install of the Eval, or have you been running it for a while? The Evaluation is designed to expire after a certain period ( can't remember if it's 45, 60 or 90 days for HQ). If you have been evaluating the product but need to continue for a longer test period, you can do so by creating a new database using HQ Administrator. If you just installed the Eval and are getting this message from the beginning, it's because the Eval CDs have sample databases with a builtin expira...

Blank Cell if next cell value is 0
Hello: Please help me with this one: I like to have these cells: A1: Blue A2: 0 A3: Red A4: 1 A5: Green A6: 0 A7: Yellow A8: 7 convert to these: A1: A2: 0 A3: Red A4: 1 A5: A6: 0 A7: Yellow A8: 7 (if A2 value is 0 (zero), A1 should be blank and so on... Thanks in advance. Dervish Hi do you want a macro solution for this? or would be an output an an adjancent column be sufficient? -- Regards Frank Kabel Frankfurt, Germany "Dervish" <dervishme@comcast.net> schrieb im Newsbeitrag news:400aa860.0410281053.2aa1e388@posting.google.com... > Hello: > > Please help m...

MFC Gui Apps
I am writing a GUI intensive program using MFC and unmanaged code. Someone told me that VB is a better option to write GUI Apps. Is it a good idea to learn VB just for this purpose? Or are there any tools available to expedite the GUI making process using MFC? Thanks. Jessica On Sun, 25 Dec 2005 01:11:53 GMT, Jessica Weiner wrote: > I am writing a GUI intensive program using MFC and unmanaged code. Someone > told me that VB is a better option to write GUI Apps. Is it a good idea to > learn VB just for this purpose? Or are there any tools available to expedite > the GUI ...

For Each Next help
Here is my code. Dim C As Range For Each C In Range("TotalsCells").Resize(1, 0) -----IT FAILS AT THIS LINE Cells.FormulaR1C1 = "SUM(R2C:R[-1]C)" Next C I have a couple of questions. Is my variable declaration correct? I want to inspect each cell in the range. Is my Resize syntax correct for inspecting each cell? Is my Sum syntax correct? Thanks in advance for your help. On Wed, 8 Oct 2008 10:06:18 -0700 (PDT), troy_lee@comcast.net wrote: >Here is my code. > >Dim C As Range > For Each C In Range("TotalsCells"...

de-activate microsoft office 2003 professional
anyone knows how to de-activate a microsoft office 2003 professional, and then reinstall it to a new computer? "ericchong" <ericchong@discussions.microsoft.com> wrote in message news:636D39E0-878F-4258-81B5-EB25B7D91205@microsoft.com... > anyone knows how to de-activate a microsoft office 2003 professional, and > then reinstall it to a new computer? There IS no "deactivation" process. Just uninstall from the old (as long as it's NOT an OEM version in which case you can't move it) and install on the new...depending on how long it's be...

Search / Replace Expressions Question
I am trying to replace spaces with tabs where the format is something like 12.2121 19.2141 12.2121 19.2141 and I can't just search on 5 spaces and replace with tab because there are other occurences of multiple spaces in the document so I need to pattern match. I got this far [0-9] [0-9][0-9].[0-9] but am not sure what to put in replace. I was hoping [0-9]^t[0-9][0-9].[0-9] meaning keep what was there but use tab instead which doesn't work. Pretty sure there was a way to say ok now that you found the pattern, just replace (this) Any help apprec...

Tasks
Whne I configure my current view to "active tasks", it still shows tasks that are completed and crossed off as well as upcoming tasks. I thought that it only supposed to show tasks that are not yet complete. Any help here would be appreciated. ...

Auto-Check for Activities (sales process or worflow)?
Is there a way to set up a sales process or a workflow to scan for actions/activities that match a required Sales process action/activity? For instance, a sales person needs a specific type of documentation to complete a required activity in a specific sales process, the documentation arrives and an admin person simply enters/logs the document in an entity field (received, date/time field). The admin does not make any changes/entries other than this simply entry. Is there a way to set up CRM to "pick up" the admin's saved entry in the entity and subsequently complete a...

A searching question ---
Is there a way in ON or an add on that will let me search only on page titles?? For instance: I have a page with the title "hair cut" with all the phone numbers and hours of the shop. If I search for "hair" or "hair cut" I get every page with the word "hair". that's nice but only when i want it that way. I'd like to search for "hair" and just see one or two pages. I suspect that this is not possible but worth a shot. Bob Perry wrote: > Is there a way in ON or an add on that will let me search only on > page ti...

Keeping one part of a formula same, but change other cell ref?
How do I keep one part of a cell formula the same, but change the other referenced cell? Example: =sum(D2/D9) where D9 stays the same, but D2 will change to D3, D4, etc. First of all, the sum function is not necessary when you only have 2 cells that you divide =D2/$D$9 -- Regards, Peo Sjoblom "kwelp" <kwelp@discussions.microsoft.com> wrote in message news:BD9DFC19-FD17-4AE3-A575-61AB98353514@microsoft.com... > How do I keep one part of a cell formula the same, but change the other > referenced cell? Example: =sum(D2/D9) where D9 stays the same, but D2 >...

a question about software design
Thank you for your answer. I think that information with which we provided you wasn’t full. As following: 1.This is function design for a project, not simple program coding. 2.The project was designed to implement managing communication by VoIP between more than 2000 clients, as what telephone exchange machine do. So the designing system will not only send or receive some data from socket, but also the implement logic processing, communication information management, DIO control. And the latter is main and important. 3.To communicate between processes in network by using ...

CRM FQDN question
I have CRM installed on SBS 2003 Prem. In preparation for CRM Mobile 1.2 perquisites, I have configured the Web Site with an IP address and configured the certs. However when I try to access the site by IP or the FQDN I am prompted for authentication credentials and then the window disappears. Using the short name works as always. Anyone have any ideas what I could check or if maybe this is usual? Thanks in advance... Try going to "loader.aspx". If the loader page runs, it's something involved with "Trusted Sites". Make sure the FQDN is in the trusted s...

Basic Categorical Pie Chart Question
Dear Friends: I have a basic categorical data set which is based on expense categories for a personal budget for my students: E 10.00 T 30.00 C 80.00 O 40.00 F 20.00 E 10.00 I would like for them to highligh their data and make a pie chart so that same categories are lumped together. In the data set above, the "E" category should total $20, but when I insert the pie chart in the spreadsheet, it separates them as two different "E"s. If I am able to ask Excel to group same categories together and total, then I would like for the category labels and percentages to show on ...

refreshdisplay hook not activated by deleting entry???
I have a custom add-in that is triggered by the refreshdisplay hook. The add-in applies a discount to an accessory if there is also a phone on the transaction entry screen. This add-in works great as items are added to the screen, however it is not triggered when an item is deleted off the screen. The problem this causes is that someone can place a phone on the transaction, then add an accessory and since the phone is there, the accessory is discounted, then they can delete the phone off the transaction, and the accessory stays at its discounted price. is there a better way to trigg...