Jump to content
The simFlight Network Forums

rfresh

Members
  • Posts

    128
  • Joined

  • Last visited

Posts posted by rfresh

  1. Hi Pete

     

    I got my two Win7 PCs networked together via HomeGroup and using my wifi network. I can access files on each machine from the other machine to include copying files and creating folders. So, I think my two PCs are connected together.

     

    I run WidePS on my #2 machine but it never connects/sees FSx running on my #1 machine.

     

    Here is the WideClient.log file below.

     

    I guess I don't have something set right eh?

     

    Thanks...

     

     ********* WideClient Log [version 6.999n] Class=FS98MAIN *********

    Date (dmy): 30/01/15, Time 19:30:42.289: Client name is JANIS-PC
          140 LUA: "C:\WideClient\Initial.LUA": not found
          156 Attempting to connect now
          156 Trying to locate server: Need details from Server Broadcast
          156 Failed to connect: waiting to try again
         2199 Attempting to connect now
        45006 Trying to locate server: Need details from Server Broadcast
     
       204564 ****** End of session performance summary ******
       204564 Total time connected = 0 seconds
       204564 Reception maximum:  0 frames/sec, 0 bytes/sec
       204564 Transmission maximum:  0 frames/sec, 0 bytes/sec
       204564 Max receive buffer = 0, Max send depth = 0, Send frames lost = 0
     
       204564 ********* Log file closed (Buffers: MaxUsed 0, Alloc 0 Freed 0 Refused 0) *********
     
  2. Update: Here is the answer to my question on how to detect if FSX is in Full Screen mode or windowed mode.

     

    It turns out it's not so easy to determine that. MS doesn't have a direct property for that so one has to use other mechanisms to achieve the same results.

     

    Here is my solution in C# code that may help others who need to do the same thing.

     

    I had to put this code in a timer, checking every 5 secs to see what mode fsx is in, then act accordingly for what I need to do.

     

    I debugged this code using file writes since when fsx is in full window mode you can't have access to your app. I checked my debug writes to determine everything was working as expected to detect when fsx was in full screen mode. Then I sent the Alt-Enter command and fsx flipped back to windowed mode as I wanted.

     

    I hope this helps someone else.

     

            private void timer_Tick(object sender, EventArgs e)
            {
                // first we use the GetProcessByName function to try and find fsx if it is running
                System.Diagnostics.Process[] ieProcs = Process.GetProcessesByName("fsx");
                if (ieProcs.Length > 0)
                {
                    foreach (System.Diagnostics.Process p in ieProcs)
                    {
                        // we have found fsx so it is running but we don't know yet what mode it is in
                        hWnd = p.MainWindowHandle;
                        // we will now attempt to get the fsx form title
                        const int count = 512;
                        var text = new StringBuilder(count);
                        if (GetWindowText(hWnd, text, count) > 0)
                        {
                            // we got it ! so this means fsx is in windowed mode
                            // I can successfully pop up my app when fsx is in windowed mode, so that's all I need here at this point
                        }
                        else
                        {
                            // no title text so this means fsx is in full screen mode
                            // do what ever you need to do here - in my case I send Alt-Enter to flip it back to windowed mode so I can pop up my app
                        }
                    }
                }
            }
     

     

  3. Hi Paul,

     

    There is a facility in FSUIPC to restore focus to FS, specifically for the keypress control. Please see my last answer to your question in the main forum, i.e. thread

     

    http://forum.simflight.com/topic/78544-help-with-sending-key-presses-with-control-1070-via-0x3110/

     

    Pete

     

    Hi Pete

     

    Is there a way to detect which window mode FSX is in? Obviously I'm using Alt-Enter to toggle FSX in and out of full screen mode. But it would be handy to know first if FSX was already in window mode so then I don't have to send the Alt-Enter command.

     

    Thanks...

  4. OK, thanks Paul.

     

    I'm certainly not a sharp C# developer by any means, but maybe the following code structure might help you in a small way. I use it to find running applications and I hardly use its full capabilities, but maybe there is something in that 'p' structure that will allow you to focus fsx. It's just code snippets from various things I've needed to do, nothing specific to what you need but maybe it will give you some idea's.

     

                System.Diagnostics.Process[] ieProcs = Process.GetProcessesByName("fsx");
                if (ieProcs.Length > 0)
                {
                    foreach (System.Diagnostics.Process p in ieProcs)
                    {
                        //this.Text = p.ProcessName;
                        //hWnd = p.MainWindowHandle;
                        // 0 hide
                        // 1 show
                        //this.ShowWindow(p.MainWindowHandle, 1);
                        hWnd = p.MainWindowHandle;
     
                        int style = GetWindowLong(hWnd, GWL_STYLE);
                        SetWindowLong(hWnd, GWL_STYLE, (style | WS_CAPTION));
                        SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
     
                        //hWnd.WindowState = FormWindowState.Maximized;
                        //hWnd.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
                        // 0 hide
                        // 1 show normal
                        // 2 show minimized
                        // 3 show maximized
                        // 5 show
                        // 6 minimize
                        // 9 restore
                        //p.Kill();
                    }
                }
     
  5. Hi Paul

     

    I want to send Alt-Enter to FSX to toggle it in and out of full screen mode.

     

    I can't find in the docs what the values are for the Alt key and the Enter key?

     

    I will this structure below you gave to me in another thread to send these key strokes to FSX:

     

    sendControl.Value = 65752; // parking brakes
    FSUIPCConnection.Process("SendControl");

     

    Thanks...

     

  6. Hi Paul

     

    My Visual Studio 2013 C# app runs fine inside the VS 2013 IDE.

     

    When I compile the app and try to run its exe outside of VS 2013 I get the following error on start up:

     

    ************** Exception Text **************
    System.IO.FileNotFoundException: Could not load file or assembly 'FSUIPCClient, Version=3.0.5495.14, Culture=neutral, PublicKeyToken=7e7559b53e380b17' or one of its dependencies. The system cannot find the file specified.
    File name: 'FSUIPCClient, Version=3.0.5495.14, Culture=neutral, PublicKeyToken=7e7559b53e380b17'
     
    I checked the FSUIPC DLL path in the VS Solution Explorer and the path is set correctly in References.
     
    There must be something else I don't have configured correctly in my VS 2013 IDE for building my solution?
     
    Thanks...
     
  7. Hi Pete

     

    My Visual Studio 2013 C# app runs fine inside the VS 2013 IDE.

     

    When I compile the app and try to run its exe outside of VS 2013 I get the following error on start up:

     

    ************** Exception Text **************
    System.IO.FileNotFoundException: Could not load file or assembly 'FSUIPCClient, Version=3.0.5495.14, Culture=neutral, PublicKeyToken=7e7559b53e380b17' or one of its dependencies. The system cannot find the file specified.
    File name: 'FSUIPCClient, Version=3.0.5495.14, Culture=neutral, PublicKeyToken=7e7559b53e380b17'
     
    I checked the FSUIPC DLL path in the VS Solution Explorer and the path is set correctly in References.
     
    There must be something else I don't have configured correctly in my VS 2013 IDE for building my solution?
     
    Thanks...
     
  8. I meant more like when someone starts up my app, before I start making use FSUIPC, can I detect if they even have it installed? My situation may be a bit different than most because I'm using FSUIPC and Paul's .NET .DLL to communicate with FSX. The .DLL of course is always in my code but it uses FSUIPC to 'talk' to FSX. If a user has not installed FSUIPC, then my app can't talk to FSX. So, I was wondering the best way to check if they have FSUIPC at all.

  9. It worked!! This put 3456 pounds of fuel in the center tank, via the left side CDU!!

    Thanks so much Paul and Pete for you help on this issue!

     

                // Press MENU button            
                sendControl.Value = THIRD_PARTY_EVENT_ID_MIN + 551;
                controlParameter.Value = MOUSE_FLAG_LEFTSINGLE;
                FSUIPCConnection.Process("SendControl");
                // Press FS ACTIONS> LSK5R
                sendControl.Value = THIRD_PARTY_EVENT_ID_MIN + 544;
                controlParameter.Value = MOUSE_FLAG_LEFTSINGLE;
                FSUIPCConnection.Process("SendControl");
     
                // Press <FUEL LSK1L
                sendControl.Value = THIRD_PARTY_EVENT_ID_MIN + 534;
                controlParameter.Value = MOUSE_FLAG_LEFTSINGLE;
                FSUIPCConnection.Process("SendControl");
     
                // Press digit 3
                sendControl.Value = THIRD_PARTY_EVENT_ID_MIN + 563;
                controlParameter.Value = MOUSE_FLAG_LEFTSINGLE;
                FSUIPCConnection.Process("SendControl");
     
                // Press digit 4
                sendControl.Value = THIRD_PARTY_EVENT_ID_MIN + 564;
                controlParameter.Value = MOUSE_FLAG_LEFTSINGLE;
                FSUIPCConnection.Process("SendControl");
     
                // Press digit 5
                sendControl.Value = THIRD_PARTY_EVENT_ID_MIN + 565;
                controlParameter.Value = MOUSE_FLAG_LEFTSINGLE;
                FSUIPCConnection.Process("SendControl");
                // Press digit 6
                sendControl.Value = THIRD_PARTY_EVENT_ID_MIN + 566;
                controlParameter.Value = MOUSE_FLAG_LEFTSINGLE;
                FSUIPCConnection.Process("SendControl");
     
                // Press LSK5L to send fuel load to tank 2
                sendControl.Value = THIRD_PARTY_EVENT_ID_MIN + 538;
                controlParameter.Value = MOUSE_FLAG_LEFTSINGLE;
                FSUIPCConnection.Process("SendControl");
     
  10. Here is the event logging when I mouse click on the left CDU MENU button:

       103304 *** EVENT: Cntrl= 70183 (0x00011227), Param= 536870912 (0x20000000)  <70183>
       103382 *** EVENT: Cntrl= 70183 (0x00011227), Param= 131072 (0x00020000)  <70183>
     
    One must be mouse down and the other mouse up?
     
    These are clicking on the FS ACTIONS LSK5R
       329786 *** EVENT: Cntrl= 70176 (0x00011220), Param= 536870912 (0x20000000)  <70176>
          329958 *** EVENT: Cntrl= 70176 (0x00011220), Param= 131072 (0x00020000)  <70176>
     
  11. Mabye thats the problem...I need to be using mouse clicks instead of key presses...I see if I can do that...thanks...

     

    Update:

     

    From the FSUIPC debugger I can see that

    #define MOUSE_FLAG_LEFTSINGLE    0x20000000

     

    0x20000000 is the left mouse click event being fired.

     

    But how does one use that in this:

                // Press MENU button

                sendControl.Value = THIRD_PARTY_EVENT_ID_MIN + 551;
                FSUIPCConnection.Process("SendControl");
     
    This tells FSUIPC which button (Menu) to press but how to tell it by the mouse click?
     
    Perhaps in the definition of the offset?
    private Offset<int> sendControl = new Offset<int>("SendControl", 0x3110, true);
     
    Thanks...
  12. The code to toggle the parking brakes works fine on the PMDG 737NGX. I can set and release them OK.

     

    Here is the events log from running my code as shown above:

     

       968579 *** EVENT: Cntrl= 70183 (0x00011227), Param= 0 (0x00000000)  <70183> MENU Button
       968579 *** EVENT: Cntrl= 70176 (0x00011220), Param= 0 (0x00000000)  <70176> FS ACTIONS LSK
       968579 *** EVENT: Cntrl= 70166 (0x00011216), Param= 0 (0x00000000)  <70166> FUEL LSK
       968579 *** EVENT: Cntrl= 70195 (0x00011233), Param= 0 (0x00000000)  <70195> 3 digit
       968579 *** EVENT: Cntrl= 70196 (0x00011234), Param= 0 (0x00000000)  <70196> 4 digit
       968579 *** EVENT: Cntrl= 70197 (0x00011235), Param= 0 (0x00000000)  <70197> 5 digit
       968579 *** EVENT: Cntrl= 70198 (0x00011236), Param= 0 (0x00000000)  <70198> 6 digit
       968595 *** EVENT: Cntrl= 65752 (0x000100d8), Param= 0 (0x00000000) PARKING_BRAKES
     
    I'm not sure what debug checkboxes I should check in FSUIPC to be more helpful?
     
    UPDATE: I'm missing the last key stroke, a LSK 5L to put the digits into tank 2. Let me try that.
     
    That didn't help any:
                // Press LSK5L to send fuel load to tank 2
                sendControl.Value = THIRD_PARTY_EVENT_ID_MIN + 538;
                FSUIPCConnection.Process("SendControl");
     
    Here I'm just pressing the MENU button on the left CDU...70183 is the correct number (69632+551). The CDU was on the LEGS page and did not change to the MENU page. The brakes of course toggled correctly.
     
      2119648 *** EVENT: Cntrl= 70183 (0x00011227), Param= 0 (0x00000000)  <70183> MENU Button press only
      2119648 *** EVENT: Cntrl= 65752 (0x000100d8), Param= 0 (0x00000000) PARKING_BRAKES
     
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.