• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

Invoke VB6 debugger programatticly

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
tfcallahan
Asked:
tfcallahan
  • 6
  • 2
  • 2
2 Solutions
 
Martin LissOlder than dirtCommented:
That's not possible.
0
 
Martin LissOlder than dirtCommented:
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
 
GrahamSkanRetiredCommented:
Use the Stop instruction

If MyCondition then
   Stop
endif
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
Martin LissOlder than dirtCommented:
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
 
Martin LissOlder than dirtCommented:
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
 
tfcallahanAuthor Commented:
Split points. Hope that's cool. Thanks!

I knew it was simple, just getting old I think :)
0
 
Martin LissOlder than dirtCommented:
That's cool and BTW I'm 70 lol.
0
 
tfcallahanAuthor Commented:
p.s. re debug.assert, even better. Wish I could give more points but saw it late... :(
0
 
Martin LissOlder than dirtCommented:
I'm happy with half.
0
 
GrahamSkanRetiredCommented:
I'm older than you MartinLiss, so I deserve more points :>)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 6
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now