Results 1 to 3 of 3

Thread: Running an application from PowerPoint

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    2

    Running an application from PowerPoint

    Hi,
    First, I am very much not a developer without any knowledge in VB...

    I need to run a small clock application from within a PowerPoint presentation.
    I have created a command button object in a PowerPoint slide. The code behind it is:

    VB Code:
    1. Private Sub Timer_Click()
    2. Shell "C:\Temp\timer.exe", 6
    3. End Sub

    This works well without a problem. However, if the timer.exe is set to be "always on top" then the timer window becomes the active window.
    I then need to click on the PowerPoint slide so it becomes active.

    How do I force that at all times the PowerPoint presentation is the active window, regardless of the application being run?

    Please advise what command should be added to the script so PowerPoint is always the active window.

    Thanks,
    --Spinacia

  2. #2
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Running an application from PowerPoint

    Hi Spinacia, Welcome to the Forum.

    Does this help:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
    4.  
    5. Private Sub Timer_Click()
    6.  
    7.     Shell "C:\Temp\timer.exe", vbNormalFocus
    8.  
    9.     SetForegroundWindow Me.hwnd
    10.  
    11. End Sub

    Additional info at allapi.net: http://www.mentalis.org/apilist/SetF...ndWindow.shtml
    Last edited by Bruce Fox; Dec 18th, 2005 at 09:53 PM.

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    2

    Re: Running an application from PowerPoint

    Thanks Bruce.
    I'll give it a try.



    Spinacia.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width