javiercuellar Posted January 24, 2010 Report Posted January 24, 2010 Hi. I've created an application that works fine. I'll like to show it in the "add-ons" menu, but can't get it to work. I program in vb.net and this is the code for showing the menu. What is my mistake? Global declarations Dim MenuFS As Offset(Of Byte()) = New FSUIPC.Offset(Of Byte())(&H3210, 4) Dim MenuNameFS As Offset(Of String) = New FSUIPC.Offset(Of String)(&H2FE0, 32) In main form event MenuFS.Value(0) = 255 MenuFS.Value(1) = 255 MenuFS.Value(2) = 0 MenuFS.Value(3) = 0 MenuNameFS.Value = "1Test menu" Timmer of 10 secs MenuFS.Value(0) = 255 MenuFS.Value(1) = 255 Edit: Also tried writing to bytes (2) and (3) insted of (0) and (1) but at least as is originally, I can see byte (1) counting down for timeout. Debuggig I can see that
Pete Dowson Posted January 25, 2010 Report Posted January 25, 2010 I'll like to show it in the "add-ons" menu, but can't get it to work.I program in vb.net and this is the code for showing the menu. What is my mistake? I'm afraid there's more than one "mistake". I don't know VB but I can see several at a glance: Dim MenuFS As Offset(Of Byte()) = New FSUIPC.Offset(Of Byte())(&H3210, 4) Two things wrong here: First the data starting at 3210 is an ARRAY of DWORDS, or 32-bit values. In VB you probably have to treat them as integers -- but check the size your compiler produces for that. Second, if you assume that the first slot, the one at 3210, is "free" and simply write to it, your program will not cooperate with any other program using hot keys or menu entries. As the documentation says, you should search for a free (all zero) entry and use that. MenuNameFS.Value = "1Test menu" The document tells you that the first byte must be the SLOT NUMBER (I). You would have seen the slot offset computed by 0x3210 + 4*I. So the slot at 3210 would be slot number 0 (zero). Right? You've used "1". not even the NUMBER 1, but the CHARACTER 1, which, assuming the VB compiles into ASCII, is actually a byte value of 49 (hex 0x31), not 0 nor 1! And that's assuming your VB compiles into normal ASCII. I think VB might default into compiling into wide characters or Unicode or somesuch. Pete
javiercuellar Posted January 25, 2010 Author Report Posted January 25, 2010 Thanks Pete for the super-fast answer :D . First the data starting at 3210 is an ARRAY of DWORDS, or 32-bit values. Yes, I got the idea, and I'm using 4 bytes (4 * 8 ) that give me the 32bits. I treat each byte separately. Maybe it's not good idea, but for testing and learning gives me better view of the situation. Probably my mistake is using the "1" as character, besides that it should be 0 (I did also test it with 0) Tonight I'll recheck it let you know the results. Thanks
javiercuellar Posted January 25, 2010 Author Report Posted January 25, 2010 Ok, I'm back. My error was writing the "1" as a char an not as a number, an beside that, it should be a 0 (zero). What I did was write to byte 2FE0 that 0, and from byte 2FE1 (up to byte 31) the menu name. :D
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