Hello,
I try to retrieve Print screen when I click on a button in my personal module.
With DNN, the clipboard is empty
With a normal asp.net project, the clipboard contains my bitmap.
Is it due to the security settings ?
----------------
This is my source code :
Public Sub lkPasteScreenshot_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lkPasteScreenshot.Click
Dim cbThread As New Thread(New ThreadStart(AddressOf PasteClipboard))
cbThread.SetApartmentState(ApartmentState.STA)
cbThread.Start()
cbThread.Join()
End Sub
Public Sub PasteClipboard()
Dim d As System.Windows.forms.IDataObject = System.Windows.forms.Clipboard.GetDataObject()
If (d.GetDataPresent(System.Windows.forms.Dataformats.Bitmap)) Then
'-------------------- NO ENTRY HERE WITH DNN ! ------------------
Dim TmpImage As String = "DesktopModules\HDE\Uploads\tmp_Screenshot.jpeg"
Dim bmp As System.Drawing.Bitmap = CType(d.GetData(System.Windows.forms.Dataformats.Bitmap), System.Drawing.Bitmap)
bmp.Save(Request.PhysicalApplicationPath & TmpImage)
imgScreenshot.ImageUrl = "~/" & TmpImage.Replace("\", "/")
Else
lbErrorScreenshot.Text = "No print screen detected..."
End If
End Sub