Jump to content
Sign in to follow this  
Guest PoRrEkE

VB.Net vs FSUIPC

Recommended Posts

Guest PoRrEkE

Ok, I've changed my code such that it does no longer use the checkboxes.Each timer tick it will read the variables I need (nav, xpdr, ...)Then it will check the data from Photon.After that it will send the correct values to the offsets (&H3340 to &H334F) if there is a key pressed according to Photons readingsThen it will process.Still same scenario.After a few minutes the readings from nav, xpdr, ... go weird and my soft crashes (because I do dec2bin and substrings on the read value) which is logic.So I think that either it has something to do with me not using the GET, or the code I use to link my soft to fsuipc is bad.I really wish that Scott would send me an e-mail with this part of his code :( or that Pete could help me out. Neither of them have sent me an e-mail yet.

Share this post


Link to post
Share on other sites
Guest PoRrEkE

Pete told me :---------Please use the logging tools provided in FSUIPC to help you resolve such problems. You can log all IPC reads and writes and see exactly what you are doing.---------What does he mean ?I've used FSinterrogate.exe to check the variables and they keep correct in this software. So it must be that my code is wrong. At least the part you need to add with all the fsuipc stuff in it. I can not edit this myself or check where the fault might be simply because I do not understand any of that code.Very stupid that there is a .Net section in the SDK but it doesn't even compile ......... talk about service to a 23.30 EURO tool ... :/

Share this post


Link to post
Share on other sites
Guest PoRrEkE

I finally figured it out.It turns out that when I read I get too much data.e.g. when I expect a "4", I get from fsuipc "0000 0100" which converted from binary to decimal is indeed a 4. However the bite I get extra in front makes the 4 go wild whenever the first bite changes and is no longer "0000"So now what I do is read, then cast to string. Check if the number is of character is longer than 16, I take a substring 16 long from the right. When it is to short I add leading 0's. After that I convert from binary do decimal using the BCD methot.It still isn't right, but at least I make it right in the end. And it should work now.EUREKA !Now I hope Espen will figure out the key combos in the gauges to work 100% and then I am off flying my F50 for real and seriously !! o/

Share this post


Link to post
Share on other sites
Guest ZKSHB

Hi All,I have been watching this thread with interest as using FSUIPC to read and write to FS sounded like a good idea. I have read through the SDK but must admit I'm more confused than ever!After playing around in VB6 I can read the values, it's writing them that won't work for me, heres my code according to the documentation...Dim dwResult As Long, txt As LongDim myHDG As Longtxt = Me.Text1.TextmyHDG = (txt * 360 / 65536) FSUIPC_Write(&H7CC, 16, myHDG, dwResult) FSUIPC_Process (dwResult)Is this correct?ZK-SHBIf it isn't Boeing, I'm not going.http://www.737simbuilders.com/

Share this post


Link to post
Share on other sites
Guest PoRrEkE

TryDim Result As LongDim myHDG As LongmyHDG = (Me.Text1.Text * 360 / 65536)FSUIPC_Write(&H7CC, myHDG, Token, Result)FSUIPC_Process(Result)

Share this post


Link to post
Share on other sites
Guest ZKSHB

HiThanks for that, what should I declare Token as? I have tried as Long but this just causes the program to close without doing anything. Sorry for so many quetions but this is a very different world to programming a frontend for a SQL SB! Do you know of any good tutorials on programming FSUIPC/FS with VB? I have tried my sources but this is unheard of there.ZK-SHBIf it isn't Boeing, I'm not going.http://www.737simbuilders.com/

Share this post


Link to post
Share on other sites
Guest PoRrEkE

Have no idea of any tuts for fsuipc vs VB. Sadly enough Pete is not of much help either. I keep giving him info and things I know or notice or see or whatever so that maybe he could figure something out to help me ..Instead he just tells me to use FSinterogate and disencourage me to continue programming at all ... :/I know I am a newbie but that doesn't mean I should give up. And it's not because I am not able to change or edit anything from the fsuipc code block or even understand a single line of code of it (what it does or how it works) that I should forget about the entire thing. I think it's up to him to make the code work without bugs (not up to me for sure) and provide us with CLEAR to the point SDK's. Him not managing to do so results in lots of questions on his forum which he thinks are obvious or stupid.I refuse to read an entire manual where 95% of the text I won't ever need, so what I do is I look for that 5% I do need and than he should NOT blame me for not reading (finding it in) the manual.Either way, here I am rambling on about that guy once more...Back to your question.I suggest you Dim as Integer. Dito for the Result variable. My mistake.Let me know if it works.Thing is that you use VB6 and I started of learning coding with VB.NetI have only used VB6 for a very short time (first version of LPT switch software) and I didn't like it at all.What I hate about it is things like:txtText1 = "blah"While in .Net you would have to writetxtText1.Text = "blah"It is more to type indeed, but when re-reading your code or when reading someone elses code you understand much faster what is going on.If I see that first VB6 line I think I put the string "blah" in a variable. Which is not the case .. I put the string into a property of an object.

Share this post


Link to post
Share on other sites
Guest ZKSHB

Hi,I can understand Peters attitude, he uses C not VB and the sdk samples (what there is)were ported by someone else for him. Agree 100% with the sdk manual I found it confusing as most samples were C based and the differences between it and VB... As to my using VB6 over VB.Net just a case of the machine I'm using to develop this on and the fact that I know VB6 enviroment better than VB.Net. If all goes well I will most likely port it to .Net anyways.Tried as integer VB no like, I get a ByRef error so have put both back to long.ZK-SHBIf it isn't Boeing, I'm not going.http://www.737simbuilders.com/

Share this post


Link to post
Share on other sites
Guest PoRrEkE

I could give you my .Net code .. not sure if you can do anything with it ..I got my "CockpitLink" software for the link between my interface and FS. Then when I noticed that didn't worked I started a new project "FinalTest". Simple GUI, basic code, just enough to get the read/write work.If you want that, I could send you. Just send me a mail: pvanagtADbelgacomDOTnet

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