Sign in to follow this  
Followers 0
jedd999

GuiCtrlSetState Problems

5 posts in this topic

#1 ·  Posted (edited)

I am having a bit of difficulty when using the function GuiCtrlSetState when I want to allow drop files by using $GUI_DROPACCEPTED.

The issue is that I need to use #RequireAdmin at the top of my file otherwise I cant execute the install files which are triggered by my script, however when I add this flag in the file, then the dialog box will not allow me to drop anything in it. I have narrowed it down to the #RequireAdmin that is causing it not to work. Is there some sort of work-around or other flag I can add which will allow the drop dialog to work?

Any help would be appreciated!

Thanks!

Here is a snippet of code...

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <GuiTab.au3>
#include <GuiButton.au3>
#RequireAdmin


_CreateGUI()

While 1
    $iMsg = GUIGetMsg()
    ; Code below will check if the file is dropped (or selected)
    $sCurFilename = GUICtrlRead($hFile)
    If $sCurFilename <> $sFilename Then
        $iStartIndex = 1
        $sFilename = $sCurFilename
    EndIf
    ; Main "Select" statement to handle events
    Select
        Case $iMsg = $hFileSel
            $sTmpFile = FileOpenDialog("Select file:", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "Executables & dll's (*.exe;*.dll;*.ocx;*.icl)")
            If @error Then ContinueLoop
            GUICtrlSetData($hFile, $sTmpFile); GUI will be updated at next iteration
    EndSelect
WEnd



Func _CreateGUI()
    $hGui = GUICreate("Test Station Configuration Tool", 400, 350, @DesktopWidth / 2 - 192, @DesktopHeight / 2 - 235, -1, $WS_EX_ACCEPTFILES)
    GUICtrlCreateGroup("Graphics Driver Install", $X1CORD - 10, $Y3CORD, 385, ($NUMDRIVERROWS) * 20 + 20)
    $hFile = GUICtrlCreateInput($sFilename, $X1CORD, $Y3CORD + 15, 300, 16, -1, $WS_EX_STATICEDGE)
    GUICtrlSetState($hFile, $GUI_DROPACCEPTED)
    GUICtrlSetTip($hFile, "You can drop files from shell here...")
    $hFileSel = GUICtrlCreateButton("...", $X1CORD + 315, $Y3CORD + 13, 26, 18)
        GUISetState()
EndFunc
Edited by jedd999

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

---

Edited by playlet

Share this post


Link to post
Share on other sites

Thanks for the suggestion, however still no luck >_<

BTW, the drop box created in my code actually worked 100%, the only time it stopped to work is when I added the #RequireAdmin at the top of the code because this app needs to run in admin mode.

Is there any way to have the drop box work when there is #RequireAdmin at the top?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

---

Edited by playlet

Share this post


Link to post
Share on other sites

I don't know what's the problem, when I put #requireadmin at the top it works without problems

AH, I see what the problem is - I dont actually have the UAC disabled... I just have the UAC warning messages disabled. If I actually DISABLE the UAC, then it seems to work ok... Would have been nice to find another way to get this to work... but I guess its not possible.

Regards,

Jeff

Share this post


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
Sign in to follow this  
Followers 0