Jump to content
Sign in to follow this  
Guest steels214

simconnect focus

Recommended Posts

Guest steels214

HiI have a simconnect client gui program that displays a bunch of data from fsx on it. I also have a couple of buttons on there to switch between the different data that is being displayed. I have a two monitor setup. An OTW monitor and a monitor that displays gauges on 1/2 the screen and my simconnect gui on the other half. The annoying problem that I have is, whenever I'm clicking stuff on my sim gui, the sound turns off of flight sim because it loses focus. Does anyone know of a way to keep flight sim in the "main focus?", but still be able to click buttons on my gui? Is this even possible?Thanks in advance

Share this post


Link to post
Share on other sites

>Hi>>I have a simconnect client gui program that displays a bunch>of data from fsx on it. I also have a couple of buttons on>there to switch between the different data that is being>displayed. >>I have a two monitor setup. An OTW monitor and a monitor that>displays gauges on 1/2 the screen and my simconnect gui on the>other half. The annoying problem that I have is, whenever I'm>clicking stuff on my sim gui, the sound turns off of flight>sim because it loses focus. >>Does anyone know of a way to keep flight sim in the "main>focus?", but still be able to click buttons on my gui? Is>this even possible?>>Thanks in advance>Windows doesn't really allow this as far as I know, because clicking on a window in any way attempts to send focus to it. The only thing I can think of is child windows that block you from transferring focus to the parent.Anyways, if you have the available button presses, like weird combinations that you don't use, you can mask and capture them through simconnect and have your program respond to the event without ever leaving the program.

Share this post


Link to post
Share on other sites
Guest steels214

Ohh. I had to read your response a few times to understand what you were saying. That's an interesting idea. But that restricts me to only using weird keyboard combinations and no mouse clicks. I was hoping maybe there was a cfg line somewhere in flight sim that would always keep the sound running even if it was in the background. That would be the easy route. If no cfg available, then I was hoping it wasn't too difficult to program.Anyway, Thanks for the ideas.

Share this post


Link to post
Share on other sites
Guest steels214

I just realized something. I've had add-ons that run with flight sim and don't take away the focus. They remain on top for some reason. I could turn them on from the flight sim menu bar across the top. I think a flight sim dll would call the add-on executable. I'm not sure how all this works, but I know now that it does actually work. Well, looks like I have some more coding to do.

Share this post


Link to post
Share on other sites

Those addons don't run as a seperate executable but are packaged as a DLL that loads directly within the FS process space and their window(s) are created as children of the main FS window, which allows this to display above the FS windows and not take primary focus away from the app.

Share this post


Link to post
Share on other sites

>Those addons don't run as a seperate executable but are>packaged as a DLL that loads directly within the FS process>space and their window(s) are created as children of the main>FS window, which allows this to display above the FS windows>and not take primary focus away from the app.>>That actually makes a lot of sense. I haven't worked much will add-ons as DLLs yet.The other option would be to use the new menu API

Share this post


Link to post
Share on other sites
Guest steels214

Ok. So I created a dll using VC2005. It'll start up with flight sim just fine and sim connect to it and everything. But I can't make the gui that I built do the same. I'm not real good with dll's but i guess since its just a library I can't really make a gui out of it? First I tried the system("notepad") from the dll that I made. Notepad starts up but flight sim won't continue execution until I exit notepad. So I tried AfxBeginThread(mythread), that contained the system("notepad") in it, and flight sim since waits for me to exit notepad before continuing. Also, if I click on notepad, the sound goes away from flight sim. But, if I don't call system() and have mythread() do something like:for (int i=0;i<1000000;i++){ if ( (i%10000) == 0) printf("something"); // printts to simconnect diagnostic window}FS runs while this for loop is happening.I haven't tried it yet, but this makes me think that calling system("notepad") from a flight sim menu may have the same behavior. Maybe, maybe not. I guess we'll just have to see.Any ideas?

Share this post


Link to post
Share on other sites

>I haven't tried it yet, but this makes me think that calling>system("notepad") from a flight sim menu may have the same>behavior. Maybe, maybe not. I guess we'll just have to see.>>Any ideas?Running Notepad or any other process from your DLL is not the same as creating your own dialogue in-process. All you are doing is spawning another process, outside FS. When that has the focus, FS doesn't, so it is just the same as running your program outside of FSX in the first place.Havng gone to all the trouble of running INSIDE the FS process so that it doesn't lose focus, you now have to go the extra distance and create your GUI dialogues as child windows of FS, running inside that same process.Pete


Win10: 22H2 19045.2728
CPU: 9900KS at 5.5GHz
Memory: 32Gb at 3800 MHz.
GPU:  RTX 24Gb Titan
2 x 2160p projectors at 25Hz onto 200 FOV curved screen

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...