bb.donnay-software.com

Donnay Software Web Forums
It is currently Wed Jun 03, 2020 5:15 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Tue Mar 03, 2020 1:28 pm 
Offline

Joined: Thu Jan 28, 2010 1:22 am
Posts: 864
Location: Sijsele, Belgium
Hi,

I would like to send a PAGE-DOWN to a dchtmlviewer.

Code:
postappevent(xbeP_Keyboard,xbeK_PGDN,,oViewer)


The above isn't working, nothing happens. Would this be possible to accomplish?

_________________
Best regards,

Chris.
www.aboservice.be


Top
 Profile  
 
PostPosted: Tue Mar 03, 2020 8:50 pm 
Offline
User avatar

Joined: Wed Feb 24, 2010 3:44 pm
Posts: 1185
skiman wrote:
I would like to send a PAGE-DOWN to a dchtmlviewer.
Code:
postappevent(xbeP_Keyboard,xbeK_PGDN,,oViewer)

The above isn't working, nothing happens. Would this be possible to accomplish?

if you want to "send" Key they must be "virtual" -> VK_
Code:
#define VK_PRIOR 0x21
#define VK_NEXT 0x22
#define VK_UP 0x26
#define VK_DOWN 0x28

and you can´t use PostAppEvent() while that is Xbase++ only.

_________________
greetings by OHR
Jimmy


Top
 Profile  
 
PostPosted: Wed Mar 04, 2020 1:58 am 
Offline

Joined: Thu Jan 28, 2010 1:22 am
Posts: 864
Location: Sijsele, Belgium
Hi Jimmy,

Thanks for the answer, but I have no idea how to send a 'virtual key'.

I looked around and found samples in VB, which are using Sendkeys to send keys to another application. Do you have a sample?

_________________
Best regards,

Chris.
www.aboservice.be


Top
 Profile  
 
PostPosted: Wed Mar 04, 2020 4:01 am 
Offline
User avatar

Joined: Thu Jan 28, 2010 12:59 am
Posts: 772
Location: Berlin, Germany
Are you sure the dchtmlviewer knows keyboard-events? What about posting them to the scrollbar?

_________________
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."


Top
 Profile  
 
PostPosted: Wed Mar 04, 2020 6:26 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 4125
Location: Boise, Idaho USA
I looked at the docs for XbpHtmlViewer and XbpActiveXControl and there is nothing documented on how to send a key to an ActiveX object.

I also looked online and can find nothing.

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
PostPosted: Wed Mar 04, 2020 5:27 pm 
Offline
User avatar

Joined: Wed Feb 24, 2010 3:44 pm
Posts: 1185
skiman wrote:
Thanks for the answer, but I have no idea how to send a 'virtual key'.
I looked around and found samples in VB, which are using Sendkeys to send keys to another application. Do you have a sample?

have a look at c:\exp20\Samples\HtmlEdit_2\ from J.A. Diego Kerejeta.

it is a HTML Editor based on XbpHTMLViewer() and use "virtual Key"
INPUT Structure is used instead of keybd_event (), which is deprecated, so it need Ot4Xb

---

include "self made" Help File from ieFrame.DLL
look at "Webbrowser" which Event, Method or Property are available
Attachment:
shdocvw.zip [131.8 KiB]
Downloaded 72 times

_________________
greetings by OHR
Jimmy


Top
 Profile  
 
PostPosted: Fri Mar 06, 2020 3:35 am 
Offline

Joined: Thu Jan 28, 2010 1:22 am
Posts: 864
Location: Sijsele, Belgium
Hi Jimmy,

Thanks, I will check that sample.

_________________
Best regards,

Chris.
www.aboservice.be


Top
 Profile  
 
PostPosted: Wed Mar 18, 2020 10:43 am 
Offline

Joined: Thu Jan 28, 2010 1:22 am
Posts: 864
Location: Sijsele, Belgium
Hi,

Meanwhile I found the following C# code to send CTRL-C to an external application. It should put already selected text to the Windows clipboard.

Code:
[DllImport("User32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);

[DllImport("user32.dll", CharSet=CharSet.Auto)]
static public extern IntPtr GetForegroundWindow();

[DllImport("user32.dll")]
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, uint dwExtraInfo);
.....

private void SendCtrlC(IntPtr hWnd)
    {
    uint KEYEVENTF_KEYUP = 2;
    byte VK_CONTROL = 0x11;
    SetForegroundWindow(hWnd);
    keybd_event(VK_CONTROL,0,0,0);
    keybd_event (0x43, 0, 0, 0 ); //Send the C key (43 is "C")
    keybd_event (0x43, 0, KEYEVENTF_KEYUP, 0);
    keybd_event (VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);// 'Left Control Up

}


I suppose this should be possible to convert to Xbase++.

Another possible solution I found was the following code:

The author wrote the following:
Quote:
No idea for how long has this been possible but instead of fighting with Win32 programming (mostly user32.dll and various Windows messages like WM_GETTEXT, WM_COPY and various SendMessage(handle, WM_GETTEXT, maxLength, sb) calls) which is advised in most of SO threads on this topic, I easily managed to access selected text in any window in my C# code followingly:


And this is his code:
Code:
static void fetchSelectionToClipboard()
{
  Thread.Sleep(400);
  SendKeys.SendWait("^c");   // magic line which copies selected text to clipboard
  Thread.Sleep(400);
}


I don't know how to simulate that sendkeys function.

If anyone have the knowledge to convert this to Xbase++, It would be a nice to have.

I would use it to send selected text in a dchtmlviewer to the clipboard, so I can import it, but I suppose it would be usefull for other situations also.

_________________
Best regards,

Chris.
www.aboservice.be


Top
 Profile  
 
PostPosted: Wed Mar 18, 2020 10:52 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 27, 2010 6:58 pm
Posts: 4125
Location: Boise, Idaho USA
I looked at that C# code a few weeks ago but could find nothing in the Xbase++ docs that shows how to send it to an XbpActiveXControl object or Automation Object.

_________________
The eXpress train is coming - and it has more cars.


Top
 Profile  
 
PostPosted: Wed Mar 18, 2020 11:56 am 
Offline

Joined: Thu Jan 28, 2010 1:22 am
Posts: 864
Location: Sijsele, Belgium
Hi,

In the htmleditor of J.A. Diego Kerejeta , I found the following. It is used to send a CTRL-C to the xbphtmlviewer.
Code:
*****************************
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

_________________
Best regards,

Chris.
www.aboservice.be


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group