send CTRL-C to dchtmlviewer

This forum is for eXpress++ general support.
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: send CTRL-C to dchtmlviewer

#11 Post by rdonnay »

We would need to know what the Input() class is.
Where does it come from?
The eXpress train is coming - and it has more cars.

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: send CTRL-C to dchtmlviewer

#12 Post by skiman »

Hi Roger,

I suppose it comes from ot4xb.
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: send CTRL-C to dchtmlviewer

#13 Post by skiman »

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.

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

Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: send CTRL-C to dchtmlviewer

#14 Post by rdonnay »

Do you have a sample program that I can work with?
The eXpress train is coming - and it has more cars.

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: send CTRL-C to dchtmlviewer

#15 Post by skiman »

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
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: send CTRL-C to dchtmlviewer

#16 Post by skiman »

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.
Attachments
fileviewer.zip
(608.68 KiB) Downloaded 573 times
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: send CTRL-C to dchtmlviewer

#17 Post by skiman »

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.
Attachments
fileviewer.zip
(800.25 KiB) Downloaded 560 times
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: send CTRL-C to dchtmlviewer

#18 Post by rdonnay »

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.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: send CTRL-C to dchtmlviewer

#19 Post by skiman »

Roger,

I tried it also in different ways, but I also didn't succeed.

Thanks for taking your time to test this.
Best regards,

Chris.
www.aboservice.be

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: send CTRL-C to dchtmlviewer

#20 Post by Auge_Ohr »

hi,
skiman wrote:I suppose it comes from ot4xb.
SendInput* is a API function which is used now while keybd_event** API function is deprecated
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
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.
you have to use Windows API function "SetFocus" not Xbase++ function
greetings by OHR
Jimmy

Post Reply