Solved

Invoke VB6 debugger programatticly

Posted on 2011-09-23
10
302 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now