Solved

Invoke VB6 debugger programatticly

Posted on 2011-09-23
10
310 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
  • 2
10 Comments
 
LVL 47

Expert Comment

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

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

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 47

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 47

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 47

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

705 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