|
楼主 |
发表于 2021-9-1 21:58
|
显示全部楼层
本帖最后由 zldccmx 于 2021-9-2 07:32 编辑
'撰写:俺是老朽
'网址:https://club.excelhome.net/
'日期:2021/9/2 7:22:33
Sub C2B()
Dim M_Code$, Base64$, Wsh As Object
Sheet1.[a1].CopyPicture xlScreen, xlBitmap
Set Wsh = CreateObject("wscript.Shell")
M_Code = "function Get-ClipImg {"
M_Code = M_Code & Chr(13) & " Add-Type -AssemblyName 'System.Windows.Forms';"
M_Code = M_Code & Chr(13) & " $s=New-Object System.IO.MemoryStream;"
M_Code = M_Code & Chr(13) & " [System.Windows.Forms.Clipboard]::GetImage().Save($s,[System.Drawing.Imaging.ImageFormat]::png);"
M_Code = M_Code & Chr(13) & " [Microsoft.Win32.Registry]::SetValue('HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer','tmp_clipboard',[System.Convert]::ToBase64String($s.ToArray()))"
M_Code = M_Code & Chr(13) & " }"
M_Code = M_Code & Chr(13) & "Get-ClipImg"
Wsh.Run "powershell -Command " & M_Code, 0, True '后台运行 Powershell ,不显示运行窗口
Base64 = Wsh.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\tmp_clipboard")
If Base64 <> "" Then
Debug.Print Base64
End If
End Sub
|
|