@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: !!!!VB Signature: <DllImport("OleAut32.dll", EntryPoint:="OleCreatePictureIndirect", ExactSpelling:=True, PreserveSig:=False)> Private Shared Function OleCreatePictureIndirect(<MarshalAs(UnmanagedType.AsAny)>picdesc As Object, ByRef iid As Guid, <MarshalAs(UnmanagedType.Bool)>fOwn As Boolean) As stdole.IPictureDisp End Function !!!!User-Defined Types: Private NotInheritable Class PICTDESC Private Sub New() End Sub Private Enum PicType As Short Uninitialized = -1 None = 0 Bitmap = 1 MetaFile = 2 Icon = 3 EnhMetaFile = 4 End Enum <StructLayout(LayoutKind.Sequential)> Public Structure Bitmap Private ReadOnly SizeOfStruct As Integer Private ReadOnly PicType As Integer Private ReadOnly BitmapHandle As IntPtr Private ReadOnly PaletteHandle As IntPtr Private ReadOnly Padding As Integer Public Sub New(input As Drawing.Bitmap) SizeOfStruct = Marshal.SizeOf(GetType(PICTDESC.Bitmap)) PicType = PICTDESC.PicType.Bitmap BitmapHandle = input.GetHbitmap() PaletteHandle = IntPtr.Zero Padding = 0 End Sub End Structure <StructLayout(LayoutKind.Sequential)> Public Structure Icon Private ReadOnly SizeOfStruct As Integer Private ReadOnly PicType As Integer Private ReadOnly IconHandle As IntPtr Private ReadOnly Padding As Integer Private ReadOnly MorePadding As Integer Public Sub New(input As Drawing.Icon) SizeOfStruct = Marshal.SizeOf(GetType(PICTDESC.Icon)) picType = PICTDESC.PicType.Icon IconHandle = input.Handle Padding = 0 MorePadding = 0 End Sub End Structure End Class None. !!!!Alternative Managed API: Do you know one? Please contribute it! !!!!Notes: Though this function is undoubtedly useful for other purposes, I have only seen it used to convert managed image types to the type required for use in custom Office ribbons. !!!!Tips & Tricks: Please add some! !!!!Sample Code: Public Function ConvertToIPictureDisplay(input As Bitmap) As stdole.IPictureDisp Dim bitmap As PICTDESC.Bitmap = New PICTDESC.Bitmap(input) Return OleCreatePictureIndirect(bitmap, GetType(stdole.IPictureDisp).GUID, True) End Function Documentation: OleCreatePictureIndirect@msdn on MSDN
Edit oleaut32.OleCreat...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.