Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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.
VB
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"
               ' Button2_Click(Nothing, Nothing)
               'add 07/02/11
               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  ' Info on the balloon. you can change it to warning or error type as welll
               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

               ' add 09/02/2011 
               '  frmqlist.UpdateListView()
               frmQuestionnaire.UpdateListView()

               'frmQuestionnaire.Show()
               Me.pmain.Show()
               ' me.Hide()
               Me.WindowState = FormWindowState.Minimized

               '   Form2.Show()
         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:-
VB
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
      'Display center-part of the image
      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.
Posted
Updated 17-Feb-11 22:58pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900