Jump to content

open window application from "open dialogue box" and make it always on top?

Recommended Posts

Hi guys!  Here is my code:




#include <GUIConstantsEx.au3>
#include <StructureConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>

AutoItSetOption ( "MustDeclareVars", 1)

;==========code here============

Func _Run_file()
    ; path of window application
    Local $_duong_dan_file_name = FileOpenDialog("chọn tập tin của bạn",  @WindowsDir & "\", "All (*.*)", $FD_FILEMUSTEXIST)
    ; execute it
    local $_app_run = ShellExecute($_duong_dan_file_name,"","","",@SW_MAXIMIZE)
    ; make it "always on top"
    WinSetOnTop($_app_run, "", $WINDOWS_ONTOP)



WinSetOnTop Func doesn't work! :(

Link to post
Share on other sites

It couldn't work:



Runs an external program using the ShellExecute API.

Return Value

Success: the PID of the process that was launched. Or -1 if there was no PID available.
Failure: 0 and sets the @error flag to non-zero.


Change a window's "Always On Top" attribute.

WinSetOnTop ( "title", "text", flag )


title The title/hWnd/class of the window to change. See Title special definition.
text The text of the window to change. See Text special definition.
flag Determines whether the window should have the "TOPMOST" flag set.
    $WINDOWS_NOONTOP (0) = remove on top flag
    $WINDOWS_ONTOP (1) = set on top flag

Constants are defined in "AutoItConstants.au3".

because a pid is not the needed hwnd.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...