Visual Basic, .NET, ASP, VBA, VBScript
 
  Библиотека кодов  
  Работа с WINDOWS  
     
  Определение формата данных буфера обмена  
  Не забудьте на форме разместить элемент ListBox и Command.
Private Declare Function CountClipboardFormats Lib "USER32" () As Long
Private Declare Function EnumClipboardFormats Lib "USER32" (ByVal wFormat As Long) As Long
Private Declare Function OpenClipboard Lib "USER32" (ByVal hWnd As Long) As Long
Private Declare Function CloseClipboard Lib "USER32" () As Long
Private Declare Function GetClipboardFormatName Lib "USER32" Alias "GetClipboardFormatNameA" (ByVal wFormat As Long, ByVal lpString As String, ByVal nMaxCount As Long) As Long
Private Enum EPredefinedClipboardFormatConstants
[_First] = 1
CF_TEXT = 1
CF_BITMAP = 2
CF_METAFILEPICT = 3
CF_SYLK = 4
CF_DIF = 5
CF_TIFF = 6
CF_OEMTEXT = 7
CF_DIB = 8
CF_PALETTE = 9
CF_PENDATA = 10
CF_RIFF = 11
CF_WAVE = 12
CF_UNICODETEXT = 13
CF_ENHMETAFILE = 14
CF_HDROP = 15
CF_LOCALE = 16
CF_MAX = 17
[_Last] = 17
End Enum

Private Property Get FormatName(ByVal lFormatId As Long) As String
Dim lSize As Long
Dim sBuf As String
Dim lR As Long
If (lFormatId >= EPredefinedClipboardFormatConstants.[_First] And lFormatId <= EPredefinedClipboardFormatConstants.[_Last]) Then
' For pre-defined formats, we have to make the text up ourselves:
Select Case lFormatId
Case CF_TEXT
FormatName = "Text"
Case CF_BITMAP
FormatName = "Bitmap Picture"
Case CF_METAFILEPICT
FormatName = "Meta-File Picture"
Case CF_SYLK
FormatName = "Microsoft Symbolic Link (SYLK) data."
Case CF_DIF
FormatName = "Software Arts' Data Interchange information."
Case CF_TIFF = 6
FormatName = "Tagged Image File Format (TIFF) Picture"
Case CF_OEMTEXT
FormatName = "Text (OEM)"
Case CF_DIB
FormatName = "DIB Bitmap Picture"
Case CF_PALETTE
FormatName = "Colour Palette"
Case CF_PENDATA
FormatName = "Pen Data"
Case CF_RIFF
FormatName = "RIFF Audio data"
Case CF_WAVE
FormatName = "Wave File"
Case CF_UNICODETEXT
FormatName = "Text (Unicode)"
Case CF_ENHMETAFILE
FormatName = "Enhanced Meta-File Picture"
Case CF_HDROP
FormatName = "File List"
Case CF_LOCALE
FormatName = "Text Locale Identifier"
End Select
Else
' For custom formats, we can ask the Clipboard for the registered name:
lSize = 255
sBuf = String$(lSize, 0)
lR = GetClipboardFormatName(lFormatId, sBuf, lSize)
If (lR <> 0) Then
FormatName = Left$(sBuf, lR)
End If
End If
End Property

Private Sub Command1_Click()
Dim lR As Long
Dim iCount As Long
List1.Clear
If (OpenClipboard(Me.hWnd)) Then
lR = EnumClipboardFormats(0)
If (lR <> 0) Then
Do
iCount = iCount + 1
List1.AddItem FormatName(lR)
List1.ItemData(List1.NewIndex) = lR
lR = EnumClipboardFormats(lR)
Loop While lR <> 0
End If
End If
CloseClipboard
End Sub
 
     
  VBNet online (всего: 51566)  
 

Логин:

Пароль:

Регистрация, забыли пароль?


В чате сейчас человек
 
     
  VBNet рекомендует  
   
     
  Лучшие материалы  
 
ActiveX контролы (112)
Hitman74_Library (36119)
WindowsXPControls (20739)
FlexGridPlus (19374)
DSMAniGifControl (18295)
FreeButton (15157)
Примеры кода (546)
Parol (18027)
Passworder (9299)
Screen saver (7654)
Kerish AI (5817)
Folder_L (5768)
Статьи по VB (136)
Мое второе впечатление... (11236)
VB .NET: дорога в будущее (11161)
Основы SQL (9225)
Сообщения Windows в Vi... (8788)
Классовая теория прогр... (8619)
 
     
Техническая поддержка MTW-хостинг | © Copyright 2002-2011 VBNet.RU | Пишите нам