| Author |  | 
      
        | eHomeCreations Groupie
 
  
 
 Joined: February 02 2007
 Location: Ukraine
 Online Status: Offline
 Posts: 64
 | 
          All.
           | Posted: April 06 2007 at 15:19 | IP Logged |   |  
           | 
 |  
 From eHome I am trying to activate the instance of Powerhome that is currently running and bring it to the foreground. Normally I would call the API and search for the caption of the program and get the hwnd and then send a API message to activate it.
 
 I am not able to find powerhome.
  I know the same thing happens to FoxPro apps too. Is this a PowerBuilder thing? 
 Anyway... ideas?
 
 
 __________________
 --Steve       http://www. ehomecreations.com
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Steve,
           | Posted: April 06 2007 at 15:51 | IP Logged |   |  
           | 
 |  
 PowerHome has several built-in functions that may help.
 
 ph_handle() returns the handle of the main PowerHome frame window.
 
 ph_setforegroundwindow will set a particular handle to be the foreground window.  You could bring PowerHome to the foreground with: ph_setforegroundwindow(ph_handle())
 
 You may also want to look at the ph_windowstate function as well.
 
 All of these functions are callable using the socket server or through a plugin.
 
 Concerning your specific problem though...the title of the PowerHome window is " PowerHome  " with a single space in front and two spaces after.
 
 Hope this helps,
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | eHomeCreations Groupie
 
  
 
 Joined: February 02 2007
 Location: Ukraine
 Online Status: Offline
 Posts: 64
 | 
          Thanks for the info!
           | Posted: April 06 2007 at 16:08 | IP Logged |   |  
           | 
 |  
 That was it. " PowerHome "  with the spaces worked great.
 
 My VBA function is:
 
 '--- shells or finds a application
 dim sadStartsWith: sadStartsWith = 0
 dim sadContains: sadContains = 1
 dim sadMatches: sadMatches = 2
 
 Dim sPrgCation,sPathAndFile, nFindWinBy
 
 nFindWinBy = sadStartsWith
 sPathAndFile = "C:\Program Files\powerhome\pwrhome.exe"
 sPrgCation = " powerhome  "
 
 g_oGbl.EH_AppActivate sPrgCation,sPathAndFile, nFindWinBy
 
 
 Now all works GREAT!
 
 
 
 __________________
 --Steve       http://www. ehomecreations.com
 | 
       
        | Back to Top |       | 
       
       
        |  |