Solved

Invoke VB6 debugger programatticly

Posted on 2011-09-23
10
305 Views
Last Modified: 2012-05-12
I need to pause a vb6 app in the ide run mode on a certain condition so I can get to the debugger.

E.G.

>>
If MyCondition then
   Pause and go into debug mode
endif

Used to be 2nd nature but been a while :)
0
Comment
Question by:tfcallahan
  • 6
  • 2
  • 2
10 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 36590522
That's not possible.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 36590531
Sorry, I misread your question. To be able to use the debugger you need to put a breakpoint on a line of code that gets executed. Click in the left margin of a line to set a breakpoint.
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 350 total points
ID: 36590540
Use the Stop instruction

If MyCondition then
   Stop
endif
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 46

Assisted Solution

by:Martin Liss
Martin Liss earned 150 total points
ID: 36590555
Both the Stop statement and a breakpoint do exactly the same thing, but be cautious with the Stop. If it's accidentally left in an exe it will be translated as an End and when ejected the program will end.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 36590571
You can also use the Assert statement which is ignored when compiled. Here's what MSDN has to say about Assert.


A Debug.Assert statement will never appear in a compiled application, but when you're running in the design environment it causes the application to enter break mode with the line containing the statement highlighted (assuming that the expression evaluates to False). The following example shows the Debug.Assert statement:

Debug.Assert Trim(CustName) = "John Doe"

In this case, if the CustName isn't John Doe, the application will enter break mode; otherwise the execution will continue as usual. Using Debug.Assert is similar to setting a watch with the Break When Value Is True option selected, except that it will break when the value is false.
0
 

Author Closing Comment

by:tfcallahan
ID: 36590574
Split points. Hope that's cool. Thanks!

I knew it was simple, just getting old I think :)
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 36590578
That's cool and BTW I'm 70 lol.
0
 

Author Comment

by:tfcallahan
ID: 36590579
p.s. re debug.assert, even better. Wish I could give more points but saw it late... :(
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 36590583
I'm happy with half.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 36591508
I'm older than you MartinLiss, so I deserve more points :>)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question