Has anybody ever used the QHTM control by Gipsysoft with FF3? I can't quite figure out how to make it work.
The attachments is all that I have on QHTM - basically, got it all from our buddy Paul Noble several years ago.
I found the PB QHTM include along with a sample PB (DDT) program. I was able to add a custom control in a FF3 project and call the DLL initialize routine OK from the Form Create.
This may not be a QHTM problem but me not understanding how to handle a custom control.
The FORM1_CUSTOMCONTROL1_INIT function (automatically created by FF) seems to fire but the CreateWindowEx function call (inside of this function) returns a handle of ZERO so the control is obviously not created. GetLastError returns a 1407 that seems to be "ERROR_CANNOT_FIND_WND_CLASS". The control never appears on the form when run.
Other parms used by the CreateWindowEx passed into this function (FORM1_CUSTOMCONTROL1_INIT) seem to have the proper values. I did notice that the Class Name is mixed case in the INC file and passed as UPPER case to this INIT function. I tried using the mixed case value in a local variable instead and nothing changed.
Any help would be appreciated.
The controls are created **before** you get to the WM_CREATE message handler. Therefore, FireFly is attempting to create your window before the DLL is initialized. You need to put the DLL initialization code in the FF_WINMAIN handler.
A full and updated translation of the headers, as well as an example, are available in my forum:
http://www.jose.it-berater.org/smfforum/index.php?topic=3132.0
Jose thanks for the help. Partial Success.
I now have the HTML control displaying the proper content but I cannot seem to process any messages when I click links in the displayed HTML text.
The QHTM control FF CUSTOM event never seems to fire under any conditions.
I got the FORM CUSTOM event to catch a WM_NOTIFY for the control but I am still having some trouble figuring out the IDC of the control and adapting Jose's code to process the message. I verified that the IDC value of the control is 1001. See the problem below marked with *****
Local qhtmllink As tagNMQHTM
Local qhtmllinkPtr As tagNMQHTM Ptr
Local linkTextPtr As Asciiz Ptr
If wMsg = %WM_NOTIFY Then
' // Process notification messages
Local pQHTMLink As NMQHTM Ptr
pQHTMLink = lParam
' // If it comes from the QHTM control...
debug("CUSTOM IDC:"+Str$(@pQHTMLink.hdr.idFrom))
'******* This pointer returns ZERO when clicking the mouse in the control
If @pQHTMLink.hdr.idFrom = 0 Then
'********************************************************
' // If it comes from an hyperlink...
debug("Link:"+Str$(@pQHTMLink.hdr.Code))
If @pQHTMLink.hdr.Code = %QHTMN_HYPERLINK Then
MsgBox "You clicked " & @pQHTMLink.@pcszLinkText
' // Return False to prevent QHTM default action
@pQHTMLink.resReturnValue = %FALSE
End If
End If
End If
Hi Mark,
I downloaded Jose's code translation and make a quick FireFly project to emulate the example code that Jose made. It all worked pretty easily. I have attached the project to this post (it is in FF3 format).
Please let me know if you still have trouble.
If you created the control as a "CustomControl" in FireFly then you should be able to easily get the control ID from the F4 popup window (something like IDC_FRMMAIN_CUSTOMCONTROL1, or whatever you have named the Form and Control).
The WM_NOTIFY should look something like the following:
'--------------------------------------------------------------------------------
Function FRMMAIN_WM_NOTIFY ( _
hWndForm As Dword, _ ' handle of Form
idCtrl As Dword, _ ' control ID
ByVal pNMHDR As NMHDR Ptr _ ' pointer to NMHDR structure
) As Long
' // Process notification messages
Local pQHTMLink As NMQHTM Ptr
pQHTMLink = pNMHDR
' // If it comes from the QHTM control...
If @pQHTMLink.hdr.idFrom = IDC_FRMMAIN_CUSTOMCONTROL1 Then
' // If it comes from an hyperlink...
If @pQHTMLink.hdr.Code = %QHTMN_HYPERLINK Then
MsgBox "You clicked " & @pQHTMLink.@pcszLinkText
' // Return False to prevent QHTM default action
@pQHTMLink.resReturnValue = %FALSE
End If
End If
End Function
Thanks -- got it working.
Several issues from my tinkering.
1) In trying to use the FORM CUSTOM event rather than NOTIFY I had some code problems where I had made changes in Jose's original code.
2) Learned a few things about Custom Controls
Thanks for the help.