send CTRL-C to dchtmlviewer
Re: send CTRL-C to dchtmlviewer
We would need to know what the Input() class is.
Where does it come from?
Where does it come from?
The eXpress train is coming - and it has more cars.
Re: send CTRL-C to dchtmlviewer
Hi Roger,
I suppose it comes from ot4xb.
I suppose it comes from ot4xb.
Re: send CTRL-C to dchtmlviewer
The following code comes from the htmleditor. It can be used to send a keystroke to the active application.
Problem is that I don't succeed to set the dc_htmlviewer as active or as focused component/dialog.
In the htmleditor code there is a COPY method and a SETFOCUS() method. It looks as the setfocus doesn't work when a PDF file is shown in the htmlviewer. The methods hasfocus() and focus() don't exist in the adobe activex for the pdf viewer.
I tried with events as ldDblClick, Killinputfocus, setInputFocus but I don't succeed.
Problem is that I don't succeed to set the dc_htmlviewer as active or as focused component/dialog.
In the htmleditor code there is a COPY method and a SETFOCUS() method. It looks as the setfocus doesn't work when a PDF file is shown in the htmlviewer. The methods hasfocus() and focus() don't exist in the adobe activex for the pdf viewer.
I tried with events as ldDblClick, Killinputfocus, setInputFocus but I don't succeed.
Code: Select all
*****************************
PROCEDURE SendCtrlKey( xKey )
*****************************
LOCAL oInput := Input():New()
LOCAL nEvents:= 4
LOCAL nSize := oInput:_sizeof_()
LOCAL pBuffer:= _xgrab( nSize * nEvents )
oInput:_link_( pBuffer , .F.)
oInput:type := INPUT_KEYBOARD
oInput:ki:wVk:= VK_CONTROL
GwstArrayNext(oInput)
oInput:type := INPUT_KEYBOARD
oInput:ki:wVk:= xKey
GwstArrayNext(oInput)
oInput:type := INPUT_KEYBOARD
oInput:ki:wVk := VK_CONTROL
oInput:ki:dwFlags:= KEYEVENTF_KEYUP
GwstArrayNext(oInput)
oInput:type := INPUT_KEYBOARD
oInput:ki:wVk := xKey
oInput:ki:dwFlags:= KEYEVENTF_KEYUP
@user32:SendInput( nEvents, pBuffer, nSize )
oInput:_unlink_()
_xfree( pBuffer)
RETURN
*********************
BEGIN STRUCTURE INPUT
*********************
MEMBER DWORD type
BEGIN UNION
MEMBER @ MOUSEINPUT mi
MEMBER @ KEYBDINPUT ki
MEMBER @ HARDWAREINPUT hi
END UNION
END STRUCTURE // 28 // BYTES
**************************
BEGIN STRUCTURE MOUSEINPUT
**************************
MEMBER LONG dx
MEMBER LONG dy
MEMBER DWORD mouseData
MEMBER DWORD dwFlags
MEMBER DWORD time
MEMBER DWORD dwExtraInfo
END STRUCTURE // 24 BYTES
**************************
BEGIN STRUCTURE KEYBDINPUT
**************************
MEMBER WORD wVk
MEMBER WORD wScan
MEMBER DWORD dwFlags
MEMBER DWORD time
MEMBER DWORD dwExtraInfo
END STRUCTURE // 16 BYTES
*****************************
BEGIN STRUCTURE HARDWAREINPUT
*****************************
MEMBER DWORD uMsg
MEMBER WORD wParamL
MEMBER WORD wParamH
END STRUCTURE // 8 BYTES
Re: send CTRL-C to dchtmlviewer
Do you have a sample program that I can work with?
The eXpress train is coming - and it has more cars.
Re: send CTRL-C to dchtmlviewer
Hi Roger,
The above comes from c:\exp20\Samples\HtmlEdit_2\
It is working when there is HTML in the viewer. Then there is oHtmlviewer:document. When there is a PDF showing, it isn't clear to me how to set focus to i
The above comes from c:\exp20\Samples\HtmlEdit_2\
It is working when there is HTML in the viewer. Then there is oHtmlviewer:document. When there is a PDF showing, it isn't clear to me how to set focus to i
Re: send CTRL-C to dchtmlviewer
Roger,
Meanwhile I added some code to your fileviewer sample. This way it will be easier to start with it.
I added a button to send the CTRL-C to the active-X window.
This should be possible:
- Double click a word in the PDF.
- Click on the 'send CTRL-C' button, so the selected word is copied to the clipboard.
If you use CTRL-C on the keyboard, the copy is done.
There is some testing code in it, so you can see what I tried.
It is ready to compile and run.
Meanwhile I added some code to your fileviewer sample. This way it will be easier to start with it.
I added a button to send the CTRL-C to the active-X window.
This should be possible:
- Double click a word in the PDF.
- Click on the 'send CTRL-C' button, so the selected word is copied to the clipboard.
If you use CTRL-C on the keyboard, the copy is done.
There is some testing code in it, so you can see what I tried.
It is ready to compile and run.
- Attachments
-
- fileviewer.zip
- (608.68 KiB) Downloaded 723 times
Re: send CTRL-C to dchtmlviewer
I copied some methods from the html viewer sample. I also copied some functions that are used in that sample. This way the input object is created.
The necessary include files are also added.
I suppose you have the ot4xb.dll? If not, I added it to the zip-file.
The necessary include files are also added.
I suppose you have the ot4xb.dll? If not, I added it to the zip-file.
- Attachments
-
- fileviewer.zip
- (800.25 KiB) Downloaded 705 times
Re: send CTRL-C to dchtmlviewer
I tried a bunch of changes to your test app but I cannot determine a way to do this.
My guess is that the PDFViewer ActiveX Control does not receive events from the XbpHtmlViewer Active X control.
My guess is that the PDFViewer ActiveX Control does not receive events from the XbpHtmlViewer Active X control.
The eXpress train is coming - and it has more cars.
Re: send CTRL-C to dchtmlviewer
Roger,
I tried it also in different ways, but I also didn't succeed.
Thanks for taking your time to test this.
I tried it also in different ways, but I also didn't succeed.
Thanks for taking your time to test this.
Re: send CTRL-C to dchtmlviewer
hi,
read more about Keyboard Input here***
* https://docs.microsoft.com/de-de/window ... dfrom=MSDN
** https://docs.microsoft.com/en-us/window ... eybd_event
*** https://docs.microsoft.com/de-de/window ... oard-input
SendInput* is a API function which is used now while keybd_event** API function is deprecatedskiman wrote:I suppose it comes from ot4xb.
read more about Keyboard Input here***
* https://docs.microsoft.com/de-de/window ... dfrom=MSDN
** https://docs.microsoft.com/en-us/window ... eybd_event
*** https://docs.microsoft.com/de-de/window ... oard-input
you have to use Windows API function "SetFocus" not Xbase++ functionIn the htmleditor code there is a COPY method and a SETFOCUS() method. It looks as the setfocus doesn't work when a PDF file is shown in the htmlviewer. The methods hasfocus() and focus() don't exist in the adobe activex for the pdf viewer.
greetings by OHR
Jimmy
Jimmy