设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 5018|回复: 7
打印 上一主题 下一主题

[API] 如何在access中使用clipboard(剪切板)啊?

[复制链接]
1#
发表于 2004-8-24 18:34:00 | 显示全部楼层
1。建议你用其他方法2。一定要用剪贴板的话,用API使用WINDOWS 的剪贴板OpenClipboardEmptyClipboardSetClipboardDataGetClipboardDataCloseClipboard非常繁
2#
发表于 2004-8-24 19:31:00 | 显示全部楼层
For you exampleConst LR_LOADFROMFILE = &H10

Const IMAGE_BITMAP = 0

Const IMAGE_ICON = 1

Const IMAGE_CURSOR = 2

Const IMAGE_ENHMETAFILE = 3

Const CF_BITMAP = 2

Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal dwImageType As Long, ByVal dwDesiredWidth As Long, ByVal dwDesiredHeight As Long, ByVal dwFlags As Long) As Long

Private Declare Function CloseClipboard Lib "user32" () As Long

Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long

Private Declare Function EmptyClipboard Lib "user32" () As Long

Private Declare Function SetClipboardData Lib "user32" (ByVal wFormat As Long, ByVal hMem As Long) As Long

Private Declare Function IsClipboardFormatAvailable Lib "user32" (ByVal wFormat As Long) As Long

Private Sub Form_Load()

       hBitmap = LoadImage(App.hInstance, "c:\windows\logow.sys", IMAGE_BITMAP, 320, 200, LR_LOADFROMFILE)

    If hBitmap = 0 Then

        MsgBox "There was an error while loading the bitmap"

        Exit Sub

    End If

    'open the clipboard

    OpenClipboard Me.hwnd

    'Clear the clipboard

    EmptyClipboard

    'Put our bitmap onto the clipboard

    SetClipboardData CF_BITMAP, hBitmap

    'Check if there's a bitmap on the clipboard

    If IsClipboardFormatAvailable(CF_BITMAP) = 0 Then

        MsgBox "There was an error while pasting the bitmap to the clipboard!"

    End If

    'Close the clipboard

    CloseClipboard

    'Get the picture from the clipboard

    Me.Picture = Clipboard.GetData(vbCFBitmap)

End Sub

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-20 09:47 , Processed in 0.157341 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表