Link to home
Create AccountLog in
Avatar of JedNebula
JedNebulaFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Application stability

I wrote a VB6 application about 10 years ago, which has been kept going on a life support machine since clients upgraded to Windows 7.

The app uses various third part components. If I do not run the app with XP SP3 Compatibility mode turned on, it is unstable and clients receive frequent random APPCRASHes. I am happy to leave the compatibility turned on except for the fact that it seems to break code that uses the ShellExecute API to open files on network shares.

This only happens when the Windows UAC settings are switched on.

When the app is not run in compatibiluty mode, the ShellExecute code runs fine. I have tried writing a VB.net workaround which Starts a process based on the parametres passed to it, but this didn't work as it inherits it's permissions from the calling app.

It seems I am caught between a rock and a hard place with this one.

I either need to find another way of opening files on a network share, OR somehow make the app run smoothly without forcing the compatibility option. Just to find out what is making it crash would be a start. It could be any one of the third-part controls, or even that VB6 is just not that stable in Win7.

I have tried adding a DEP execption on the client's machine, no joy.

I have read many posts (like this one) which recommend the compatibility option as a solution, but I am fast running out of ideas.

Now I see why developers simply say, sorry we no longer support this application, please upgrade!

My ShellExecute Code:
Public Sub ExecuteOpenFile(strFile As String)
10        If Len(strFile) >= 7 Then
20            If UCase(VBA.left$(strFile, 7)) = "HTTP://" Then
30                Call ExecuteLink(strFile)
40                Exit Sub
50            End If
60        End If
70        If Len(strFile) >= 4 Then
80            If UCase(VBA.left$(strFile, 4)) = "WWW." Then
90                Call ExecuteLink(strFile)
100               Exit Sub
110           End If
120       End If
130       If InStr(1, strFile, "@") And InStr(1, strFile, ".") Then
140           Call ExecuteLink("mailto:" & strFile)
150           Exit Sub
160       End If
170       Call ExecuteLink("explorer.exe", Chr(34) & strFile & Chr(34))
End Sub

Private Function ExecuteLink(ByVal FileName As String, Optional CommandLine As String = "") As Long
10    On Error Resume Next

Dim lngResult As Long

          lngResult = ShellExecute(0&, "Open", FileName, CommandLine, vbNullString, 1)
          ExecuteLink = lngResult
          
End Function

Open in new window



Many thanks in advance for your help.
Avatar of PortletPaul
PortletPaul
Flag of Australia image

what are the "various third part components"?
have you tracked those for updates/alternatives?
Avatar of JedNebula

ASKER

Well funny you should say that. I have contacted Teebo Software solutions this afternoon trying to find out if I am entitled to a free upgrade on their MDI Tabs component that I use. Trouble is, I don't want to go needlessly paying for updates to controls that are not actually causing any issues though with the version I have. How would one tell if it is at fault?

There are too many controls to effectively list, but some of them include:

vbAccelerator - treeview control,
vbAccelerator - explorer bar control,
vbAccelerator - imagelist control,
SWB Gradient Control,
SFTTabs Tab Control,
MBActiveLink Control,
CTSchedulling Control,
BCGDateTime Date Controls,
Arcadia Power Combo Control.

I am happy to upgrade or replace any of these if I can identify the evil one(s).
ASKER CERTIFIED SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Been on other projects, so took me a while to test this out sorry.

Seems to work a treat though - thanks.