CougarFool Posted December 24, 2021 Report Share Posted December 24, 2021 Hi everyone, I have a problem when using offset 3F00 to save the flight. My little application has a button that, when clicked, should save the flight. It works the first time and saves the flight correctly. Each subsequent click does not save the flight. I have to restart my application to get it to save again. The variables are: Private Const FltName As String = "NewAutoSave" 'save flight group Dim oSaveName As Offset(Of String) = New FSUIPC.Offset(Of String)("saveflt", &H3F04, 252) Dim oSaveCmd As Offset(Of Short) = New FSUIPC.Offset(Of Short)("saveflt", &H3F00) And the Click event is: Try If FSUIPCConnection.IsOpen Then oSaveName.Value = FltName oSaveCmd.Value = 1 'write FSUIPCConnection.Process("saveflt") lblSaved.Text = $"Saved at:{Now.ToShortTimeString}" 'update Form label End If Catch fsex As FSUIPCException MsgBox(fsex.Message) Catch ex As Exception MsgBox(ex.Message) End Try Each Click does update the 'Saved at:' label so it is executing the code above it without throwing an Exception. I have tried running the application as Administrator and there is no difference. I have tried executing the code on a BackGroundWorker but there is no differerence. I'm hoping that there is a obvious mistake I've made in my code but I can't see it! Any help would be appreciated from fellow developers! Nigel. Link to comment Share on other sites More sharing options...
Paul Henty Posted December 24, 2021 Report Share Posted December 24, 2021 The dll isn't writing offset 0x3F00 the second and subsequent times because the value has not changed. It was 1, but it's still 1 so no write takes place. The offset value is read instead. To make this work you need to mark the offset as write-only (set third parameter to 'True'). These type of offsets will be written every time you process them, regardless of whether the value has changed or not. They are never read. Dim oSaveCmd As Offset(Of Short) = New FSUIPC.Offset(Of Short)("saveflt", &H3F00, True) Paul Link to comment Share on other sites More sharing options...
CougarFool Posted December 24, 2021 Author Report Share Posted December 24, 2021 Thanks for the quick response Paul. That has fixed the issue! The annoying thing is that I had to do that in another utility I wrote and forgot all about it! Nigel. Link to comment Share on other sites More sharing options...
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