Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.misc > #1641 > unrolled thread
| Started by | "Ivar" <ivar.ekstromer000@ntlworld.com> |
|---|---|
| First post | 2012-12-09 08:14 +0000 |
| Last post | 2013-01-21 11:29 -0500 |
| Articles | 20 on this page of 25 — 10 participants |
Back to article view | Back to comp.lang.basic.visual.misc
Trapping Windows Error "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-12-09 08:14 +0000
Re: Trapping Windows Error ralph <nt_consulting64@yahoo.com> - 2012-12-09 17:24 -0600
Re: Trapping Windows Error "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-12-10 13:00 +0000
Re: Trapping Windows Error Deanna Earley <dee.earley@icode.co.uk> - 2012-12-10 13:10 +0000
Re: Trapping Windows Error "Tim Rude" <timrude.nospam@nospam.hotmail.com> - 2012-12-10 09:26 -0600
Re: Trapping Windows Error "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-12-10 17:31 +0000
Re: Trapping Windows Error "Tim Rude" <timrude.nospam@nospam.hotmail.com> - 2012-12-10 14:35 -0600
Re: Trapping Windows Error Deanna Earley <dee.earley@icode.co.uk> - 2012-12-11 08:57 +0000
Re: Trapping Windows Error Karl E. Peterson <karl@exmvps.org> - 2012-12-11 14:40 -0800
Re: Trapping Windows Error Deanna Earley <dee.earley@icode.co.uk> - 2012-12-12 08:53 +0000
Re: Trapping Windows Error Jim Mack <no-uce-ube@mdxi.com> - 2012-12-10 12:01 -0500
Re: Trapping Windows Error "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-12-10 17:42 +0000
Re: Trapping Windows Error Jim Mack <no-uce-ube@mdxi.com> - 2012-12-10 15:23 -0500
Re: Trapping Windows Error "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-12-10 20:35 +0000
Re: Trapping Windows Error "Thorsten Albers" <gudea@gmx.de> - 2012-12-10 20:48 +0000
Re: Trapping Windows Error Jim Mack <no-uce-ube@mdxi.com> - 2012-12-10 15:51 -0500
Re: Trapping Windows Error "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-12-10 21:52 +0000
Re: Trapping Windows Error Jim Mack <no-uce-ube@mdxi.com> - 2012-12-10 17:37 -0500
Re: Trapping Windows Error "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-12-11 05:39 +0000
Re: Trapping Windows Error RW <RonW@no_domain.invalid> - 2012-12-11 15:12 -0500
Re: Trapping Windows Error "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-12-12 05:57 +0000
Re: Trapping Windows Error Deanna Earley <dee.earley@icode.co.uk> - 2012-12-12 08:54 +0000
Re: Trapping Windows Error "Thorsten Albers" <gudea@gmx.de> - 2012-12-11 21:44 +0000
Re: Trapping Windows Error GS <gs@somewhere.net> - 2012-12-10 18:30 -0500
Re: Trapping Windows Error David Kerber <dkerber@WarrenRogersAssociates.invalid> - 2013-01-21 11:29 -0500
Page 1 of 2 [1] 2 Next page →
| From | "Ivar" <ivar.ekstromer000@ntlworld.com> |
|---|---|
| Date | 2012-12-09 08:14 +0000 |
| Subject | Trapping Windows Error |
| Message-ID | <qLXws.1134789$ti6.623659@fx20.am4> |
Hi All. Here's hoping the VB6 gurus are still monitoring this newsgroup. I recently updated an app of mine and distributed it to the end users. A Couple of users have reported a problem where the app will stop working and a message comes up with: ProgName has encountered a problem and has to close Windows is searching for a solution. I can't replicate this problem on any machine I have access to, but I'm fairly sure it's when the app calls the 'FreeLibrary' API of "kernel32" Because it seems to work for most users, I'm assuming some users have a broken Kernel32.DLL Is it possible for a VB6 app to handle this kind of error? And of course, If so, How? Thanks for any pointers. Ivar
[toc] | [next] | [standalone]
| From | ralph <nt_consulting64@yahoo.com> |
|---|---|
| Date | 2012-12-09 17:24 -0600 |
| Message-ID | <545ac8dmg5vn6bvfm8k4efo5eedr07ag8a@4ax.com> |
| In reply to | #1641 |
On Sun, 9 Dec 2012 08:14:31 -0000, "Ivar" <ivar.ekstromer000@ntlworld.com> wrote: >Hi All. > >Here's hoping the VB6 gurus are still monitoring this newsgroup. >I recently updated an app of mine and distributed it to the end users. >A Couple of users have reported a problem where the app will stop working >and a message comes up with: >ProgName has encountered a problem and has to close >Windows is searching for a solution. >I can't replicate this problem on any machine I have access to, but I'm >fairly sure it's when the app calls the 'FreeLibrary' API of "kernel32" >Because it seems to work for most users, I'm assuming some users have a >broken Kernel32.DLL > >Is it possible for a VB6 app to handle this kind of error? >And of course, If so, How? > >Thanks for any pointers. > >Ivar Highly improbable that your Users have a "broken Kernel32.DLL". If they did - they would be having a lot more issues than just with your program. Due to configuration differences and complexities of Windows platforms, it is entirely possible while invoking an external process or service to have success in one scenario, yet fail, with or without error, in another. As for capturing the error - assuming it is in fact your application that is throwing the error, and that it is happening past 'startup' or launch, then simply reengineer your application to not have any unhandled exceptions, ie provide at least a "top" error handler for all possible paths. This is seldom as time consuming nor complicated as it might first appear. [Tools such as MZ-Tools makes this instrumentation easier.] Another way to get more accurate information on where an error is coming from is to enable Dr. Watson - if Users are using Windows XP or below. Or perhaps getting the Users to install and enable WinDbg if using Vista or Windows 7/8. -ralph
[toc] | [prev] | [next] | [standalone]
| From | "Ivar" <ivar.ekstromer000@ntlworld.com> |
|---|---|
| Date | 2012-12-10 13:00 +0000 |
| Message-ID | <c1lxs.804333$A%.470356@fx26.am4> |
| In reply to | #1642 |
Hi Ralph Thank you for your reply. I sent my client a new exe file with the FreeLibrary call commented out and app does not stop working. So I'm sure it's that API call that's causing the problem I have some old sample code that calls some API functions (probably from PSC) Where if I run it from within the IDE Then it will cause VB6 to stop working and freeze with the same 'ProgName has stopped working' windows message, with a progress doing it's thing, and if I run it as a compiled exe it will do the same thing (ProgName changes obviously) After clicking the Cancel button the complied exe or VB6 will just close. 'On Error Resume Next' or 'On Error GoTo' makes no difference when running this sample code as compiled exe or within VB6 IDE. It's Not a run time error . My App seems to run quite happily with this FreeLibrary call on all but 2 machines (Both running Windows 7, but so are others) I'm thinking that Any App (even VB6 itself) cannot handle this kind of error. Still hoping someone can prove me wrong :-) Ivar
[toc] | [prev] | [next] | [standalone]
| From | Deanna Earley <dee.earley@icode.co.uk> |
|---|---|
| Date | 2012-12-10 13:10 +0000 |
| Message-ID | <ka4mvo$7s5$1@speranza.aioe.org> |
| In reply to | #1643 |
On 10/12/2012 13:00, Ivar wrote: > Hi Ralph > > Thank you for your reply. > I sent my client a new exe file with the FreeLibrary call commented out > and app does not stop working. > So I'm sure it's that API call that's causing the problem > I have some old sample code that calls some API functions (probably from > PSC) Where if I run it from within the IDE Then it will cause VB6 to > stop working and freeze with the same 'ProgName has stopped working' > windows message, with a progress doing it's thing, and if I run it as a > compiled exe it will do the same thing (ProgName changes obviously) > After clicking the Cancel button the complied exe or VB6 will just close. > 'On Error Resume Next' or 'On Error GoTo' makes no difference when > running this sample code as compiled exe or within VB6 IDE. > > It's Not a run time error . My App seems to run quite happily with this > FreeLibrary call on all but 2 machines (Both running Windows 7, but so > are others) > I'm thinking that Any App (even VB6 itself) cannot handle this kind of > error. > Still hoping someone can prove me wrong :-) C++ apps can handle exceptions (if they're careful) but VB6 apps can't (easily). FreeLibrary itself is unlikely to be the cause of an unhandled exception (as they aren't common in Win32) but it could be caused by any DLL or process hooked into it, i.e antivirus, etc, or just some code related to the FreeLibrary call in your code that is faulty. Your only hope to fix it properly is to get a full error message with the exception code. This will be listed in the event viewer and sometimes in the WER crash dialog itself. -- Deanna Earley (dee.earley@icode.co.uk) i-Catcher Development Team http://www.icode.co.uk/icatcher/ iCode Systems (Replies direct to my email address will be ignored. Please reply to the group.)
[toc] | [prev] | [next] | [standalone]
| From | "Tim Rude" <timrude.nospam@nospam.hotmail.com> |
|---|---|
| Date | 2012-12-10 09:26 -0600 |
| Message-ID | <ka4uvm$evq$1@dont-email.me> |
| In reply to | #1643 |
"Ivar" <ivar.ekstromer000@ntlworld.com> wrote in message news:c1lxs.804333$A%.470356@fx26.am4... > Hi Ralph > > Thank you for your reply. > I sent my client a new exe file with the FreeLibrary call commented out > and app does not stop working. Try sending the client an exe with the FreeLibrary call (not commented out) preceeded by 'On Error Resume Next'. Immediately after the FreeLibrary call line, add: MsgBox "Program execution continues" If the app runs without crashing and your user gets the messagebox popup, that tells you that VB can handle (either trap and deal with or else ignore) this errror. Then it's up to you how to best handle it within VB. If the program crashes and the messagebox doesn't pop up, then you may have something VB can't deal with (seems unlikely).
[toc] | [prev] | [next] | [standalone]
| From | "Ivar" <ivar.ekstromer000@ntlworld.com> |
|---|---|
| Date | 2012-12-10 17:31 +0000 |
| Message-ID | <Y%oxs.1255693$ti6.674002@fx20.am4> |
| In reply to | #1645 |
Hi Tim The Program does not 'Crash', It stops execution, Fades out a bit and the windows dialog does it's thing until the user clicks Cancel or windows generates 2 or 3 text files that invites you to send to Microsoft. Then the app will just end. On Error Resume Next and On Error GoTo does nothing because the app itself does not error. Ivar "Tim Rude" wrote in message news:ka4uvm$evq$1@dont-email.me... "Ivar" <ivar.ekstromer000@ntlworld.com> wrote in message news:c1lxs.804333$A%.470356@fx26.am4... > Hi Ralph > > Thank you for your reply. > I sent my client a new exe file with the FreeLibrary call commented out > and app does not stop working. Try sending the client an exe with the FreeLibrary call (not commented out) preceeded by 'On Error Resume Next'. Immediately after the FreeLibrary call line, add: MsgBox "Program execution continues" If the app runs without crashing and your user gets the messagebox popup, that tells you that VB can handle (either trap and deal with or else ignore) this errror. Then it's up to you how to best handle it within VB. If the program crashes and the messagebox doesn't pop up, then you may have something VB can't deal with (seems unlikely).
[toc] | [prev] | [next] | [standalone]
| From | "Tim Rude" <timrude.nospam@nospam.hotmail.com> |
|---|---|
| Date | 2012-12-10 14:35 -0600 |
| Message-ID | <ka5h2f$bca$1@dont-email.me> |
| In reply to | #1647 |
"Ivar" <ivar.ekstromer000@ntlworld.com> wrote in message news:Y%oxs.1255693$ti6.674002@fx20.am4... > Hi Tim > > The Program does not 'Crash', It stops execution, Fades out a bit and the > windows dialog does it's thing until the user clicks Cancel or windows > generates 2 or 3 text files that invites you to send to Microsoft. Then > the app will just end. > On Error Resume Next and On Error GoTo does nothing because the app itself > does not error. > > Ivar Well then, maybe you're attempting to unload something you shouldn't be unloading at that point. Maybe it's something your VB app still needs. It kinda sounds like your kicking the legs out from under it.
[toc] | [prev] | [next] | [standalone]
| From | Deanna Earley <dee.earley@icode.co.uk> |
|---|---|
| Date | 2012-12-11 08:57 +0000 |
| Message-ID | <ka6sig$jid$1@speranza.aioe.org> |
| In reply to | #1647 |
On 10/12/2012 17:31, Ivar wrote: > Hi Tim > > The Program does not 'Crash', It stops execution, Fades out a bit and > the windows dialog does it's thing until the user clicks Cancel or > windows generates 2 or 3 text files that invites you to send to > Microsoft. Then the app will just end. That's a crash. > On Error Resume Next and On Error GoTo does nothing because the app > itself does not error. Just not one you can handle after it's occurred. -- Deanna Earley (dee.earley@icode.co.uk) i-Catcher Development Team http://www.icode.co.uk/icatcher/ iCode Systems (Replies direct to my email address will be ignored. Please reply to the group.)
[toc] | [prev] | [next] | [standalone]
| From | Karl E. Peterson <karl@exmvps.org> |
|---|---|
| Date | 2012-12-11 14:40 -0800 |
| Message-ID | <ka8coi$q0k$1@dont-email.me> |
| In reply to | #1659 |
on 12/11/2012, Deanna Earley supposed : > On 10/12/2012 17:31, Ivar wrote: >> Hi Tim >> >> The Program does not 'Crash', It stops execution, Fades out a bit and >> the windows dialog does it's thing until the user clicks Cancel or >> windows generates 2 or 3 text files that invites you to send to >> Microsoft. Then the app will just end. > > That's a crash. > >> On Error Resume Next and On Error GoTo does nothing because the app >> itself does not error. > > Just not one you can handle after it's occurred. Could set a GPF hook, no? I'd hafta look it up, but I'm sure I (or someone I was working with <g>) wrote a column about that at one point. -- .NET: It's About Trust! http://vfred.mvps.org
[toc] | [prev] | [next] | [standalone]
| From | Deanna Earley <dee.earley@icode.co.uk> |
|---|---|
| Date | 2012-12-12 08:53 +0000 |
| Message-ID | <ka9gn3$1gr$1@speranza.aioe.org> |
| In reply to | #1664 |
On 11/12/2012 22:40, Karl E. Peterson wrote: > on 12/11/2012, Deanna Earley supposed : >> On 10/12/2012 17:31, Ivar wrote: >>> Hi Tim >>> >>> The Program does not 'Crash', It stops execution, Fades out a bit and >>> the windows dialog does it's thing until the user clicks Cancel or >>> windows generates 2 or 3 text files that invites you to send to >>> Microsoft. Then the app will just end. >> >> That's a crash. >> >>> On Error Resume Next and On Error GoTo does nothing because the app >>> itself does not error. >> >> Just not one you can handle after it's occurred. > > Could set a GPF hook, no? I'd hafta look it up, but I'm sure I (or > someone I was working with <g>) wrote a column about that at one point. I know you can delve into Win32 (I did allude to this earlier) to handle it but I wouldn't like to guarantee the stability of the VB runtime to do anything more then log and exit. A far easier fix is to get the crash dump and find/fix the real cause :) -- Deanna Earley (dee.earley@icode.co.uk) i-Catcher Development Team http://www.icode.co.uk/icatcher/ iCode Systems (Replies direct to my email address will be ignored. Please reply to the group.)
[toc] | [prev] | [next] | [standalone]
| From | Jim Mack <no-uce-ube@mdxi.com> |
|---|---|
| Date | 2012-12-10 12:01 -0500 |
| Message-ID | <l8-dnUF3-qziiFvNnZ2dnUVZ_qudnZ2d@giganews.com> |
| In reply to | #1643 |
> I sent my client a new exe file with the FreeLibrary call commented out
> and app does not stop working.
> So I'm sure it's that API call that's causing the problem
I don't know what the conventional wisdom is, but I doubt there's any
benefit to calling FreeLib on a common system library. Trust me: you
aren't going to unload it. (-:
--
Jim
[toc] | [prev] | [next] | [standalone]
| From | "Ivar" <ivar.ekstromer000@ntlworld.com> |
|---|---|
| Date | 2012-12-10 17:42 +0000 |
| Message-ID | <capxs.679134$YJ1.436018@fx09.am4> |
| In reply to | #1646 |
Hi Jim
>but I doubt there's any benefit to calling FreeLib on a common system
>library.
I didn't say it was a common system library (and it isn't)
>Trust me: you aren't going to unload it. (-:
Corse you can, been there, seen it, done it. There's even examples of
loading and unloading system libraries in the API guide.
It's called explicit linking.
Thanks anyway :-)
Ivar
--
Jim
[toc] | [prev] | [next] | [standalone]
| From | Jim Mack <no-uce-ube@mdxi.com> |
|---|---|
| Date | 2012-12-10 15:23 -0500 |
| Message-ID | <64SdneBsj6Is2VvNnZ2dnUVZ8n-dnZ2d@giganews.com> |
| In reply to | #1648 |
> Hi Jim
>>but I doubt there's any benefit to calling FreeLib on a common system
>> library.
> I didn't say it was a common system library (and it isn't)
>>Trust me: you aren't going to unload it. (-:
> Corse you can, been there, seen it, done it. There's even examples of
> loading and unloading system libraries in the API guide.
> It's called explicit linking.
I'm well aware of the concept, but your mention of kernel32 led me to
believe that's the lib you were invoking. I would never call
FreeLibrary on a system DLL.
--
Jim
[toc] | [prev] | [next] | [standalone]
| From | "Ivar" <ivar.ekstromer000@ntlworld.com> |
|---|---|
| Date | 2012-12-10 20:35 +0000 |
| Message-ID | <GHrxs.804343$A%.463512@fx26.am4> |
| In reply to | #1649 |
>I'm well aware of the concept, but your mention of kernel32 led me to >believe that's the lib you were invoking. I would never call FreeLibrary on >a system DLL. Hi Jim I see your point. I'm calling the FreeLibrary of Kernel32. Not Trying To Free Kernel32. It seems Kernel32 references other System Libraries, may be the error lies in a referenced library. It really seems there is no way to catch an error like this. Thanks for your replies. Ivar
[toc] | [prev] | [next] | [standalone]
| From | "Thorsten Albers" <gudea@gmx.de> |
|---|---|
| Date | 2012-12-10 20:48 +0000 |
| Message-ID | <01cdd717$c6f9c610$7a02a8c0@k8s8x> |
| In reply to | #1650 |
Ivar <ivar.ekstromer000@ntlworld.com> schrieb im Beitrag <GHrxs.804343$A%.463512@fx26.am4>... > I see your point. > I'm calling the FreeLibrary of Kernel32. Not Trying To Free Kernel32. > It seems Kernel32 references other System Libraries, may be the error lies > in a referenced library. > It really seems there is no way to catch an error like this. > Thanks for your replies. So which library is it which you want to free with FreeLibrary()? It is for 100% sure that it is not the call to FreeLibrary() itself which causes the crash. This kernel function is called thousands of times a 'usual' computer working day. If it would fail, Windows would. If your application crashes because it calls FreeLibrary() the reason for the crash must be within the library which shall be freed, or a library referenced by it. -- Thorsten Albers gudea at gmx.de
[toc] | [prev] | [next] | [standalone]
| From | Jim Mack <no-uce-ube@mdxi.com> |
|---|---|
| Date | 2012-12-10 15:51 -0500 |
| Message-ID | <OvKdnaBO8LH81lvNnZ2dnUVZ8nKdnZ2d@giganews.com> |
| In reply to | #1650 |
> I'm calling the FreeLibrary of Kernel32. Not Trying To Free Kernel32.
> It seems Kernel32 references other System Libraries, may be the error
> lies in a referenced library.
Kernel32 is already linked by the VB6 runtime. An extra LoadLib is
really doing nothing except giving you an entry point -- it does not
actually load another kernel32. So calling FreeLib is probably not
doing what you expect. As I said, I'd never do that.
Of course, sequence matters. If K32 has not yet been invoked by the VB6
RT when you do your LoadLib, calling FreeLib afterward might actually
cause harm.
--
Jim
[toc] | [prev] | [next] | [standalone]
| From | "Ivar" <ivar.ekstromer000@ntlworld.com> |
|---|---|
| Date | 2012-12-10 21:52 +0000 |
| Message-ID | <fQsxs.904505$W63.127696@fx05.am4> |
| In reply to | #1653 |
Hi Jim. Honest honest honest I am not loading or unloading K32 (or any other system file) I have a few API decs that reference some of K23s various functions, One being LoadLibrary and One Being FreeLibary. I Load a third party DLL at run time, That works just fine, I call it's functions that I need, all works well. Then my app unloads it when no longer needed. That bit seems to work flawlessly on most PCs but not all. A couple report this problem. It's seems the only solution to this prob is to leave the dll loaded One thought that I have is that the FreeLibrary is called to soon, The DLL is still doing it's thing when FreeLibrary is called. I could inset a sleep or something. But I can't test this without really annoying some people that I would prefer to keep happy. Thanks Ivar
[toc] | [prev] | [next] | [standalone]
| From | Jim Mack <no-uce-ube@mdxi.com> |
|---|---|
| Date | 2012-12-10 17:37 -0500 |
| Message-ID | <R5qdnZToBcGv-VvNnZ2dnUVZ7omdnZ2d@giganews.com> |
| In reply to | #1654 |
> Hi Jim.
>
> Honest honest honest I am not loading or unloading K32 (or any other
> system file)
> I have a few API decs that reference some of K23s various functions, One
> being LoadLibrary and One Being FreeLibary.
> I Load a third party DLL at run time, That works just fine, I call it's
> functions that I need, all works well. Then my app unloads it when no
> longer needed. That bit seems to work flawlessly on most PCs but not all.
> A couple report this problem.
Then the solution is to not call FreeLib. The DLL will be released when
your program exits, so there's usually no reason to unload.
--
Jim
[toc] | [prev] | [next] | [standalone]
| From | "Ivar" <ivar.ekstromer000@ntlworld.com> |
|---|---|
| Date | 2012-12-11 05:39 +0000 |
| Message-ID | <tGzxs.680423$9D6.552770@fx27.am4> |
| In reply to | #1655 |
>Then the solution is to not call FreeLib. The DLL will be released when >your program exits, so there's usually no reason to unload. Hi Jim I agree, but that's not the solution, that's a cop out being so the original question was about trapping the error. And there does not seem to be a way of doing that because the error is not within the app itself :-( I'm using Windows 7 Home Premium with VB6. all service packs installed. Try This: In VB6 IDE have one code window open. Highlight a small bit of text (Like 'End If') and ask VB to 'Find Next' text in the current module once only Close The Code window so that no code is showing in the IDE but the find dialog is still up. Click the 'Find Next' button again. (Yes I know it's a silly thing to do :-) My VB will always Freeze, fade out a bit and the Windows Program Error Dialog comes up. That's the kind of error being reported to me. Do you get the same results.? Just curious Ivar
[toc] | [prev] | [next] | [standalone]
| From | RW <RonW@no_domain.invalid> |
|---|---|
| Date | 2012-12-11 15:12 -0500 |
| Message-ID | <km4fc8ttfors7j3l8bm1to60sa8vi22pr9@4ax.com> |
| In reply to | #1658 |
On Tue, 11 Dec 2012 05:39:56 -0000, "Ivar" <ivar.ekstromer000@ntlworld.com> wrote: Try This: >In VB6 IDE have one code window open. >Highlight a small bit of text (Like 'End If') and ask VB to 'Find Next' text >in the current module once only >Close The Code window so that no code is showing in the IDE but the find >dialog is still up. >Click the 'Find Next' button again. (Yes I know it's a silly thing to do :-) >My VB will always Freeze, fade out a bit and the Windows Program Error >Dialog comes up. >That's the kind of error being reported to me. >Do you get the same results.? Just curious FWIW I just tried your experiment (VB6 SP6 Win7 Pro 64x). All that happened was the Find Next button became disabled (greyed out). Clicking Cancel closed the Find dialog and I was still in the IDE with the form window displaying the form, and the IDE was still running fine.
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.basic.visual.misc
csiph-web