Jump to content

Recommended Posts

Posted (edited)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>


_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()
GUICreate("Embedded Web control Test", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$GUIActiveX = GUICtrlCreateObj($oIE, 20, 10, 600, 500)
$GUI_Button_browse = GUICtrlCreateButton("Browse", 430, 540, 100, 30)

GUISetState()       ;Show GUI

; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $GUI_Button_browse
            $pdf_file = FileOpenDialog("123", @ScriptDir & "\", "Pdf files (*.pdf)", 1)
            _IENavigate ($oIE, $pdf_file )
    EndSelect
WEnd

GUIDelete()

Exit

HI:

I have a GUI, directly taken from help file, which I modified to open pdf files.

The opening of pdf file is fine, but after that the GUI becomes unresponsive, does not close with $GUI_EVENT_CLOSE.

Please help me out.

Ajit

Edited by ajit
  • Moderators
Posted

ajit,

Works for me if I force the immediate return of _IENavigate: :mellow:

_IENavigate ($oIE, $pdf_file, 0)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

@ajit

In the code in post 1, your GUIDelete() is 'dead code', because

of the Exit in the While..Wend loop.

You could either change Exit -> ExitLoop, or remove GUIDelete()

HTH,

wim

Posted

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <TabConstants.au3>


_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()
GUICreate("Embedded Web control Test", 640, 580, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)

$GUI_Button_browse = GUICtrlCreateButton("Browse", 430, 530, 100, 30)

$tabs = GUICtrlCreateTab(10, 10, 600, 500, $TCS_FIXEDWIDTH)
GUICtrlSetResizing($tabs, $GUI_DOCKRIGHT + $GUI_DOCKTOP)

$PDF_TAB = GUICtrlCreateTabItem("TAB1")

$GUIActiveX = GUICtrlCreateObj($oIE, 30, 50, 480, 380)


GUISetState()       ;Show GUI

; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $GUI_Button_browse
            $pdf_file = FileOpenDialog("123", @ScriptDir & "\", "Pdf files (*.pdf)", 1)
            _IENavigate ($oIE, $pdf_file, 0 )
    EndSelect
WEnd

I am sorry to come again with the same topic.

The script worked fine until I used it in a GUI with tab control. The problem here is a little different, the adobe reader gets stuck when I try to scroll the pages. I think it is due to my wrong coding but cannot help myself.

Please help me.

Ajit

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