emulate CTRL+V

emulate CTRL+V

Postby Natter » Wed Nov 13, 2024 6:55 pm

How to emulate CTRL+V ?
Natter
 
Posts: 1217
Joined: Mon May 14, 2007 9:49 am

Re: emulate CTRL+V

Postby karinha » Wed Nov 13, 2024 9:05 pm

Complete, pls:

Code: Select all  Expand view

   oWnd:bKeyDown := { | nKey | StdKey( nKey ) }

FUNCTION StdKey( nKey )

   DO CASE
   CASE nKey == 65 .AND. GetKeyState( VK_CONTROL ) // Crtl + A
      CreateInfoArticulo()
   CASE nKey == 38 .AND. GetKeyState( VK_CONTROL ) // Ctrl + Down
      NextEmpresa()
   CASE nKey == 40 .AND. GetKeyState( VK_CONTROL ) // Ctrl + Up
      PriorEmpresa()
   CASE nKey == 48 .AND. GetKeyState( VK_CONTROL ) // Ctrl + 0
      dbDialog()
   END CASE

RETURN NIL
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7814
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: emulate CTRL+V

Postby Natter » Thu Nov 14, 2024 8:21 am

karinha, I was asking how to emulate pressing CTRL+V
Like this
Code: Select all  Expand view
SendMessage( hWn, WM_KEYDOWN, 8, 0) //left ctrl
SendMessage( hWn, WM_KEYDOWN, asc("V"), 0)
SendMessage( hWn, WM_KEYUP, 8, 0) //left ctrl
SendMessage( hWn, WM_KEYUP, asc("V"), 0)

This option does not work
Natter
 
Posts: 1217
Joined: Mon May 14, 2007 9:49 am

Re: emulate CTRL+V

Postby karinha » Thu Nov 14, 2024 2:44 pm

PostMsg( WM_KEYDOWN, ASC("V" ) ??

Something like that?

Code: Select all  Expand view

oCbx1:bKeydown := {| nkey | COM_KEY( nKey ) }

FUNCTION COM_KEY_U( nKey )

   IF nKey = VK_RETURN

      QKeyboard( Chr( VK_TAB ), oCbx2:hWnd )

   ENDIF

RETURN NIL

FUNCTION QKeyboard( TECLA, hWndCtl )

   IF hWndCtl == Nil

      hWndCtl := getactivewindow()

   END

   SetFocus( hWndCtl )

   Postmessage( hWndCtl, WM_KEYDOWN, Asc( TECLA ) )

RETURN NIL
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7814
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: emulate CTRL+V

Postby Giovany Vecchi » Sun Nov 17, 2024 1:43 pm

Try using WScript

Code: Select all  Expand view
lc_oShell := tOleAuto():New( "WScript.Shell" )
lc_oShell:SendKeys("^V")
 
User avatar
Giovany Vecchi
 
Posts: 223
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: emulate CTRL+V

Postby karinha » Sun Nov 17, 2024 4:18 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7814
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: emulate CTRL+V

Postby Armando » Sun Nov 17, 2024 4:57 pm

Natter:

Natter wrote:How to emulate CTRL+V ?


It is advisable to indicate the destination of the emulation, Dlg or Get

Code: Select all  Expand view

oDlg:PostMsg(WM_KEYDOWN,ASC("V"),0)
 


I hope these can help you

With best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3224
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: emulate CTRL+V

Postby nageswaragunupudi » Sun Nov 17, 2024 5:14 pm

Giovany Vecchi wrote:Try using WScript

Code: Select all  Expand view
lc_oShell := tOleAuto():New( "WScript.Shell" )
lc_oShell:SendKeys("^V")
 


Thanks. This is working for me.

This is my test:
Code: Select all  Expand view
#include "fivewin.ch"

#define WM_PASTE           770

function Main()

   local oDlg, oBar, oGet
   local cText := Space( 100 )

   SetGetColorFocus()
   DEFINE DIALOG oDlg SIZE 400,200 PIXEL TRUEPIXEL

   DEFINE BUTTONBAR oBar OF oDlg SIZE 100,40 2007
   DEFINE BUTTON OF oBar PROMPT "CtrlV" CENTER ;
      ACTION ( oGet:SetFocus(), ;
      TOleAuto():New( "WScript.Shell" ):SendKeys( "^V" ) )
   DEFINE BUTTON OF oBar PROMPT "Paste" CENTER ;
      ACTION SendMessage( oGet:hWnd, WM_PASTE, 0, 0 )
   DEFINE BUTTON OF oBar PROMPT "Clear" CENTER ;
      ACTION oGet:cText := Space( 100 )

   //
   @ 100,20 GET oGet VAR cText SIZE 360,24 PIXEL OF oDlg

   ACTIVATE DIALOG oDlg CENTERED

return nil


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10633
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: cmsoft, karinha and 30 guests