[RESOLVED] My program is not compatible with Windows XP
Hey guys!
I've made a program in Visual Basic 2010 SP1, but users that are on Windows XP report that it isn't compatible, although they have installed Microsoft.NET Framework 4. I even tested it myself on a WinXP computer with the latest framework and it just crashes. My computer has Windows 7 and it works flawlessly. All my other programs are compatible with XP, but this one isn't. I have developed this program in Visual Basic 2010 SP1, and the other were developed in the normal Visual Basic 2010. Does this problem have anything to do with Visual Basic 2010 SP1?
Re: My program is not compatible with Windows XP
Do you use any special controls that are listed under "Visual Basic Powerpacks"?
I used one of these before (to draw a line) and it crashed my program as soon the dialog containing this control popped up.
Re: My program is not compatible with Windows XP
Quote:
Originally Posted by
bergerkiller
Do you use any special controls that are listed under "Visual Basic Powerpacks"?
I used one of these before (to draw a line) and it crashed my program as soon the dialog containing this control popped up.
No, there's nothing special.
Re: My program is not compatible with Windows XP
Um could it be an API you use that should be declarated differently?
(Alias SendMessageA only fixes it for 32 bit, 64 bit can crash or fail)
(This also includes external libraries you referenced, they could be 32 bit only)
Re: My program is not compatible with Windows XP
"Just crashes" is not really enough to go on. Check the windows event log, usually you can get more info then that (if you did not get more and have just not told us of course).
Re: My program is not compatible with Windows XP
Quote:
Originally Posted by
Grimfort
"Just crashes" is not really enough to go on. Check the windows event log, usually you can get more info then that (if you did not get more and have just not told us of course).
I got an error saying that the program had crashed and it asked me if I want to send an error report to Microsoft. That's all.
Re: My program is not compatible with Windows XP
Click Start/Run, enter eventvwr.msc and click OK.
You'll see a management console. Click the application branch on the left, on the right you'll see the list of errors. Look for your app there. Some extended information about the error can be there.
Re: My program is not compatible with Windows XP
Is the Win7 machine 64-bit by any chance? What is your build options set for? Any CPU? x64? x86?
-tg
Re: My program is not compatible with Windows XP
Quote:
Originally Posted by
techgnome
Is the Win7 machine 64-bit by any chance? What is your build options set for? Any CPU? x64? x86?
-tg
It's built on Windows 7 64bit, but it's a 32bit program and it's tested and working on Windows 7 32bit. It has problems only with XP.
Re: My program is not compatible with Windows XP
Quote:
Originally Posted by
cicatrix
Click Start/Run, enter eventvwr.msc and click OK.
You'll see a management console. Click the application branch on the left, on the right you'll see the list of errors. Look for your app there. Some extended information about the error can be there.
I did what you said. That didn't give me much info, just some binary.
Re: My program is not compatible with Windows XP
Does the program crash as soon as it is opened under XP?
Re: My program is not compatible with Windows XP
Quote:
Originally Posted by
stanav
Does the program crash as soon as it is opened under XP?
No, first the splash screen is shown, and then the program crashes.
Re: My program is not compatible with Windows XP
Quote:
Originally Posted by
despotovski01
No, first the splash screen is shown, and then the program crashes.
OK... So I guess there's something in your main splash screen or form load event that causes it to crash. You can try wrapping the splash screen/main form load code in a try/catch block (or handle the Application.UnhandledException event) to get some info on the error. We'll go from there once we'll get more info about the error.
Re: My program is not compatible with Windows XP
When you use a Try Catch block always make sure to get the ex.Message.
Code:
Try
' Your form load event code or splash screen code or
' any other code you suspect might cause the problem.
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Re: My program is not compatible with Windows XP
Quote:
Originally Posted by
EntityX
When you use a Try Catch block always make sure to get the ex.Message.
Code:
Try
' Your form load event code or splash screen code or
' any other code you suspect might cause the problem.
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Yeah, I know. :) I'll do it now.
Re: My program is not compatible with Windows XP
I've put an error handler. Here's the error:
"An error occurred creating the form. See Exception.InnerException for details. The error is: Exception has been thrown by the target of an invocation."
I suppose now I should create another messageBox with Exception.InnerException message, right?
Re: My program is not compatible with Windows XP
Functions:
Code:
Public Function GetExceptionText(ByVal Ex As Exception) As String
Dim trace As StackTrace = New StackTrace(Ex, True)
Dim msg As String = Ex.Message & vbCrLf
Try
For Each frame As StackFrame In trace.GetFrames
msg &= vbCrLf & "At " & frame.GetMethod.Name & " (" & frame.GetFileLineNumber & ")"
Dim name As String = System.IO.Path.GetFileName(frame.GetFileName)
If name <> "" Then msg &= " in " & name
Next
Catch
End Try
Return msg
End Function
Public Sub ShowExceptionDialog(ByVal Ex As Exception)
MessageBox.Show(GetExceptionText(Ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Sub
In the catch handler, simply add this:
Code:
ShowExceptionDialog(Ex)
It will show the entire stack trace, allowing you to see exactly at which line the error occurred.
Re: My program is not compatible with Windows XP
Quote:
Originally Posted by
bergerkiller
Functions:
Code:
Public Function GetExceptionText(ByVal Ex As Exception) As String
Dim trace As StackTrace = New StackTrace(Ex, True)
Dim msg As String = Ex.Message & vbCrLf
Try
For Each frame As StackFrame In trace.GetFrames
msg &= vbCrLf & "At " & frame.GetMethod.Name & " (" & frame.GetFileLineNumber & ")"
Dim name As String = System.IO.Path.GetFileName(frame.GetFileName)
If name <> "" Then msg &= " in " & name
Next
Catch
End Try
Return msg
End Function
Public Sub ShowExceptionDialog(ByVal Ex As Exception)
MessageBox.Show(GetExceptionText(Ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Sub
In the catch handler, simply add this:
Code:
ShowExceptionDialog(Ex)
It will show the entire stack trace, allowing you to see exactly at which line the error occurred.
Thanks you! I just found out that my program was crashing because of the icon. :mad::mad::mad::D:D:D
Re: My program is not compatible with Windows XP
Quote:
Originally Posted by
despotovski01
Thanks you! I just found out that my program was crashing because of the icon. :mad::mad::mad::D:D:D
Many thanks for your superb suggestions. The error trapping function really helped. I had problem with folder location in windows that i was calling on my development PC which was not found on the other PC. I have used the Environment.GetFolderPath method to tackle that and have moved all my data files in the application Local
Once again many thanks.:thumb:
Re: My program is not compatible with Windows XP
Quote:
Originally Posted by
EntityX
When you use a Try Catch block always make sure to get the ex.Message.
Code:
Try
' Your form load event code or splash screen code or
' any other code you suspect might cause the problem.
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
IMHO error handling for the sake of error handling where you expect NO errors to occur is a bad idea... yes error handling is a necessity, but know when NOT to use it also...
I would suggest making a global unhandled error catcher and make it return something more useful than just the exception message (such as the call stack); also if you include the PDB files with your final project you can also get the line numbers for the call stack.