I'm using an extended RichTextBox control in my application to generate RTF documents with embedded images. I'm embedding the images as EMF metafiles with {\pict\wmetafile8\picw[A]\pich[B]\picwgoal[C]\pichgoal[D]...
In Windows XP SP1, Windows Vista, and Windows 7, the documents are generated correctly, and I can see not only images in my documents, but also images contained within tables.
However, running the application in Windows 8, I can see the embedded images only if they're not contained within a table.
I understand Windows 8 uses a new version of the RichEdit control, and I suspect my application is not finding RICHEDIT50W within msftedit.dll, and is therefore falling back to the older version that Windows 8 includes for backward compatibility.
Here's the code my extended RichTextBox control uses to load the appropriate library:
Private Shared Function LoadLibrary(ByVal lpFileName As String) As IntPtr
End Function
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim lResult As IntPtr = LoadLibrary("msftedit.dll")
If lResult = IntPtr.Zero Then
MessageBox.Show(Marshal.GetLastWin32Error().ToString())
End If
Dim cp As CreateParams = MyBase.CreateParams
cp.ClassName = "RICHEDIT50W"
Return cp
End Get
End Property
Without fishing around for the right value, should cp.ClassName
be something else in Windows 8 to load the appropriate base control, or is embedding images within tables something that got lost in the new editor?