Jump to content

Recommended Posts

Posted

the first file i open in the fileopendialog works perfect.

second time i try to open a file, the script shuts down

with the exit code: -1073741819

#include <GuiConstants.au3>
 
$my_gui = GUICreate("MyGUI", 310, 310)
$button1 = guictrlcreatebutton('open',1,1,100,25)
$edit = guictrlcreateedit('',1,50,300,200)
GUISetState()

func open()
    $var = FileOpenDialog("finn en fil.",  "", " (*.*)",  3 )
        If not @error Then
            $file = FileOpen($var, 0)
            $chars = FileRead($file)
            GUICtrlSetData($edit, $chars)
            FileClose($file)
        EndIf
endfunc

While 1
     $msg = GUIGetMsg()
     Select
          Case $msg = $GUI_EVENT_CLOSE
               ExitLoop
           case $msg = $button1
               open()
          Case Else
              
     EndSelect
WEnd
Exit
Posted

It actually worked fine for me. I'd switch it up just a bit, though...

#include <GuiConstants.au3>

$my_gui = GUICreate("MyGUI", 310, 310)
$button1 = GUICtrlCreateButton('open', 1, 1, 100, 25)
$edit = GUICtrlCreateEdit('', 1, 50, 300, 200)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            open()
    EndSwitch
WEnd

Func open()
    $var = FileOpenDialog("finn en fil.", "", " (*.*)", 3)
    If @error Then Return
    $file = FileOpen($var, 0)
    $chars = FileRead($file)
    GUICtrlSetData($edit, $chars)
    FileClose($file)
EndFunc
Posted (edited)

hmm.. :)

seems like this is only a problem when i open files from my desktopdir.

if i open files from d:\ it doesnt shut down.

Edited by yxrkt
Posted

Does it crash when a tooltip tries to popup? And are you running on XP? Then there is a windows bug that can cause that. You maybe able to open notepad and select the openfiledialog there and you may find that notepad will crash as well.

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...