Jump to content
Sign in to follow this  
Zuldan23

Adobe embedded in child window causes lock up when focus lost

Recommended Posts

Zuldan23

This is kind of a strange problem but hopefully someone can help. What I am trying to do is embed adobe into a child window but it produces very odd behavior. It loads the PDF just fine but if you have the child window active when you activate any other open window and then go back to it, it is frozen. If you have the parent window active though by clicking the input box and then activate any other window and come back it is fine. This happens if I use "AcroPDF.PDF.1" or "Shell.Explorer.2". Anyone have any thoughts?

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

$pdf = ObjCreate("AcroPDF.PDF.1")
$pdf.src = "C:\"
$pdftoload = "" ;add a pdf here to load

$gui = GUICreate("", 600, 800, Default, Default, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_CLIPCHILDREN))
$btn = GUICtrlCreateButton("Load", 0, 0)
$input = GUICtrlCreateInput("", 70, 0)
    $child = GUICreate("", 500, 700, 50, 50, $WS_CHILD, $WS_EX_CLIENTEDGE, $gui)
    $pdfctrl = GUICtrlCreateObj($pdf, 0, 0, 500, 700)
    GUISetState(@SW_SHOW, $child)

GUISetState(@SW_SHOW, $gui)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $btn
            $pdf.src = $pdftoload
    EndSelect
Wend
Edited by Zuldan23

Share this post


Link to post
Share on other sites
NewPlaza

Will this work for you?

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

$pdf = ObjCreate("AcroPDF.PDF.1")
$pdf.src = "C:\"
$pdftoload = "C:\Sample.pdf" ;add a pdf here to load

$gui = GUICreate("", 600, 800)
$btn = GUICtrlCreateButton("Load", 0, 0)
$input = GUICtrlCreateInput("", 70, 0)
    $child = GUICreate("", 500, 700, 50, 50, $WS_CHILD)
    $pdfctrl = GUICtrlCreateObj($pdf, 50, 50, 500, 700)
    GUISetState(@SW_SHOW, $child)

GUISetState(@SW_SHOW, $gui)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $btn
            $pdf.src = $pdftoload
    EndSelect
Wend

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  

×