YankeeFan Posted August 2, 2003 Report Posted August 2, 2003 Hi! I am trying to write my program access key 12 bytes to offset &H8001 so users of my application wont have to manually enter the key in to register the application. And it appears to be working because I am not getting the popup message in FS2002, but it appears to be an error in FSUIPC log. If it is just incorrect only and informational in the log, that's fine with me, I just wanted to make sure all users of my program will not experience any problems that I haven't seen. VISUAL BASIC 6.0 CODE ("123456789012" is where my access key is): If FSUIPC_WriteS(&H8001, 12, "123456789012", dwResult) = False Then MsgBox "FSUIPC Freeware Key was not successfully written" FSUIPC_Close FSUIPC_Open = False Exit Function End If LINE FROM FSUIPC.1.LOG: 3864547 WRITE0 (failed, read-only!) 8F8001, 12 bytes: 4D 58 4B 56 49 4F 4C 32 4F 35 4C 53 Thanks for reading post and any feedback is welcomed! John McCormack Active AirSource (http://www.air-source.us) Application Developer
Pete Dowson Posted August 2, 2003 Report Posted August 2, 2003 If FSUIPC_WriteS(&H8001, 12, "123456789012", dwResult) = False Then 3864547 WRITE0 (failed, read-only!) 8F8001, 12 bytes: 4D 58 4B 56 49 4F 4C 32 4F 35 4C 53 Odd that most all the programming queries come from VB programmers. Is it just because there are more, or is VB really as bad a language as it seems from my point of view? As far as I understand it, &H8001 when used in a 32-bit variable situation will be sign-extended, coming over as FFFF8001, NOT 00008001! FSUIPC uses a lot of those high bits as flags for one thing or another (see the AWI for instance), and the only sense it can make is the offset 8F8001, which, I think is actually a way of getting to someplace somewhere in one of FS's modules. I don't know VB, and I really don't want to know VB as it seems astonishingly bad from where I sit, but I am informed that appending a '&' character stops a sign extension, so "&H8001&" should work. I would also think that &H00008001 should work, and also the decimal 32769. But don't take my word for any of this, go look it up in your VB books please. Regards, Pete
YankeeFan Posted August 2, 2003 Author Report Posted August 2, 2003 Thanks Pete I will give that a try and no I don't think VB is a bad language just I must be a bad VB Programmer, even though I've been programming for 20 years now and using VB since 1995.
jd Posted August 2, 2003 Report Posted August 2, 2003 you may want to change the line If FSUIPC_WriteS(&H8001, 12, "123456789012", dwResult) = False Then to If FSUIPC_WriteS(&H8001, 13, "123456789012" & chr(0), dwResult) = False Then
Pete Dowson Posted August 2, 2003 Report Posted August 2, 2003 you may want to change the lineIf FSUIPC_WriteS(&H8001, 12, "123456789012", dwResult) = False Then to If FSUIPC_WriteS(&H8001, 13, "123456789012" & chr(0), dwResult) = False Then Hey John, wasn't it you that told be the &H8001 had to be &H8001&, according to some VB book? On the "chr(0) part, doesn't VB have strings ending with a zero? If not, if they are like the original MSBasic of old pre-war PCs (), isn't there a length byte at the beginning that needs deleting somehow? Pete
jd Posted August 3, 2003 Report Posted August 3, 2003 yep, it was me :-) here is my code that i use, and it works :-) sstring = "ABCD1234WXYZ" & Chr(0) Call FSUIPC_WriteS(&H8001&, Len(sstring), sstring, dwResult) ' Call FSUIPC_Process(dwResult)
YankeeFan Posted August 3, 2003 Author Report Posted August 3, 2003 Thanks I will use what works! This is my first week programming using FSUIPC, so I am stumbling a bit at the moment. But, hopefully I will be able to get use to it enough where I can proceed without havings so many elementary questions. Thanks again! John McCormack
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now