I manage to publish my my program to project. Its partially working. When I try to use Hot key function ALT Z, (To capture image) this error appears:
Seriously I don't know what to do next. It seems working before I publish it without wany warning or errors.
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(String filename, ImageFormat format)
at WindowsApplication1.frmmain.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
This the place where I save the image: From my reading, it is well said that If the image is locked that this will happen. But I don't have any idea what does it mean. Please let me know if you guys need some more details.
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_HOTKEY Then
Dim id As IntPtr = m.WParam
Select Case (id.ToString)
Case "100"
imagename = Replace(Now.Date, "/", "") & "-" & Int(Now.TimeOfDay.TotalSeconds)
sc.CaptureScreen.Save("sc1/" & imagename & ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
con.Open()
Dim rs As New OleDb.OleDbCommand("INSERT INTO tblcapture (imagename) VALUES ('" & imagename & "')", con)
rs.ExecuteNonQuery()
con.Close()
stat = 2
AddHandler NotifyIcon1.BalloonTipClicked, AddressOf NotifyIcon1_BalloonTipClicked
Me.NotifyIcon1.BalloonTipIcon = ToolTipIcon.Info
Me.NotifyIcon1.BalloonTipText = " You have successfully saved the Screen Capture" & vbCrLf & " then click the notification to proceed"
Me.NotifyIcon1.BalloonTipTitle = " U-Surf System Notification"
Me.NotifyIcon1.ShowBalloonTip(10)
frmQuestionnaire.lblimage.Text = imagename
frmQuestionnaire.UpdateListView()
Me.pmain.Show()
Me.WindowState = FormWindowState.Minimized
End Select
End If
MyBase.WndProc(m)
End Sub
I forgot to mention I am using Icon changed when user hover to the image. at the image can be viewed based on this:-
If Me.PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize Then
Me.PictureBox1.Dock = DockStyle.Fill
Me.PictureBox1.SizeMode = PictureBoxSizeMode.Zoom
Else
Me.PictureBox1.Dock = DockStyle.None
Me.PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize
Dim pbs As Size = Me.PictureBox1.ClientSize
Dim p1s As Size = Me.Panel1.ClientSize
Me.Panel1.AutoScrollPosition = New Point((pbs.Width - p1s.Width) \ 2, (pbs.Height - p1s.Height) \ 2)
End If
I Really need help so that I am able to run this program. This program only involve 3 forms. Upon clicking the hotkey error occurs.
I hope anyone can guide me on this
Thank you.