
Paul Henty
Members-
Posts
1,724 -
Joined
-
Days Won
77
Content Type
Profiles
Forums
Events
Gallery
Downloads
Everything posted by Paul Henty
-
Yeah, there were some internal tables that were not getting cleared. Fix attached. Paul FSUIPCClient3.0_BETA.zip
-
>> So, I'm thinking I should be able to re-connect and re-build the addmenuitems and addkeypresss...yes? Yes, sounds like something isn't getting cleared properly. I'll have a look this evening. Paul
-
Seems to be sorted now. It was just a timing issue with WideFS. Everything was fine locally, but the DLL wasn't leaving enough time for the network roundtrip when running remotely. New version attached. Also added are two new methods: 1. FSUIPCConnection.SendControlToFs(ControlNumber, ParameterValue); This just sends the control immediately (no need for a Process() call) and just saves a bit of typing. What might be helpful is that there are overloads that take an Enum instead of the raw control number. For example: FSUIPCConnection.SendControlToFS(FsControl.PARKING_BRAKES, 0); will toggle the parking brake. A parameter is not required for this control so it's just set to 0. Enums available are: FsControl - the normal FSX/P3D list of controls FSUIPCControl - Additional controls added by FSUIPC FSUIPCAxesControl - Used to control axed assign directly in FSUIPC FSUIPCAutoPilotControl PMControl - Controls for Project Magenta software PMDG_737_NGX_Control - Controls defined in the PMDG 737 NGX SDK 2. FSUIPCConnection.SendKeyToFS(Key, Modifier, ReturnFocusToForm); This sends a key stroke to the FS window. The Modifier and ReturnFocusToForm are optional. e.g. This sends Control-L and return focus back to the application form: FSUIPCConnection.SendKeyToFS(Keys.L, SendModifierKeys.Control, this); This is also instant (no need to Process()) and also sets the focus to the FSX window automatically. Both work over WideFS. Paul FSUIPCClient3.0_BETA.zip
-
Okay - I'll check that too. Yes, the event should just fire once per key press and you check the ID. I'll fix this as well. You must be the first person to use these User Input facilities. They have been there for about three years but are clearly a bit broken. I'll likely have a new version tomorrow. Paul
-
Ah, I'm managed to reproduce this. It only happens if you add the keys before the menus. There's obviously a bug in my DLL and the menus are trampling over the key presses. Sorry this has taken so long to get the bottom of. I'll get it fixed as soon as I can. In the mean time registering the buttons after the menus in your program might make it work properly. Paul
-
Hi Ralph, On the WideClient machine you can run your program and it will add items to the FSX menu, on the FSX machine. When you select these menus from within FSX your program on the WideClient PC will respond just the same as it does when running locally. Whether this is useful or not is dependent on the application I guess, but I'm just trying to see if the menus work remotely as menus use the same signalling system used by the Key presses we're trying to get to work. I've managed to set up a WideFS setup here and the code in #7 works fine locally or on my WideClient machine. Do you have two programs running at the same time? One on the FSX PC and one on the WideClient pc? The code in #7 must be placed in the program running on the WideClient pc. Paul
-
Ralph, All you should need is the code I posted in #7 above. In the background this is using the 0x3210 hotkey facilities. As you've seen this works fine when you're running your app on the same machine as FSX: Now Pete has confirmed this should also work on the WideClient pc we just need to work out why it doesn't. I think this will be easier than getting SendKeys to work and overall a cleaner way of handling this. Can you confirm that you're using exactly the same .exe to test on both PC's? Do your FSX menu additions work on the WideClient pc? Paul
-
If you mean sinking the KeyPress event on the Form then yes. You will need to set the KeyPreview property of the form to 'true' as well. However, from reading the WideFS documentation you'll need to add information to the KeySend definition in the ini file to direct the key press to the correct window (i.e. your application). I should say that I believe Pete has misunderstood what you want to do. I don't think he realised that your application is already communicating with FSUIPC and reading offsets etc. From his last reply to me it's clear that the FSUIPC HotKeys facility at 0x3210 (UserInputServices in my DLL) should work fine across WideFS. In my opinion this is a far better solution than having to configure keys and ini settings on the FSX PC and then trap the resulting real key presses on the Client PC in a .NET form. Paul
-
Hi Pete, Thanks for chipping in again. Unfortunately I've steered Ralph down the wrong path again as I've misunderstood things. The documentation for the HotKeys feature at 0x3210 says: "This system will work through WideFS with no problems too.". If it doesn't trap the key on the FSX PC and mark byte 3 of the key slot as pressed so the clients can see it, how does it work through WideFS? Thanks, Paul
-
Hi Ralph, The key is not set up in the FSUIPC interface. Your application registers the key with FSUIPC and will be notified when it's pressed by the user on the FSX machine. This is a feature of the UserInputServices which you've used to create your menus and works in a very similar way. The following code shows registering ctrl-1 and sinking the KeyPressed event so you know when one of your keys is pressed. You then get the ID from the EventArgs to see which one. As you already have menus working I've left out the code to set-up a timer to do the CheckForInput() as you'll already have that. This is just the additional code you need. 1. Register the key press and sink the event UserInputServices ui = FSUIPCConnection.UserInputServices; ui.AddKeyPresss("Button1", FSUIPC.ModifierKeys.Ctrl, Keys.D1, false); // Three s's - typo in my dll. // Register more keys here. ui.KeyPressed += new EventHandler<UserInputKeyEventArgs>(ui_KeyPressed); 2. The event handler private void ui_KeyPressed(object sender, UserInputKeyEventArgs e) { MessageBox.Show("Pressed " + e.ID); } Paul
-
There's nothing you need to do differently. WideClient is designed to be exactly like having the flight sim on the local PC. Which error message are you getting? Paul
-
Just once when you start the application; it will be valid for as long as FSX is running. There's no point in repeatedly opening and closing the connection. You should have the Process() calls (and similar calls on the special services classes like PayloadServices.RefreshData()) in Try-Catch blocks so you can detect if the connection is ever lost. Then your application can close() the now broken one and then attempt to open() a new one. Paul
-
Ralph, Since Pete has pointed out an easy way to give focus to FSX, sending alt-enter now becomes fairly simple. The code is below. I will still add a feature to the DLL to make sending key strokes a bit easier and less verbose. Declarations: private Offset<int> controlParameter = new Offset<int>("SendControl", 0x3114, true); private Offset<int> sendControl = new Offset<int>("SendControl", 0x3110, true); private readonly int KEY_PRESS_RELEASE = 1070; private readonly int KEY_FOCUS_RESTORE = 1125; Main Code: // Set FSX as active window sendControl.Value = KEY_FOCUS_RESTORE; FSUIPCConnection.Process("SendControl"); // Send alt-enter sendControl.Value = KEY_PRESS_RELEASE; controlParameter.Value = (int)(Keys.Enter) + (256 * 16); FSUIPCConnection.Process("SendControl"); Paul
-
Thanks Pete. That's much simpler than calling into the Win32 API. Paul
-
Yes that's useful. Thanks. Paul
-
Hi - The key press control only sends the keys to the active window so it's not as simple as it first looked. Switching focus to FSX is fairly complicated in C# so I'll have a look at building a keysend facility into the DLL this week. Paul
-
FSUIPC offset control throttle
Paul Henty replied to Chatchai Suttisatid's topic in FSUIPC Client DLL for .NET
Since this offset is only 2 bytes long you should declare the offset as a shot integer like this: private Offset<short> ENG1 = new Offset<short>(0x088C); The value you write in the offset doesn't determine its size in bytes. A 0 stored in an 'int' is still 4 bytes long. Declaring the correct variable type for each offset is very important. My UserGuide.pdf (located in the 'Docs' folder of the FSUIPCClient DLL Zip file) has a table on page 7 explaining what C# types to use given the size of the offset. Paul -
Okay - I'm looking into sending the key press but I can't get the key send control to work at the moment. I've asked Pete for some help so bear with me. The full list of FSX/P3D controls is under your main FSX folder in the "Modules\FSUIPC Documents" folder. It's called "List of FSX and P3D controls,pdf". In addition FSUIPC also has it's own set of controls listed in "FSUIPC4 for Advanced Users.pdf". (same folder). Paul
-
Hi Pete, I'm trying to send key presses to FSX using the 1070 control sent via offset 0x3110. (FSUIPC Version 4.938f). In my test I'm using the 'L' key to toggle the lights. According to the logging the key seems to be getting through and is sent, but the lights do not toggle. Here's me pressing 'L' on the keyboard: - the lights get toggled. 2202204 KEYDOWN: VK=76, Waiting=0, Repeat=N, Shifts=0 2202204 .. Key not programmed -- passed on to FS 2202204 *** EVENT: Cntrl= 65574 (0x00010026), Param= 0 (0x00000000) ALL_LIGHTS_TOGGLE 2202266 KEYUP: VK=76, Waiting=0 This is my program sending the 1070 control via 3110. All seems okay and the log is reporting the [L] key press being made, but the lights control is not triggered. 2205360 WRITE repeated 1 times 2205360 WRITE0[2788] 3114, 4 bytes: 4C 00 00 00 L... 2205360 WRITE0[2788] 3110, 4 bytes: 2E 04 00 00 .... 2205360 FSUIPC Control Action: Ctrl=1070, Param=76 2205360 SendKeyToFS(0000004C=[L], KEYDOWN) ctr=0 2205360 Sending WM_KEYDOWN, Key=76 (Scan code 38), Ctr=1 2205500 SendKeyToFS(0000004C=[L], KEYUP) ctr=0 2205500 Sending WM_KEYUP, Key=76 (Scan code 38), Ctr=1 Have I got something wrong here or have I misunderstood what 1070 is meant to do? Thanks, Paul
-
Looking through the control list document there is this control: FULL_WINDOW_TOGGLE 65553 There seems to be some confusion about if this is P3D only but it's worth a try for FSX. A dedicated control is much better than sending a key press. If that doesn't work or does something different than the full screen toggle then I'll have a look at the key press route. Paul
-
How to add a menu separator in FSX
Paul Henty replied to rfresh's topic in FSUIPC Client DLL for .NET
Hi, I've looked at the SimConnect SDK and I can't see any support there for adding a menu separator. There's no mention of it in the FSUIPC docs either so I would say it's not possible via FSUIPC. If Pete knows differently I'm sure he'll chip in. Paul -
Hi Motus, I've highlighted where your mistakes are. It looks like you've copied and pasted from the one above, but not changed all the variable names. Paul
-
Could not load file or assembly 'FSUIPCClient
Paul Henty replied to rfresh's topic in FSUIPC Client DLL for .NET
Two things to check: 1. The FSUIPCClient.dll is in the same folder as your .exe. All supporting DLLs must be placed alongside your .exe. 2. If you've used the 'release' build profile, make sure it's also set to compile to a 32bit (x86) .exe. Otherwise it will run as a 64bit .exe and won't be able to load the FSUIPCClient.dll. for #2: go to the properties of your project go to the 'build' tab on the left, select the 'release' profile from the 'configuration' dropdown near the top. Make sure the 'platform target' is set to 'x86'. Paul