yindengxie Posted March 31, 2021 Report Share Posted March 31, 2021 Hi, I add the following two lines to FSUIPC6.INI [Programs] Run1=READY,KILL,C:\FSUIPC_YIN\\Release\FSUIPC_YIN.EXE -------------------------------------------------------------- P3D can load and run the additional program. However, the first time, P3D display screen must be refreshed by HAND operation, the additional program can communicate with P3D and our simulator main program in the later. Question: Can P3D automatically load and run the additional program, NOT need to refresh P3D display screen by HAND operation in the first time? THANKS for your help! Link to comment Share on other sites More sharing options...
Pete Dowson Posted April 1, 2021 Report Share Posted April 1, 2021 11 hours ago, yindengxie said: Question: Can P3D automatically load and run the additional program, NOT need to refresh P3D display screen by HAND operation in the first time? Sorry, I don't understand what you men. The P3D window has nothing to do with other programs which may be run via [Programs] -- unless those programs themselves are causing a problem. I do not know this "FSUIPC_YIN.EXE". I have many programs loaded in this way, and P3D still loads and displays perfectly. For example, this is an older version from my cockpit setup: [Programs] RunIf1=AM=x88,CLOSE,MIN,"E:\REX Sky Force 3D for Prepar3D v4\rexskyforce.exe" RunIF2=AM=x4C,KILL,"E:\mcp\pfcmcp.exe" RunIF3=AM=x3C,READY,CLOSE,"E:\ProSim737\prosim737.exe" RunIF4=AM=x4C,READY,CLOSE,"E:\ProSimMCP\prosimMCP.exe" RunIF5=AM=x48,KILL,"E:\pmsounds\pmSounds.exe" RunIF6=AM=x24,CLOSE,"E:\ProSimAudio\ProsimAudio.exe" RunIF7=AM=xC4,CLOSE,"C:\Program Files (x86)\HiFi\AS_P3Dv4\AS_P3Dv4.exe" RunIF8=AM=x50,CLOSE,"C:\Program Files\AivlaSoft\EFB2\Server\AivlaSoft.Efb.Server.exe" RunIf9=AM=xA0,READY,CLOSE,"C:\Program Files\FSPS LTD\FFTF Dynamic P3Dv4\FFTF Dynamic P3Dv4.exe" RunIf10=AM=x48,READY,CLOSE,"E:\SimSounds\SimSounds.exe I think you need to check exactly what that "FSUIPC_YIN" program is doing. Pete Link to comment Share on other sites More sharing options...
yindengxie Posted April 1, 2021 Author Report Share Posted April 1, 2021 while (1) { //--------------- Read UDP Data Begin ---------------------------------------- Sleep (10); //100 VisualToServer.MsgID = 5; VisualToServer.View.HAT = HAT = 1.0; VisualToServer.View.elevMeter = elevMeter; VisualToServer.View.pitchBack = pitchBack = PitchPosition; VisualToServer.View.rollBack = rollBack = RollPosition; VisualToServer.View.rudderBack = rudderBack = RudderPosition; int ret = sendto(sServer, VisualToServer.temp, sizeof(TVisualToServer), 0, (SOCKADDR *)&recipientServer, sizeof(recipientServer)); if (ret == SOCKET_ERROR) printf("sendto() failed; %d\n", WSAGetLastError()); //-------- Read UDP Data Begin ---------------------------------------------------------- FD_ZERO(&ReadSet); //Prepare the Read and Write socket sets for network I/O notification. FD_SET(sVIS, &ReadSet); //Always look for connection attempts. //Set Read notification for the socket based on the current state the buffer. //If there is data remaining in the buffer then set the Write set otherwise the Read set. if ((ret = select(0, &ReadSet, NULL, NULL, &waittime)) == SOCKET_ERROR) { printf("select() returned with error %d\n", WSAGetLastError()); } if (ret != 0) { int nRead = recv(sVIS,ServerToVisual.temp,sizeof(ServerToVisual.temp),0); if (nRead == SOCKET_ERROR) { printf("recv() failed; %d\n", WSAGetLastError()); } else { msgID = ServerToVisual.View.MsgID; LatYin = ServerToVisual.View.lat; //Degree LonYin = ServerToVisual.View.lon; //Degree AltYin = ServerToVisual.View.alt; //Meter PitchYin = (-ServerToVisual.View.pitch * 57.3); //Degree BankYin = (-ServerToVisual.View.bank * 57.3); //Degree HeadingYin = ServerToVisual.View.heading * 57.3; //Degree } } //----------------- Read UDP Data End -------------------------- //----------------- Latitude Begin ----------------------------- LatBig = (_int64) ((LatYin * 10001750.0 * 65536.0 * 65536.0)/90.0); if (FSUIPC_Write(0x0560, 8, &LatBig, &dwResult)) { FSUIPC_Process(&dwResult); } else { printf("Latitude Write Error! \n"); } //----------- Longitude Begin ----------------------------------- LonBig = (_int64) ((LonYin * 65536.0 * 65536.0 * 65536.0 * 65536.0)/360.0); if (FSUIPC_Write(0x0568, 8, &LonBig, &dwResult)) { FSUIPC_Process(&dwResult); } else { printf("Longitude Write Error! \n"); } //---------------- Altitude Begin ------------------------- AltBig = (_int64) (AltYin*65536*65536); if (FSUIPC_Write(0x0570, 8, &AltBig, &dwResult)) { FSUIPC_Process(&dwResult); } else { printf("Altitude Write Error! \n"); } //--------------- Pitch Begin ---------------------------------- Pitch = long ((PitchYin * 65536.0 * 65536.0)/360.0); if (FSUIPC_Write(0x0578, 4, &Pitch, &dwResult)) { FSUIPC_Process(&dwResult); } else { printf("Pitch Write Error! \n"); } //--------------- Bank Begin ----------------------------------- Bank = long ((BankYin * 65536.0 * 65536.0)/360.0); if (FSUIPC_Write(0x057C, 4, &Bank, &dwResult)) { FSUIPC_Process(&dwResult); } else { printf("Bank Write Error! \n"); } //-------------- Heading Begin --------------------------------- Heading = long ((HeadingYin * 65536.0 * 65536.0)/360.0); if (FSUIPC_Write(0x0580, 4, &Heading, &dwResult)) { FSUIPC_Process(&dwResult); } else { printf("Heading Write Error! \n"); } //----------------- Aircraft End ------------------------------- }//while FSUIPC_Close(); //Closing when it wasn't open is okay, so this is safe here return 0 ; //---------------- FSUIPC End ---------------------------------- } ===================================================================== Hello Pete, THANKS for your quick reply to my question. 1) Our P3D is only used as Visual Display for our simulator. 2) We use your FSUIPC6 to communicate with P3D. 3) We use the above-mentioned program named FSUIPC_YIN.EXE program copied from your example program to communicate with your FSUIPC6. 4) The above-mentioned program named FSUIPC_YIN.EXE receives Lat, Lon, Alt, Pitch, Bank, Heading from our Main Simulator program and immediately to transfer these Lat, Lon, Alt, Pitch, Bank, Heading to your FSUIPC6 (then P3D). ================================================================ We separately start (1) P3D and then start (2) FSUIPC_YIN.EXE, our simulator system has been working normally, no problem for data communication. =============================================================== Two months ago, you told me that we may use your "Programs: Facilities to load and run additional programs", so that we start P3D, in the same time, our FSUIPC_YIN.EXE is started automatically. Therefore, I add the following two lines to FSUIPC6.INI [Programs] Run1=READY,KILL,C:\FSUIPC_YIN\\Release\FSUIPC_YIN.EXE ================================================================== Now P3D can load and run the FSUIPC_YIN.EXE. However, the simulator have been running on the Runway, NOT to take off. It seems the Altitude is not sent to P3D. If after starting P3D (FSUIPC_YIN.EXE automatically started), ONLY we move (refresh) P3D display one time (Big display to small display, then come back to Big display) , everything is OK! Question: After P3D automatically load and run our FSUIPC_YIN.EXE, Why do we need to move (refresh) P3D display screen one time by HAND operation? THANKS for your help! Link to comment Share on other sites More sharing options...
Pete Dowson Posted April 1, 2021 Report Share Posted April 1, 2021 17 minutes ago, yindengxie said: We use the above-mentioned program named FSUIPC_YIN.EXE program copied from your example program to communicate with your FSUIPC6. It is not one of our programs. You should not have multiple FSUIPC_Process calls for a set of data to be written together. Just use one Process call after Writing each value. Additionally, if this is to set the initial position you should use the "INITIAL POSITION" as described for offsets 0558 and 055C. For this method you must write all of the values with one Write call -- i.e. put them into a local structure of the correct length before writing the whole area. Finally your loop has no time allowed for any reaction to do what you are requesting. You need a Sleep in there somewhere! 24 minutes ago, yindengxie said: If after starting P3D (FSUIPC_YIN.EXE automatically started), ONLY we move (refresh) P3D display one time (Big display to small display, then come back to Big display) , everything is OK! Question: After P3D automatically load and run our FSUIPC_YIN.EXE, Why do we need to move (refresh) P3D display screen one time by HAND operation? No idea. It's related to what you are doing and what P3D makes of it. FSUIPC is not doing anything but what you ask it. Try improving your program as per the suggestions above. Pete Link to comment Share on other sites More sharing options...
yindengxie Posted April 1, 2021 Author Report Share Posted April 1, 2021 Hello Pete, Very many THANKS, Pete! I will improve my program according to your suggestion. Best Regards! Dengxie Link to comment Share on other sites More sharing options...
yindengxie Posted April 1, 2021 Author Report Share Posted April 1, 2021 //--------------- FSUIPC_OPEN Begin ------------------------------------------- if (!FSUIPC_Open(SIM_ANY, &dwResult)) { printf ("UIPChello: Failed to open link to FSUIPC: %s \n", pszErrors[dwResult]); } else { if (FSUIPC_Write(0x8001, 12, chOurKey, &dwResult)) FSUIPC_Process(&dwResult); printf (" FSUIPC OK \n"); } if (FSUIPC_Write(0x05DC, 2, &Slew, &dwResult)) FSUIPC_Process(&dwResult); if (FSUIPC_Write(0x0BC8, 2, &Parking, &dwResult)) FSUIPC_Process(&dwResult); //Pete: if the following two lines are commented, the screen pops up the additional program box (FSUIPC_YIN.EXE) in the attached picture below, everything is OK! else if the following two lines are NOT commented, the screen will NOT pop up the additional program box (FSUIPC_YIN.EXE) , there is data communication problem. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if (FSUIPC_Write(0x055C, 2, &OnGround, &dwResult)) FSUIPC_Process(&dwResult); //uint32 OnGround = 0; //0 in-flight, 1 on-ground if (FSUIPC_Write(0x0238, 1, &DayTime, &dwResult)) FSUIPC_Process(&dwResult); //uint8 DayTime=11 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //--------------- FSUIPC_OPEN End --------------------------------------------- while (1) { Sleep (10); VisualToServer.MsgID = 5; int ret = sendto(sServer, VisualToServer.temp, sizeof(TVisualToServer), 0, (SOCKADDR *)&recipientServer, sizeof(recipientServer)); if (ret == SOCKET_ERROR) printf("sendto() failed; %d\n", WSAGetLastError()); //-------- Read UDP Data Begin ---------------------------------------------------------- FD_ZERO(&ReadSet); //Prepare the Read and Write socket sets for network I/O notification. FD_SET(sVIS, &ReadSet); //Always look for connection attempts. //Set Read notification for the socket based on the current state the buffer. //If there is data remaining in the buffer then set the Write set otherwise the Read set. if ((ret = select(0, &ReadSet, NULL, NULL, &waittime)) == SOCKET_ERROR) { printf("select() returned with error %d\n", WSAGetLastError()); } if (ret != 0) { int nRead = recv(sVIS,ServerToVisual.temp,sizeof(ServerToVisual.temp),0); if (nRead == SOCKET_ERROR) { printf("recv() failed; %d\n", WSAGetLastError()); } else { msgID = ServerToVisual.View.MsgID; LatYin = ServerToVisual.View.lat; //Degree LonYin = ServerToVisual.View.lon; //Degree AltYin = ServerToVisual.View.alt; //Meter PitchYin = (-ServerToVisual.View.pitch * 57.3); //Degree BankYin = (-ServerToVisual.View.bank * 57.3); //Degree HeadingYin = ServerToVisual.View.heading * 57.3; //Degree } } //----------------- Read UDP Data End -------------------------- //----------------- Latitude Begin ----------------------------- LatBig = (_int64) ((LatYin * 10001750.0 * 65536.0 * 65536.0)/90.0); if (FSUIPC_Write(0x0560, 8, &LatBig, &dwResult)) { FSUIPC_Process(&dwResult); } else { printf("Latitude Write Error! \n"); } //----------- Longitude Begin ----------------------------------- LonBig = (_int64) ((LonYin * 65536.0 * 65536.0 * 65536.0 * 65536.0)/360.0); if (FSUIPC_Write(0x0568, 8, &LonBig, &dwResult)) { FSUIPC_Process(&dwResult); } else { printf("Longitude Write Error! \n"); } //---------------- Altitude Begin ------------------------- AltBig = (_int64) (AltYin*65536*65536); if (FSUIPC_Write(0x0570, 8, &AltBig, &dwResult)) { FSUIPC_Process(&dwResult); } else { printf("Altitude Write Error! \n"); } //--------------- Pitch Begin ---------------------------------- Pitch = long ((PitchYin * 65536.0 * 65536.0)/360.0); if (FSUIPC_Write(0x0578, 4, &Pitch, &dwResult)) { FSUIPC_Process(&dwResult); } else { printf("Pitch Write Error! \n"); } //--------------- Bank Begin ----------------------------------- Bank = long ((BankYin * 65536.0 * 65536.0)/360.0); if (FSUIPC_Write(0x057C, 4, &Bank, &dwResult)) { FSUIPC_Process(&dwResult); } else { printf("Bank Write Error! \n"); } //-------------- Heading Begin --------------------------------- Heading = long ((HeadingYin * 65536.0 * 65536.0)/360.0); if (FSUIPC_Write(0x0580, 4, &Heading, &dwResult)) { FSUIPC_Process(&dwResult); } else { printf("Heading Write Error! \n"); } }//while FSUIPC_Close(); //Closing when it wasn't open is okay, so this is safe here return 0 ; //---------------- FSUIPC End ---------------------------------- } ======================================================================= Hello Pete, THANKS for your help! Dengxie Link to comment Share on other sites More sharing options...
Pete Dowson Posted April 2, 2021 Report Share Posted April 2, 2021 13 hours ago, yindengxie said: //Pete: if the following two lines are commented, the screen pops up the additional program box (FSUIPC_YIN.EXE) in the attached picture below, everything is OK! else if the following two lines are NOT commented, the screen will NOT pop up the additional program box (FSUIPC_YIN.EXE) , there is data communication problem. Sorry, I've no idea what this is about. And that black window is obviously created by your program, it is NOT from FSUIPC. You need to know how to write a program which sits in the background -- for instance, defining its window as a Message Window. Check Microsoft programming websites. FSUIPC in an interface. It merely sends your requests to the Sim. Everything thgen is up to you. I cannot tech you Windows programming. Pete PS you are still doing too many FSUIPC Process requests. Just do one per loop. Link to comment Share on other sites More sharing options...
yindengxie Posted April 2, 2021 Author Report Share Posted April 2, 2021 Hello Pete, Thanks for your reply. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if (FSUIPC_Write(0x055C, 2, &OnGround, &dwResult)) FSUIPC_Process(&dwResult); //uint32 OnGround = 0; //0 in-flight, 1 on-ground if (FSUIPC_Write(0x0238, 1, &DayTime, &dwResult)) FSUIPC_Process(&dwResult); //uint8 DayTime=11 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if the above-mentioned two lines are commented, the screen pops up the additional program box (my application program: FSUIPC_YIN.EXE), everything is OK! else if the following two lines are NOT commented, the screen will NOT pop up the additional program box (my application program: FSUIPC_YIN.EXE) and my application program: FSUIPC_YIN.EXE will run at the background, in this case, there is data communication problem. =============================================================== Note: We separately start (1) P3D and then start (2) FSUIPC_YIN.EXE, our simulator system has been working normally for a long time, no problem for data communication. our FSUIPC_YIN.EXE always runs on background. Two months ago, you told me that we may use your "Programs: Facilities to load and run additional programs", so that we start P3D, in the same time, our FSUIPC_YIN.EXE is started automatically. Therefore, I add the following two lines to FSUIPC6.INI [Programs] Run1=READY,KILL,C:\FSUIPC_YIN\\Release\FSUIPC_YIN.EXE Now it is a problem for Programs: Facilities to load and run additional programs". PS: I do not understand your " you are still doing too many FSUIPC Process requests. Just do one per loop." THANKS Pete Dengxie Link to comment Share on other sites More sharing options...
Pete Dowson Posted April 2, 2021 Report Share Posted April 2, 2021 2 hours ago, yindengxie said: Two months ago, you told me that we may use your "Programs: Facilities to load and run additional programs", so that we start P3D, in the same time, our FSUIPC_YIN.EXE is started automatically. Therefore, I add the following two lines to FSUIPC6.INI [Programs] Run1=READY,KILL,C:\FSUIPC_YIN\\Release\FSUIPC_YIN.EXE Now it is a problem for Programs: Facilities to load and run additional programs". All that is doing is asking Windows to load that program! Everything you have going wrong is to do with that program! Just try running it yourself using a desktop shortcut. That will load your program too. Having it loaded automatically by FSUIPC just saves you that bother. It does nothing else!!! You seem to be completely misunderstanding. You asked how to load the program automatically and i told you! Loading the program does nothing but load the program. Everything it does then is your doing, your program! I suggest you get your program working properly first, before having it automatically loaded! 2 hours ago, yindengxie said: PS: I do not understand your " you are still doing too many FSUIPC Process requests. Just do one per loop." Look at your code! After EVERY "FSUIPC_Write" you do an "FSUIPC_Process". Each time you do that you are asking Windows to switch processes. Each of your written values will arrive separately, and things are terribly inefficient with all the process switching. Just remove ALL of the FSUIPC_Process calls and put just one at then end, before the final } of the loop. Then all the values will be written inb one call! Pete Link to comment Share on other sites More sharing options...
yindengxie Posted April 2, 2021 Author Report Share Posted April 2, 2021 Hello Pete, Very many THANKS, Pete! I will improve my program according to your suggestion. Best Regards! Dengxie Link to comment Share on other sites More sharing options...
yindengxie Posted April 2, 2021 Author Report Share Posted April 2, 2021 [General] UpdatedByVersion=6011 History=9EDKUCU2B2M653Q3B0TE1 AxesWrongRange=No TCASid=Flight TCASrange=40,3 AxisCalibration=No DirectAxesToCalibs=No ShowMultilineWindow=Yes SuppressSingleline=No SuppressMultilineFS=No AxisIntercepts=No DontResetAxes=No ThreadAffinityMask=x0 LuaAffinityMask=x0 InitDelay=0 GetNearestAirports=No LogOptionProtect=Yes TimeForLuaClosing=2 WeatherReadFactor=2 WeatherRewriteSeconds=1 TrafficStallTime=1 InitialStallTime=10 NormalStallTime=1 LuaRerunDelay=66 ComReadLoopTime=20 FSVersionUsed="Lockheed Martin® Prepar3D® v5",5.1.12.26829 SimConnectUsed=5.1.0.0 ControlsListBuild=26829 Console=No ConsoleWindowTopMost=No [WideServer] WideFSenabled=Yes [Programs] Run1=READY,KILL,C:\FSUIPC_YIN\Release\FSUIPC_YIN.EXE [Window.Message Window] NewDocked=8, 25, 1008, 17 ============================================= Hello Pete, I check my FSUIPC.INI and find the last two lines added in the file end. [Window.Message Window] NewDocked=8, 25, 1008, 17 -------------------------------------------------------- How (Who) to attach the two lines to the FSUIPC.INI? What it means? THANKS! Dengxie FSUIPC6.ini Link to comment Share on other sites More sharing options...
yindengxie Posted April 2, 2021 Author Report Share Posted April 2, 2021 Hello Pete, [Programs]Run1=DELAY,HIDE,KILL,C:\FSUIPC_YIN\Release\FSUIPC_YIN.EXE I want to use your HIDE function to hide my black window program: FSUIPC_YIN.EXE, but the HIDE does not work, it does not hide my black window program: FSUIPC_YIN.EXE, please see the attached picture. Similarly, the MIN does not work, it does not minimize my black window program: FSUIPC_YIN.EXE. What is my problem? THANKS for your support! Dengxie Link to comment Share on other sites More sharing options...
Pete Dowson Posted April 2, 2021 Report Share Posted April 2, 2021 6 hours ago, yindengxie said: How (Who) to attach the two lines to the FSUIPC.INI? What it means? FSUIPC saves the SiMConnect window in case you ever use the facilities to restore them after moving them. Nothing to do with your program, unless you are using Simconnect Windows directly? 5 hours ago, yindengxie said: I want to use your HIDE function to hide my black window program: FSUIPC_YIN.EXE, but the HIDE does not work, it does not hide my black window program: FSUIPC_YIN.EXE, As the documentation tells you, the HIDE (and other initial Windows options) doesn't override what your program wants to do. it can only affect the default -- i.e. what Windws will do if you don't declare a Window position or state. 5 hours ago, yindengxie said: Similarly, the MIN does not work, it does not minimize my black window program: FSUIPC_YIN.EXE. Same thing. 5 hours ago, yindengxie said: What is my problem? I think you just may need to learn some basic Windows programming. I'm sorry, but this is not the place and I’m not the person . Pete Link to comment Share on other sites More sharing options...
Pete Dowson Posted April 2, 2021 Report Share Posted April 2, 2021 One thing just occurred to me. Looking carefully at your “black window” is see that it isn’t entirely black. There appears to be a message in it. Looking again at your code I see you use printed statements. Where do you think those messages are going? I now think that window is a console window being created to receive your messages! I also see that you have an FSUIPC close call and a return 0 at the end, outside a loop which can never end. So what are they for? How do you expect the program to end? Only by being KILLED? Pete Link to comment Share on other sites More sharing options...
yindengxie Posted April 3, 2021 Author Report Share Posted April 3, 2021 //--------------- FSUIPC_OPEN Begin ------------------------------------------- if (!FSUIPC_Open(SIM_ANY, &dwResult)) { printf ("Failed to open link to FSUIPC: %s \n", pszErrors[dwResult]); } else { if (FSUIPC_Write(0x8001, 12, chOurKey, &dwResult)) printf (" FSUIPC OK \n"); } if (FSUIPC_Write(0x05DC, 2, &Slew, &dwResult)) printf ("Slew Error \n"); if (FSUIPC_Write(0x0BC8, 2, &Parking, &dwResult)) printf ("Parking Error \n"); if (FSUIPC_Write(0x055C, 2, &OnGround, &dwResult)) printf ("OnGround Error \n"); if (FSUIPC_Write(0x0238, 1, &DayTime, &dwResult)) printf ("DayTime Error \n"); //--------------- FSUIPC_OPEN End --------------------------------------------- while (1) { Sleep (10); VisualToServer.MsgID = 5; int ret = sendto(sServer, VisualToServer.temp, sizeof(TVisualToServer), 0, (SOCKADDR *)&recipientServer, sizeof(recipientServer)); if (ret == SOCKET_ERROR) printf("sendto() failed; %d\n", WSAGetLastError()); //-------- Read UDP Data Begin ---------------------------------------------------------- FD_ZERO(&ReadSet); //Prepare the Read and Write socket sets for network I/O notification. FD_SET(sVIS, &ReadSet); //Always look for connection attempts. if ((ret = select(0, &ReadSet, NULL, NULL, &waittime)) == SOCKET_ERROR) { printf("select() returned with error %d\n", WSAGetLastError()); } if (ret != 0) { int nRead = recv(sVIS,ServerToVisual.temp,sizeof(ServerToVisual.temp),0); if (nRead == SOCKET_ERROR) { printf("recv() failed; %d\n", WSAGetLastError()); } else { msgID = ServerToVisual.View.MsgID; LatYin = ServerToVisual.View.lat; //Degree LonYin = ServerToVisual.View.lon; //Degree AltYin = ServerToVisual.View.alt; //Meter PitchYin = (-ServerToVisual.View.pitch * 57.3); //Degree BankYin = (-ServerToVisual.View.bank * 57.3); //Degree HeadingYin = ServerToVisual.View.heading * 57.3; //Degree } } //----------------- Read UDP Data End -------------------------- //----------------- Latitude Begin ----------------------------- LatBig = (_int64) ((LatYin * 10001750.0 * 65536.0 * 65536.0)/90.0); if (!FSUIPC_Write(0x0560, 8, &LatBig, &dwResult)) printf("Latitude Write Error! \n"); //---------------- Longitude Begin ----------------------------------- LonBig = (_int64) ((LonYin * 65536.0 * 65536.0 * 65536.0 * 65536.0)/360.0); if (!FSUIPC_Write(0x0568, 8, &LonBig, &dwResult)) printf("Longitude Write Error! \n"); //---------------- Altitude Begin ------------------------- AltBig = (_int64) (AltYin*65536*65536); if (!FSUIPC_Write(0x0570, 8, &AltBig, &dwResult)) printf("Altitude Write Error! \n"); //--------------- Pitch Begin ---------------------------------- Pitch = long ((PitchYin * 65536.0 * 65536.0)/360.0); if (!FSUIPC_Write(0x0578, 4, &Pitch, &dwResult)) printf("Pitch Write Error! \n"); //--------------- Bank Begin ----------------------------------- Bank = long ((BankYin * 65536.0 * 65536.0)/360.0); if (!FSUIPC_Write(0x057C, 4, &Bank, &dwResult)) printf("Bank Write Error! \n"); //-------------- Heading Begin --------------------------------- Heading = long ((HeadingYin * 65536.0 * 65536.0)/360.0); if (!FSUIPC_Write(0x0580, 4, &Heading, &dwResult)) printf("Heading Write Error! \n"); //------------------------------------------------------------- FSUIPC_Process(&dwResult); }//while FSUIPC_Close(); //Closing when it wasn't open is okay, so this is safe here return 0 ; //---------------- FSUIPC End ---------------------------------- } Hello Pete, Thanks for your great help. Our application is only a console window program, running at background. At initial time, it prints out that our application is connected to your "FSUIPC OK!" After that, our application begins to enter WHILE(1), now our application completely runs at background of P3D Scenery, NO messages output! Please see above program. Today I test your Programs: facilities to load and run additional programs. I found the following question: 1) Our application is ALWAYS the SAME program as above. 2) When setting is as follows: ============================================================= [Programs] Run1=DELAY,KILL,C:\FSUIPC_YIN\Release\FSUIPC_YIN.EXE Delay = 1 ============================================================ Pops up the my Black Console Window and the Black Console Window covers a part of P3D Scenery. In this case (setting), our application communicates with your FSUIPC=> P3D normally, NO problem! Only need to minimize the my Black Console Window, so that entire screen only displays P3D scenery. Everything OK! 3) When setting is as follows: ============================================================= [Programs] Run1=READY,KILL,C:\FSUIPC_YIN\Release\FSUIPC_YIN.EXE ============================================================ Pops up the my Black Console Window and quickly P3D Scenery covers my Black Console Window. In this case (setting), our application can communicate with your FSUIPC=> P3D, BUT plane is only taxiing on the runway and could not take off. NOTE: the above-mentioned two cases, our program is NOT made any change! Very many thanks for your patient support! Dengxie Link to comment Share on other sites More sharing options...
yindengxie Posted April 3, 2021 Author Report Share Posted April 3, 2021 Hello Pete, In the both settings, //-------------------------------------------------------------------- [Programs] Run1=DELAY,KILL,C:\FSUIPC_YIN\Release\FSUIPC_YIN.EXE Delay = 1 //------------------------------------------------------------------- //------------------------------------------------------------------- [Programs] Run1=READY,KILL,C:\FSUIPC_YIN\Release\FSUIPC_YIN.EXE //------------------------------------------------------------------ the KILL function is OK! Dengxie Link to comment Share on other sites More sharing options...
yindengxie Posted April 3, 2021 Author Report Share Posted April 3, 2021 Hell Pete, I want to give you the following info: 1) We separately start (1) P3D and then start (2) FSUIPC_YIN.EXE, our simulator system has been working normally for a long time, no problem for data communication. Our FSUIPC_YIN.EXE always runs on background. 2) For convenience, we want to use your providing the functions, "Programs: Facilities to load and run additional programs", Starting P3D will automatically start our FSUIPC_YIN.EXE to run on the background. One key operation! Don’t even need to minimize the my Black Console Window operation. Best Regards! Dengxie Link to comment Share on other sites More sharing options...
Pete Dowson Posted April 3, 2021 Report Share Posted April 3, 2021 1 hour ago, yindengxie said: Pops up the my Black Console Window and the Black Console Window covers a part of P3D Scenery. In this case (setting), our application communicates with your FSUIPC=> P3D normally, NO problem! Only need to minimize the my Black Console Window, so that entire screen only displays P3D scenery. Everything OK! You would have no problem with the black console window if you removed all of your "printf" function calls. The one that does the damage initially is the "FSUIPC OK" message. If you must have messages you should create a log file and write to that. FSUIPC can also have a console Log (as well as the file LOG) -- it's an option on the Logging facilities. 1 hour ago, yindengxie said: [Programs] Run1=READY,KILL,C:\FSUIPC_YIN\Release\FSUIPC_YIN.EXE ============================================================ Pops up the my Black Console Window and quickly P3D Scenery covers my Black Console Window. In this case (setting), our application can communicate with your FSUIPC=> P3D, BUT plane is only taxiing on the runway and could not take off. Well, all READY is doing is waiting until FS is ready to fly. FSUIPC cannot possibly stop your aircraft taking off. That's down to your code, as everything has been. You simply will not believe me that your program is not programmed properly for what you want to do. Better has been achieved with a simple Lua plug-in (see the pair MasterClient.lua and SlaveServer.lua plug-ins in your Example Lua Plugins ZIP). 59 minutes ago, yindengxie said: the KILL function is OK! Yes, but that's the only way your program terminates. These two lines in your program are just waste as they can never be executed: FSUIPC_Close(); //Closing when it wasn't open is okay, so this is safe here return 0 ; 22 minutes ago, yindengxie said: Don’t even need to minimize the my Black Console Window operation. If you didn't use printf you'd not get one in any case, as I keep saying. Use a log file instead, or use printf for errors not "FSUIPC OK"! I'm closing this thread now. I've nothing more to say. I keep trying to help but you ignore my advice, and keep blaming the simple Run facility for your erroneous program. Link to comment Share on other sites More sharing options...
Recommended Posts