Thanks for all your help, its much appreciated. I took another look at my
code and got similar errors when using LoadFile so I decided to use the
Reflector tool to see how MS implemented the callback by looking at
OleCallback which I know MS returns in CreateRichEditOleCallback. When
going through each of the interface definitions and comparing them to my
originals, I found I had translated two parameters as ByRef rather than
ByVal leading to the memory access violations I was receiving. In
addition, I decided to implemet the storage on a byte array in memory as
per MS code:
Public Function GetNewStorage(<Out> ByRef storage As IStorage) As Integer
      Dim bytes1 As ILockBytes =
UnsafeNativeMethods.CreateILockBytesOnHGlobal(NativeMethods.NullHandleRef,
True)
      storage = UnsafeNativeMethods.StgCreateDocfileOnILockBytes(bytes1,
4114, 0)
      Return 0
End Function

Everything appears to work well now. I then went through and compared each
of my callback function definitions with theirs and this led to another
question, which I will be posting as another thread.

Again, thanks for all your help.

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to