S
SamSpade
[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]public
static extern int SendMessage(
IntPtr hWnd, [MarshalAs(UnmanagedType.U4)] int Msg, int wParam, IntPtr
lParam);
--snip
SelectionFont.cbSize = Marshal.SizeOf(SelectionFont)
SelectionFont.dwMask = Rtf.CFM_FACE
Dim TmpStruc As IntPtr = Marshal.AllocHGlobal(SelectionFont.cbSize)
Marshal.StructureToPtr(SelectionFont, TmpStruc, True)
NumOfCharReturned = WinApi.SendMessage(gctlText.TxtHandle,
Rtf.EM_GETCHARFORMAT, Rtf.SCF_SELECTION, TmpStruc)
Marshal.PtrToStructure(TmpStruc, SelectionFont)
Marshal.FreeHGlobal(TmpStruc)
==========
It returns a large negative NumOfCharReturned and bombs at
Marshal.PtrToStructure.
static extern int SendMessage(
IntPtr hWnd, [MarshalAs(UnmanagedType.U4)] int Msg, int wParam, IntPtr
lParam);
--snip
SelectionFont.cbSize = Marshal.SizeOf(SelectionFont)
SelectionFont.dwMask = Rtf.CFM_FACE
Dim TmpStruc As IntPtr = Marshal.AllocHGlobal(SelectionFont.cbSize)
Marshal.StructureToPtr(SelectionFont, TmpStruc, True)
NumOfCharReturned = WinApi.SendMessage(gctlText.TxtHandle,
Rtf.EM_GETCHARFORMAT, Rtf.SCF_SELECTION, TmpStruc)
Marshal.PtrToStructure(TmpStruc, SelectionFont)
Marshal.FreeHGlobal(TmpStruc)
==========
It returns a large negative NumOfCharReturned and bombs at
Marshal.PtrToStructure.