1
votes

I made a program in vb.net 2013 . and it's running fine on my computer windows 7

when i did setup for program on the other computer . everything works fine except

when i try to open a file to select a picture .once i click open button the program freezes for a minute then it throws exception :

Problem signature: Problem Event Name: BEX Application Name:: BaldEagle.exe Application Version: 1.0.0.0 Application Timestamp: 55b3c11d Fault Module Name: StackHash_0a9e Fault Module Version: 0.0.0.0 Fault Module Timestamp: 00000000 Exception Offset: c176c13f Exception Code: c0000005 Exception Data: 00000008 OS Version: 6.1.7600.2.0.0.768.3 Locale ID: 1033 Additional Information 1 0a9e Additional Information 2 0a9e372d3b4ad19135b953a78882e789 Additional Information 3 0a9e Additional Information 4 0a9e372d3b4ad19135b953a78882e789

Privacy policy on the internet: http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0401

The code of opening a file to select a picture :

 Dim ofd As New OpenFileDialog
    ofd.Filter = "Text Files (*.jpg)|*.jpg|PNG(*.png)|*.png|gif(*.gif)|*.gif|JPEG(*.jpeg)|*.jpeg"
    ofd.InitialDirectory = "c:\"
    If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then

        Dim bmp As New Bitmap(ofd.FileName)
        If bmp.Width.ToString = "300" And bmp.Height.ToString = "300" Then
            ' MsgBox("Cool")

        Else
            MsgBox("must be 300×300")
            Exit Sub
        End If



        If Application.StartupPath & "\set\logo.png" = ofd.FileName Then
            MsgBox("this is actually your ccurrent logo", MsgBoxStyle.Critical)
            Exit Sub
        End If
        If MsgBox("do you want to change logo ?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
            If My.Computer.FileSystem.FileExists(Application.StartupPath & "\set\logo.png") = True Then
                My.Computer.FileSystem.DeleteFile(Application.StartupPath & "\set\logo.png")
            End If
            My.Computer.FileSystem.CopyFile(ofd.FileName, Application.StartupPath & "\set\logo.png")
        End If
    End If
1
there is an actual exception message, aside from the details portion. If I were to guess, my first would be that your app does not have permission to delete or copy to the StartupPath which could be Program Files. Also, rather than yelling at the user, you could change the size of the bitmap and make it 300x300. you also have lots of stuff not being disposed.Ňɏssa Pøngjǣrdenlarp
@Plutonix thank you . can you tell me what should i do if i wanted my program to delete or copy to startup . because the program is running as administrator . is there also any way other run it as administratorMuteb A.

1 Answers

1
votes

The StackHash error occurs when DEP (Data Execution Prevention) is invoked and has an issue with the application you’re trying to run. Note: I have tried your code and it work's just fine on my machine.

Please see if these steps help to fix the issue...

  1. Click on the Start menu and then go to the Control Panel.
  2. Click on System Maintenance and then System.
  3. Choose Advanced System Settings.
  4. Under System Properties, select Settings from the Performance section at the top.
  5. Click on the Data Execution Prevention tab.
  6. Select “Turn on DEP for all programs and services except those I select”.
  7. Find the executable file for the application that triggered the error.
  8. Select the application causing the error and click Open to add it to your DEP Exceptions list.
  9. Click OK to save your new settings.

More on this issue here.