Alaska Software Inc. - PLC, Mouse motion and thread.
Username: Password:
AuthorTopic: PLC, Mouse motion and thread.
Claudio Driussi PLC, Mouse motion and thread.
on Thu, 19 Apr 2018 19:11:05 +0200
I have a question a little bit difficult.

I have to interface a Xbase++ 1.9 application to a PLC system
through ActiveX. I attach a little sample which works like a charm.

But in a real GUI application I have actived a thread to test
if data are incoming every 100 milliseconds. When a data
comes, the ActiveX function freeze until I move the mouse
over the XBPWindow.

So I thought that there are a sort of incompatibility between the 
ActiveX component and the Xbase++ multithreading system.

To solve this, I'm trying to use a polling system avoiding 
multithreading. Another test can be to simulate a motion of the
mouse over the window in a third thread.

So the question is, how I can send a motion request to the mouse with 
AppEvent set of functions?

Sorry I'm not very able to interact with OS.

Thanks
Claudio


PLCTest.PRG
Jim LeeRe: PLC, Mouse motion and thread.
on Sun, 22 Apr 2018 17:49:18 +0200
hi,

we had that Problem with WebCAM that you have to "move Mouse"

  ::nHCapture    := delegated_eval( {|| 
capCreateCaptureWindow(cCaption,WS_VISIBLE + 
WS_CHILD,0,0,aWinSize[1],aWinSize[2],::nHandle,nId)} )

if this does not work for you here other Way to "move Mouse"

FUNCTION MAUS2MOVE( x, y )
*  DllCall( 'User32', DLL_STDCALL, 'mouse_event', 32769, x, y, 0, 0 )
   mouse_event( 32769, x, y, 0, 0 )
RETURN NIL

FUNCTION mouse_event(dwFlags,dx,dy,dwData,dwExtraInfo)
LOCAL cInput := cGenMouseInput( dx , dy , dwData , dwFlags )
LOCAL nRet   := 0
   nRet := SendInput( cInput )
RETURN nRet

FUNCTION cGenMouseInput( dx , dy , data , flags , time , extra )
LOCAL cString
DEFAULT dx     TO 0
DEFAULT dy     TO 0
DEFAULT data   TO 0
DEFAULT flags  TO 0
DEFAULT time   TO 0
DEFAULT extra  TO 0
RETURN PadR( U2Bin( 0 ) + L2Bin( dx )  + L2Bin( dy ) + U2Bin( data ) +;
             U2Bin( flags ) + U2Bin(time ) + U2Bin( extra ) , 28 , Chr(0) )

FUNCTION SendInput( cInput )
RETURN DllCall( "user32",32,"SendInput", Int(Len(cInput) / 28) , cInput , 
28)
Claudio Driussi Re: PLC, Mouse motion and thread.
on Mon, 23 Apr 2018 09:13:01 +0200
Il 22/04/2018 17:49, Jim Lee wrote:
> hi,
> 
> we had that Problem with WebCAM that you have to "move Mouse"

I will try today.

Thanks Jim.


> 
>    ::nHCapture    := delegated_eval( {||
> capCreateCaptureWindow(cCaption,WS_VISIBLE +
> WS_CHILD,0,0,aWinSize[1],aWinSize[2],::nHandle,nId)} )
> 
> if this does not work for you here other Way to "move Mouse"
> 
> FUNCTION MAUS2MOVE( x, y )
> *  DllCall( 'User32', DLL_STDCALL, 'mouse_event', 32769, x, y, 0, 0 )
>     mouse_event( 32769, x, y, 0, 0 )
> RETURN NIL
> 
> FUNCTION mouse_event(dwFlags,dx,dy,dwData,dwExtraInfo)
> LOCAL cInput := cGenMouseInput( dx , dy , dwData , dwFlags )
> LOCAL nRet   := 0
>     nRet := SendInput( cInput )
> RETURN nRet
> 
> FUNCTION cGenMouseInput( dx , dy , data , flags , time , extra )
> LOCAL cString
> DEFAULT dx     TO 0
> DEFAULT dy     TO 0
> DEFAULT data   TO 0
> DEFAULT flags  TO 0
> DEFAULT time   TO 0
> DEFAULT extra  TO 0
> RETURN PadR( U2Bin( 0 ) + L2Bin( dx )  + L2Bin( dy ) + U2Bin( data ) +;
>               U2Bin( flags ) + U2Bin(time ) + U2Bin( extra ) , 28 , Chr(0) )
> 
> FUNCTION SendInput( cInput )
> RETURN DllCall( "user32",32,"SendInput", Int(Len(cInput) / 28) , cInput ,
> 28)
> 
>