In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Application topmost

Xailer professional forum in English
Timm
Posts: 93
Joined: Mon Jun 21, 2010 11:01 am

Application topmost

Postby Timm » Tue Jul 28, 2015 10:44 am

Hi!

Is it possible to make an application topmost after calling it with Execute()?

::hProcessIE := Execute( AppData:cBrowserExecute )

SetWindowPos( ???, HWND_TOPMOST, 0, 0, 0, 0, nOr( SWP_NOMOVE, SWP_NOSIZE ) )

Best regards, Timm.
User avatar
ignacio
Site Admin
Posts: 8558
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: Application topmost

Postby ignacio » Tue Jul 28, 2015 11:37 am

Not tested:

Code: Select all

FOR EACH hWnd IN EnumWindows()
  IF GetWindowThreadProcessID( hWnd ) == hMyProcessID
    SetWindowPos( hWnd, HWND_TOPMOST, 0, 0, 0, 0, nOr( SWP_NOMOVE, SWP_NOSIZE ) )
    EXIT
  ENDIF
NEXT

#pragma BEGINDUMP
#include <windows.h>
#include <xailer.h>

HB_FUNC( GetWindowThreadProcessId ) // GetWindowThreadProcessId( hWnd ) --> hProcesssID
{
   hb_retnl( GetWindowThreadProcessId( (HWND) hb_parnl( 1 ), NULL ) );
}
#pragma ENDDUMP

Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Timm
Posts: 93
Joined: Mon Jun 21, 2010 11:01 am

Re: Application topmost

Postby Timm » Tue Jul 28, 2015 2:49 pm

Ingnacio,

sorry, the code does not work.

GetWindowThreadProcessID( hWnd ) is never hMyProcessID

Best regards, Timm.
User avatar
ignacio
Site Admin
Posts: 8558
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: Application topmost

Postby ignacio » Tue Jul 28, 2015 7:09 pm

Try with:

Execute( AppData:cBrowserExecute,"c:\StartDirectory", .f., SW_SHOWNORMAL, @nProcessID )

Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Timm
Posts: 93
Joined: Mon Jun 21, 2010 11:01 am

Re: Application topmost

Postby Timm » Wed Jul 29, 2015 8:18 am

Hi Ignacio,

no, it does not work.

Best regards, Timm.
User avatar
ignacio
Site Admin
Posts: 8558
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: Application topmost

Postby ignacio » Wed Jul 29, 2015 9:31 am

Then, I believe your only chance is to use GetWindowText( hWnd ). No more clues. Sorry.

Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Timm
Posts: 93
Joined: Mon Jun 21, 2010 11:01 am

Re: Application topmost

Postby Timm » Wed Jul 29, 2015 11:56 am

Ignacio,

GetWindowText( hWnd ) works for me, many thanks!

Best regards, Timm.
User avatar
ignacio
Site Admin
Posts: 8558
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: Application topmost

Postby ignacio » Wed Jul 29, 2015 12:44 pm

Great!! Glad to help :-)
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info

Return to “English”