Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

QHTM control - Minimal PBDLL DDT example

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • QHTM control - Minimal PBDLL DDT example

    Heres some PB code for using the Qhtm control from:
    http://www.gipsysoft.com


    Code:
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' Minimal DDT QHTML control example for PBDLL 6.0 by Peter Scheutz
    ' Using QHTM you can place HTML content on any window, any device context,
    ' On a report Or even In a tooltip Get it from: [url="http://www.gipsysoft.com"]http://www.gipsysoft.com[/url] 
    '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    #Compile Exe
    #Dim All
    #Include "win32api.inc"
    
    %QHTM_LOAD_FROM_FILE = %WM_USER + 2
    Declare Function QHTM_Initialize Lib "qhtmlight.dll" Alias "QHTM_Initialize" (ByVal hInst As Long) As Byte
    
    %ID_QHTM =100
    
    Function WinMain (ByVal hCurInstance  As Long, _
                      ByVal hPrevInstance As Long, _
                      lpszCmdLine         As Asciiz Ptr, _
                      ByVal nCmdShow      As Long) Export As Long
                      
       Local hDlg As Long
       Local retVal As Byte
       Local hCtl As Long
       Local fname As Asciiz*%MAX_PATH
    
       Dialog New 0, "QHTM test" ,,,300,300,%WS_SYSMENU To hDlg
    
       retVal=QHTM_Initialize( hCurInstance)
       If retVal=0 Then MsgBox "Failed to initialize QHTM - Quitting" : Exit Function
       Control Add "QHTM_Window_Class_001", hDlg, %ID_QHTM, "", 10, 10, 280, 260 ,%WS_TABSTOP Or %WS_VISIBLE   Or %WS_CHILD,%WS_EX_CLIENTEDGE
    
       Control Handle hDlg, %ID_QHTM To hCtl
       If hDlg Then
            ' OBS: Change this to a html file on your system (try one that comes with QHTM)
            fname="C:\qhtm\APIExample\about.html"
            SendMessage hCtl,%QHTM_LOAD_FROM_FILE, 0, VarPtr(fname)
            
            Dialog Show Modal hDlg
       Else
            MsgBox "Failed to create QHTM control"
       End If
    
    
    End Function



    ------------------
    Best Regards
    Peter Scheutz
    Best Regards
    Peter Scheutz

  • #2
    Code:
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' Minimal DDT QHTML control example for PBDLL 6.0 by Peter Scheutz, 5 juli 2001
    ' New: This version catch links clicked in the control.
    ' Using QHTM you can place HTML content on any window, any device context,
    ' On a report Or even In a tooltip Get it from: [url="http://www.gipsysoft.com"]http://www.gipsysoft.com[/url] 
    '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    #Compile Exe
    #Dim All
    #Include "win32api.inc"
    
    '----QHTM declares -------------------------------------------------
    
    %QHTM_LOAD_FROM_FILE = %WM_USER + 2
    %QHTMN_HYPERLINK=1
    Declare Function QHTM_Initialize Lib "qhtmlight.dll" Alias "QHTM_Initialize" (ByVal hInst As Long) As Byte
    Type tagNMQHTM
        hdr As NMHDR
        pcszLinkText As Asciiz Ptr
        resReturnValue As Long
    End Type
    
    '----End of QHTM declares -------------------------------------------
    
    %ID_QHTM =100
    
    CallBack Function hDlgCall()
        Local qhtmllink As tagNMQHTM
        Local qhtmllinkPtr As tagNMQHTM Ptr
        Local linkTextPtr As Asciiz Ptr
    
        If CbMsg = %WM_NOTIFY Then
            If CbCtl=%ID_QHTM Then
            ' get a Pointer to the tagNMQHTM  structure and stick it in a local copy.
            qhtmllinkPtr = CbLparam
            qhtmllink = @qhtmllinkPtr
            
            ' what message?:
            If qhtmllink.hdr.code =%QHTMN_HYPERLINK Then
                ' get a pointer to the text:
                linkTextPtr = qhtmllink.pcszLinkText
                'handle the link here:
                MsgBox "You clicked: " & $CRLF & @linkTextPtr
                'To prevent default action by qhtm, set returvalue to False:
                qhtmllink.resReturnValue =%False
                @qhtmllinkPtr =qhtmllink
            End If
            
            
            End If
       End If
    End Function
    
    
    Function WinMain (ByVal hCurInstance  As Long, _
                      ByVal hPrevInstance As Long, _
                      lpszCmdLine         As Asciiz Ptr, _
                      ByVal nCmdShow      As Long) Export As Long
    
       Local hDlg As Long
       Local retVal As Byte
       Local hCtl As Long
       Local fname As Asciiz*%MAX_PATH
    
       Dialog New 0, "QHTM test" ,,,300,300,%WS_SYSMENU To hDlg
    
       retVal=QHTM_Initialize( hCurInstance)
       If retVal=0 Then MsgBox "Failed to initialize QHTM - Quitting" : Exit Function
       Control Add "QHTM_Window_Class_001", hDlg, %ID_QHTM, "", 10, 10, 280, 260 ,%WS_TABSTOP Or %WS_VISIBLE   Or %WS_CHILD,%WS_EX_CLIENTEDGE
    
       Control Handle hDlg, %ID_QHTM To hCtl
       If hDlg Then
            ' OBS: Change this to a html file on your system (try one that comes with QHTM)
            fname="C:\Qhtml\APIExample\about.html"
            SendMessage hCtl,%QHTM_LOAD_FROM_FILE, 0, VarPtr(fname)
    
            Dialog Show Modal hDlg Call hDlgCall
       Else
            MsgBox "Failed to create QHTM control"
       End If
    
    
    End Function
    ------------------
    Best Regards
    Peter Scheutz
    Best Regards
    Peter Scheutz

    Comment

    Working...
    X