Jump to content

Recommended Posts

Posted

I would ask for an indication of what is "The device context handle" in AutoIt.

 

Below a handful of knowledge and examples, which, unfortunately, not quite speak to me (which is why I ask for help in clarifying their meaning).

 

http://www.debenu.com/docs/pdf_library_reference/RenderPageToDC.php

  Quote

 This function renders a page from the selected document directly onto a graphics surface.

On Windows the target surface is a Device Context handle (DC).

 

 

and C++ example:

http://www.quickpdflibrary.com/faq/can-i-use-quick-pdf-as-a-viewer-in-my-c-application.php

HWND m_hwnd = HWND(GDK_WINDOW_HWND(this->m_drawingArea.get_window()>gobj() ));
HDC m_hdc = GetDC(m_hwnd);   
QP.RenderPageToDC(100, 1,(int)(HDC) m_hdc);

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Thanks

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I have additional questions.
There is a small problem with the refresh of the window.

Just minimize the window and restore it to its previous size and as a result I do not see already rendered image.
Anyone knows the solution?
Please send me only indicate the direction of a solution to this problem.

 

Here is my code.

#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include "QuickPDF.au3"


_QPDF_SetLicenseKey('ENTER YOUR KEY HERE')

; using own COM Error Handling
_QPDF_UseErrorHandler()

_QP_PDFFileInGUI(@ScriptDir & "\Example_HelloWorld.pdf", 70, 0, 612, 792)

Func _QP_PDFFileInGUI($sFileName, $iLeft, $iTop, $iWidth, $iHeight, $iSelectPage = 1)
    ; http://www.quickpdflibrary.com/faq/drawing-into-dc-scaling-problem.php

    ; Display GUI.
    Local $hwnd = GUICreate($sFileName, $iWidth, $iHeight, $iLeft, $iTop)
    GUISetState(@SW_SHOW)
    
    ; get Device context handle
    Local $hDC = _WinAPI_GetDC($hwnd)

    ; Object initialization
    Local $oQP
    If _QPDF_CreateObjectAndUnlock($oQP) = 1 Then
        ; get Device Context
        ; Load PDF File to QP Object
        $oQP.LoadFromFile($sFileName, '');
        ; select Page
        $oQP.SelectPage($iSelectPage);
        ; calculate DPI
        Local $iPageWidth = $oQP.PageWidth();
        Local $iInches = $iPageWidth / 72
        Local $iDisplayDPI = $iWidth / $iInches
        ; render QP object to Device Context
        $oQP.RenderPageToDC($iDisplayDPI, 12, $hDC);
    EndIf

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    
    _WinAPI_ReleaseDC($hwnd, $hDC)
    $oQP = 0 ; CleanUp - destroy object
    GUIDelete($hwnd) ; Deletes a GUI window and all controls that it contains.

EndFunc   ;==>_QP_PDFFileInGUI

#include "QuickPDF.au3" can be downloaded from here.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Last attempt to call for help before suicide attempt.

.

.

.

.

.

.

.

.

.

.

.

kidding

but maybe someone knows the answer?

The question is not necessarily related to the Debenu.
More generally, the issues relates to refresh Window and the Device Context.

 

mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 1 month later...
Posted

I tried to cope with the described problem, but I have not found a solution.

Here are two examples of the window.
Left - screenshot made ​​after starting the script - the window that appears, DC correctly.
Rights - screenshot made ​​when you drag another window over the DC window.

DeviceContext_inGUI_RefreshIssue.png

 

Again, please help.

mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

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
×
×
  • Create New...