Le 17 oct. 2015 à 17:13, Christian Schmitz <[email protected]> a 
écrit:

>> work (arrow keys, or delete, for instance, but there are numerous failing 
>> keys).
> 
> Well, for those you may just go with hard coding the combinations.

Yes, but for that, I have to find the code. I tried a loop from 0 to 300, with 
RemoteControlMBS.WinPressKey and no value produced these keys (I tried in a 
TextArea full of text); that's why I think something is broken, since at 128, 
it starts over like from 0. Can you actually produce an arrow key or delete on 
your Win32 computer?

>> On Mac, most keys work; however, I've had to make a “select case” for the 
>> arrow keys and the “o” key (strange for the “o” key; “O” is recognised just 
>> fine, as are all the other characters…) since they all fail to be recognised 
>> by RemoteControlMBS.MacTextForKeyCode(i,3,j) (I've made like the example, 
>> with a loop, testing all key modifiers combinations).
> 
> If you have a sample project there, maybe email it to me so I can check it 
> here.

This is the code I made:
Function MacFindVirtualKeyForKey(Key As String,ByRef Shift As Boolean,ByRef 
Option As Boolean,ByRef Ctrl As Boolean) As Integer
  dim c,o,s As Boolean
  dim i,j As Integer
  
  do
    j=0
    if c then j=j+16
    if o then j=j+8
    if s then j=j+2
    for i=0 to 127
      dim t As String=RemoteControlMBS.MacTextForKeyCode(i,3,j)
      if StrComp(Key,t,0)=0 then
        Shift=s
        Option=o
        Ctrl=c
        Return i
      end if
    next
    c=not c
    if not c then
      o=not o
      if not o then
        s=not s
        if not (c or o or s) then exit
      end if
    end if
  loop
  Return -1
End Function
Call it so:
dim ak,ck,sk as boolean
dim j as integer

j=me.MacFindVirtualKeyForKey("o",sk,ak,ck)
break

I'm getting j=-1, just for o and arrow keys.

> That's documented by apple. It just changes the mouse position.

So how does Remote Desktop and (if I recall correctly) TeamViewer work around 
this issue?

> I am not sure about those. Maybe NSEventMonitorMBS can catch a few as well as 
> WindowsKeyFilterMBS class.

Ok, I will try these.

>> For Command-Tab, I tried several things, like a CarbonHotKeyMBS (not caught) 
>> and NSEventMBS seem to imply one cannot handle global events (which I assume 
>> Command-Tab is). On the Internet, I found one suggestion about using Event 
>> Traps (I don't know how to use it) and one piece of code:
> 
> Event taps need root permissions. So I didn't implement them.

Do you know they would work for that? Apple Remote Desktop catches Command-Tab 
and send it further (but TeamViewer doesn't), which implies it's doable. For 
now, I think I'll just catch Option-Tab and convert it to Command-Tab on the 
remote side (in addition, Windows to Mac would work like that anyway).

Thank you.
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to