Click here to Skip to main content
15,890,438 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: how do i know detail about textbox's event Pin
Dave Kreskowiak13-Jun-06 1:59
mveDave Kreskowiak13-Jun-06 1:59 
QuestionFunction Replace Pin
angelagke12-Jun-06 16:22
angelagke12-Jun-06 16:22 
AnswerRe: Function Replace Pin
Guffa12-Jun-06 19:20
Guffa12-Jun-06 19:20 
GeneralRe: Function Replace Pin
angelagke12-Jun-06 19:30
angelagke12-Jun-06 19:30 
QuestionHow to read user data from Active Directory? Pin
mypetlily12-Jun-06 16:05
mypetlily12-Jun-06 16:05 
AnswerRe: How to read user data from Active Directory? Pin
bhb1812-Jun-06 20:38
bhb1812-Jun-06 20:38 
QuestionGetting bitmaps off clipboard Pin
MarchJ12-Jun-06 15:58
MarchJ12-Jun-06 15:58 
AnswerRe: Getting bitmaps off clipboard Pin
progload12-Jun-06 21:24
progload12-Jun-06 21:24 
MarchJ,

Items from PowerPoint are placed on the clipboard as an "Enhanced" Metafile Format Image, not a bitmap. You can open them in paint because it can automaticaly open an enhanced metafile (one of the reasons paint is still around).

The only way I know to retrieve the enhanced metafile from the clipboard is to still use the windows API clipboard functions.

This should work in VB2003, and VB2005.

'--- Class --------------------------------------------------
Imports System.Runtime.InteropServices

Public Class ClipboardAPI

<DllImport("user32.dll", EntryPoint:="OpenClipboard", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function OpenClipboard(ByVal hWnd As IntPtr) As Boolean
End Function


<DllImport("user32.dll", EntryPoint:="EmptyClipboard", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function EmptyClipboard() As Boolean
End Function


<DllImport("user32.dll", EntryPoint:="SetClipboardData", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function SetClipboardData(ByVal uFormat As Integer, ByVal hWnd As IntPtr) As IntPtr
End Function


<DllImport("user32.dll", EntryPoint:="CloseClipboard", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function CloseClipboard() As Boolean
End Function


<DllImport("user32.dll", EntryPoint:="GetClipboardData", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function GetClipboardData(ByVal uFormat As Integer) As IntPtr
End Function


<DllImport("user32.dll", EntryPoint:="IsClipboardFormatAvailable", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function IsClipboardFormatAvailable(ByVal uFormat As Integer) As Short
End Function

End Class
'--------------------------------------------------------

'------- Form code --------------------------------------

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Const CF_ENHMETAFILE As Integer = 14

Dim hEnMetaFile As IntPtr
Dim metafile As System.Drawing.Imaging.Metafile

If ClipboardAPI.OpenClipboard(Me.Handle) Then
If ClipboardAPI.IsClipboardFormatAvailable(CF_ENHMETAFILE) <> 0 Then
henmetafile = ClipboardAPI.GetClipboardData(CF_ENHMETAFILE)
metafile = New System.Drawing.Imaging.Metafile(hEnMetaFile, True)
ClipboardAPI.CloseClipboard()
PictureBox1.Image = metafile
End If
End If
End Sub

'----------------------------------------------------------------------


Hope that helps.

progload

GeneralRe: Getting bitmaps off clipboard Pin
MarchJ22-Jun-06 13:45
MarchJ22-Jun-06 13:45 
GeneralRe: Getting bitmaps off clipboard Pin
MarchJ30-Jun-06 12:17
MarchJ30-Jun-06 12:17 
Questionmay somebody help me to deploy ma app. please ?? Pin
Mohammed Amine12-Jun-06 14:13
Mohammed Amine12-Jun-06 14:13 
AnswerRe: may somebody help me to deploy ma app. please ?? Pin
Mekong River12-Jun-06 15:13
Mekong River12-Jun-06 15:13 
GeneralRe: may somebody help me to deploy ma app. please ?? Pin
cyberexel9-Jun-10 15:49
cyberexel9-Jun-10 15:49 
Questionhi guys can you help me ?? it is abt crystal report Pin
Mohammed Amine12-Jun-06 12:34
Mohammed Amine12-Jun-06 12:34 
AnswerRe: hi guys can you help me ?? it is abt crystal report Pin
Mekong River12-Jun-06 15:17
Mekong River12-Jun-06 15:17 
AnswerRe: hi guys can you help me ?? it is abt crystal report [modified] Pin
Kschuler13-Jun-06 3:22
Kschuler13-Jun-06 3:22 
GeneralRe: hi guys can you help me ?? it is abt crystal report Pin
Mohammed Amine13-Jun-06 4:22
Mohammed Amine13-Jun-06 4:22 
GeneralRe: hi guys can you help me ?? it is abt crystal report Pin
Kschuler13-Jun-06 4:31
Kschuler13-Jun-06 4:31 
QuestionObject reference not set to an instance of an object. Pin
cmtek12-Jun-06 12:14
cmtek12-Jun-06 12:14 
AnswerRe: Object reference not set to an instance of an object. Pin
Mekong River12-Jun-06 15:20
Mekong River12-Jun-06 15:20 
GeneralRe: Object reference not set to an instance of an object. Pin
cmtek14-Jun-06 4:27
cmtek14-Jun-06 4:27 
QuestionOdbc Procedure call problem Pin
Antebios115312-Jun-06 11:03
Antebios115312-Jun-06 11:03 
AnswerRe: Odbc Procedure call problem Pin
Antebios115312-Jun-06 11:04
Antebios115312-Jun-06 11:04 
QuestionAutomating email send in vb.net Pin
Soundz12-Jun-06 10:49
Soundz12-Jun-06 10:49 
AnswerRe: Automating email send in vb.net Pin
Mekong River12-Jun-06 15:28
Mekong River12-Jun-06 15:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.