Jump to content
The simFlight Network Forums

help with the fsuipc sample (Failed to open link to FSUIPC)


Recommended Posts

help with the fsuipc sample

I want to write some application to interface to fs2004,when I run the FSUIPC SDK 28th Release sample(\UIPC_SDK_BCB5) .the pragram running

result show "Incorrect version of FSUIPC, or not FSUIPC", "Failed to open link to FSUIPC". I CHECK the Code ,found this program need to find

the "UIPCMAIN ",

// Connect via FSUIPC, which is known to be FSUIPC's own

// and isn't subject to user modificiation

m_hWnd = FindWindowEx(NULL, NULL, "UIPCMAIN", NULL);

if (!m_hWnd)

{ // If there's no UIPCMAIN, we may be using WideClient

// which only simulates FS98

m_hWnd = FindWindowEx(NULL, NULL, "FS98MAIN", NULL);

fWideFS = TRUE;

if (!m_hWnd)

{ *pdwResult = FSUIPC_ERR_NOFS;

return FALSE;

}

}

My question is,what is the UIPCMAIN,what should I do to connect to fsuipc.

I had install fsuipc3.8 into fs2004 and registered sucessful. log file as follow:

********* FSUIPC, Version 3.80 by Pete Dowson *********

Running on Windows Version 5.1 Build 2600 Service Pack 2

Verifying Certificate for "G:\Flight Simulator 9\MODULES\FSUIPC.dll" now ...

SUCCESS! Signature verifies okay!

Running inside FS2004(original release)

User Name=

User Addr=

FSUIPC Key is provided

WIDEFS not user registered, or expired

Module base=61000000

ClassOptions: UIPCMAIN=FF7F, FS98MAIN=FF7F, FS2KMAIN=FF5E

WeatherOptions(Orig)=40003605[40003605]

InitDelay: 0 seconds

WeatherReadInterval=4

LogOptions=00000001

DebugStatus=15

8094 System time = 14:53:13

8391 G:\Flight Simulator 9\

8406 G:\Flight Simulator 9\fs9.exe

13906 System time = 14:53:19, FS2004 time = 12:00:00 (00:00Z)

17500 FLIGHTS\OTHER\FLTSIM.flt

17578 AIRCRAFT\c172\Cessna172SP.air

17828 Aircraft="Cessna Skyhawk 172SP"

33047 Advanced Weather Interface Enabled

Regards

Link to comment
Share on other sites

I want to write some application to interface to fs2004,when I run the FSUIPC SDK 28th Release sample(\UIPC_SDK_BCB5) .the pragram running

result show "Incorrect version of FSUIPC, or not FSUIPC", "Failed to open link to FSUIPC". I CHECK the Code ,found this program need to find

the "UIPCMAIN "

Well, to get such a failure it would have to fail to find both UIPCMAIN and FS98MAIN, which would mean neither FS nor WideClient appeared to be running.

My question is,what is the UIPCMAIN,what should I do to connect to fsuipc.

UIPCMAIN is the invisible connection-window classname created by FSUIPC, and FS98MAIN is the standard classname for the main thread window created by FS (all versions, not just FS98). WideClient also creates FS98MAIN on client PCs, emulating FS98 (and all subsequent versions).

So, to connect, you use the code or library supplied.

There is one possibility which may restrict connection. If you are running on Vista and have FS running at elevated administrator privileged levels, then any client program you wish to connect to it must also run at that level -- otherwise Vista blocks access. It should be unnecessary to use "run as administrator" for FS except when Registering FSUIPC.

Regards

Pete

Link to comment
Share on other sites

thank you for your reply ,my system is windows xp. and you say"So, to connect, you use the code or library supplied." ,which library i should add to the program? now I used the BCB. the code is the sdk file's sample and I didn't modify anything.I don't know what made this error.

I'm afraid I don't know BCB. I only provided the original C library and its source. Other users contributed the other language examples. I just checked and it appears that they didn't make a library for the BCB5 version, but simply included the source code, modified I assume, into the program source.

I see there's a compiled HELLO.EXE in the package. Doesn't that work?

If, as you must have, you have incorporated the source code in your program, you should be able to debug it with your compiler system's debugger. Put a breakpoint on the calls to FindWindowEx(NULL, NULL, "UIPCMAIN", NULL) and FindWindowEx(NULL, NULL, "FS98MAIN", NULL) and see why they are failing to provide a window handle. These are standard Windows API calls which have worked on every version of Windows as far back as I can remember. All they do is find a top-level Window with that classname.

There's a Microsoft utility called "spy" (or "spyxx" these days) which can display a list of all of the Windows on your system with the classnames shown. With FS running you will always see a top-level window "FS98MAIN", and also, if FSUIPC is installed, one with the "UIPCMAIN" classname.

Another possibility I just thought of. Could you possibly be compiling your code with Unicode (or wide character) settings, making all strings, like "FS98MAIN" and "UIPCMAIN" incorrect as far as these windows calls are concerned? I suspect they are supposed to map into "A" (ASCII) and "W" (Wide character) versions of the API, but possibly they don't, or your compiler doesn't set the needed macros for that to happen. Certainly all of the FS interfaces need single character codes -- those strings would be 8 bytes long, plus a zero terminator, not 16 plus a two-byte zero terminator.

Regards

Pete

Link to comment
Share on other sites

a new found! when i copy the HELLO.EXE program to the windows 2000 system. the HELLO.EXE running ! the program can show the fsuipc message. maybe the problem is in the operation system. why the WINDOWS xp CAN'T RUN ?

There's no difference between XP and 2000 as far as this is concerned. Maybe you have some privilege levels set differently. Sorry, I don't know. I've never heard of any problem except the privilege one on Vista.

Maybe it is just a problem with the BCB5 stuff, possibly a library mismatch? Why not try some of the other examples, or in particular the utility programs i provide such as FSInterrogate (which was written in Delphi), WeatherSet and TrafficLook?

Pete

Link to comment
Share on other sites

  • 1 year later...

Hey Guys,

Quick update on this topic.

I was having a similar problem with the sample compiling properly but

m_hWnd = FindWindowEx(NULL, NULL, "UIPCMAIN", NULL);

not returning a handle.

I'm using Visual Studio 2010 and went to the project Property Pages.

Look for Configuration Properties -> General -> Character Set

My project had nothing selected, I switched to "Not Set" recompiled and

m_hWnd = FindWindowEx(NULL, NULL, "UIPCMAIN", NULL);

now returns a handle to the FSUIPC Window.

Cheers!

Christian

Link to comment
Share on other sites

  • 3 years later...

Same issue with FSUIPC 4.8, and same fix as @cmenge suggested. Many thanks.

A mention in FSUIPC SDK documentation would be more than welcomed. I saved many hours by reading this topic, but I'd have saved even more if FSUIPC Internal documentation would be improved.

Link to comment
Share on other sites

Same issue with FSUIPC 4.8, and same fix as @cmenge suggested. Many thanks.

A mention in FSUIPC SDK documentation would be more than welcomed. I saved many hours by reading this topic, but I'd have saved even more if FSUIPC Internal documentation would be improved.

I don't think it's reasonable to expect the FSUIPC documentation to teach you how to use Microsoft Visual Studio.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.