WinHex API & In-Place Mode Log Out | Topics | Search
Moderators | Edit Profile

X-Ways Support Forum » Advanced Features » WinHex API & In-Place Mode « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

howard@apextechnology.co.uk
Posted on Monday, Nov 28, 2005 - 16:24:   

I am using Visual Basic whxapi2.bas and API

I could be doing something wrong. It appears trying to open a file in in-place edit mode still requires that I save it to make changes.

I have the following which works to write data from buffer to file.

If WHX_OpenEx("C:\Dummy12345.dat", inPlace) = 0 Then
MsgBox "Could not open the test file."
End If

If WHX_Write(Buffer(0), 512) = 0 Then
MsgBox "Could not write to the test file."
End If

Call WHX_Save

If I omit "Call WHX_Save" the file remains unchanged. If I include it the changes are written to the file ok.

Any ideas, thanks!
Top of pagePrevious messageNext messageBottom of page Link to this message

Stefan Fleischmann (Admin)
Posted on Monday, Nov 28, 2005 - 19:40:   

In accordance with the program help and the user manual, in in-place mode changes are saved lazily and automatically, at latest when closing the window. Maybe you forgot to close the file. If so, how could WinHex know that it's high time to flush the new file contents to the disk.
Top of pagePrevious messageNext messageBottom of page Link to this message

howard@apextechnology.co.uk
Posted on Monday, Nov 28, 2005 - 21:00:   

Thanks for pointing me to the manual, I know you put a lot of effort in the documentation, but perhaps I should have said I have already included

Call WHX_Close

after Call WHX_Save

Again omitting WHX_Save means the changes are not saved.

If it helps,The complete Sub routine is below
----------------------------------------------------------

Sub GotoOffsetReadSector()
Dim Buffer(512) As Byte

If WHX_Goto(VB2API(512)) = 0 Then
MsgBox "Could not go to position", vbCritical, AppName
End If
Call WHX_Read(Buffer(0), 512)

' {Create a new file with an initial size of 1500000 bytes}
If WHX_Create("C:\Dummy12345.dat", 1500000) = 0 Then
MsgBox "Could not create the test file.", vbCritical, AppName
End If
If WHX_OpenEx("C:\Dummy12345.dat", 2) = 0 Then
MsgBox "Could not open the test file.", vbCritical, AppName
End If

Call WHX_Goto(VB2API(1024))
If WHX_Write(Buffer(0), 512) = 0 Then
MsgBox "Could not write to the test file.", vbCritical, AppName
End If
Call WHX_Save
Call WHX_Close

End Sub
Top of pagePrevious messageNext messageBottom of page Link to this message

Stefan Fleischmann (Admin)
Posted on Tuesday, Nov 29, 2005 - 1:22:   

OK, I will have to check this.
Top of pagePrevious messageNext messageBottom of page Link to this message

Stefan Fleischmann (Admin)
Posted on Tuesday, Dec 6, 2005 - 0:23:   

I have to confirm that the second parameter in WHX_OpenEx was ignored, so the edit mode depended on what mode was generally selected for newly opened files in WinHex. Will be fixed with WinHex 12.7 SR-3.

Add Your Message Here
Post:
Username: Posting Information:
Only registered users may post messages here, i.e. you need to have an account.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:
Forum operated by X-Ways Software Technology AG.