Solved

CTRL+Break does not stop code on message box in VB6

Posted on 2009-07-08
10
1,002 Views
Last Modified: 2012-05-07
I've been programming in VB6 for years...but I switched to a Latitude D620 laptop. Now for some reason when I'm programming in the VB6 IDE, have a message box appear, then press CTRL+BREAK on my keyboard, the message box disappears but the code does not break in VB6 like it used to.

I tried the Microsoft on-screen keyboard (command line = 'osk'), but it had the same affect.

HELP!!!
0
Comment
Question by:bitoboy
  • 5
  • 4
10 Comments
 
LVL 5

Expert Comment

by:BrianVSoft
ID: 24813194
VB has never handled stepping and 'Ctrl+Break' well when a modal was involved..
(and Message box modals are one of the worst offenders)
Over 10 years and many PCs, I have seen dozens of truly weird situations.
I don't think there is anything particular about the DELL D620 model, it is more likely specific to your machine. I don't think there is a "solution" to your problem..
It might help to mention what OS you are running.. (Vista and VB6 don't get along too well)
0
 
LVL 11

Accepted Solution

by:
Antagony1960 earned 500 total points
ID: 24813458
I noticed the exact same problem when I updated my old laptop to XP (from W2K) so I think it's probably OS related. I've since run VB6 successfully on several XP and Vista machines and none of them operated a break properly from modal objects.

To get around this problem I created a global constant (bcStopsEnabled), which I set to True when I might need the break. Then I put conditional stops after critical message boxes etc. (If bcStopsEnabled Then Stop). In some larger apps I also have a function which returns True if the app is running in the IDE and I use that to set a global variable (bIDERun) which can be added to the condition to ensure that stops will not be encountered in the compiled app. (If bcStopsEnabled And bIDERun Then Stop). Let me know if you want the function, bitoboy. It's only small but it uses a couple of API functions.
0
 

Author Comment

by:bitoboy
ID: 24814329
I forgot to mention the OS I am using is windows XP Pro SP2.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:bitoboy
ID: 24815430
Also, I have not changed OS's...been using XP Pro the whole time...it seems like there must be an explanation why this particular computer with it's software is causing the problem.
0
 
LVL 11

Expert Comment

by:Antagony1960
ID: 24825249
bitoboy, I think it could be something to do with keyboard configuration. After playing around with the on-screen-keyboard (Start|Run|osk), I've discovered that Ctrl+Shift+Break breaks to the IDE as you'd like but Ctrl+Break just closed the message box and continues execution. Although I only have a Vista PC to try it on at the moment as I've left my old XP laptop back at the office.
0
 

Author Comment

by:bitoboy
ID: 24825313
Sadly, CTRL+SHIFT+Break doesn't work, either with the keyboard or OSK. Thx.
0
 
LVL 11

Expert Comment

by:Antagony1960
ID: 24825737
Hmm... I don't know what else to suggest then. I've played around with it a bit more on my Vista PC and it seems to be completely erratic as to what action will occur after Ctrl+Break closes a message box. This seems to indicate a timing issue and leads me to wonder whether there is a compatibility problem between the VB6 IDE, modern keyboard hardware and/or the modern OS handling thereof.

A quick Google search has revealed that this problem has been around for years and no easy solution is available... sorry.
0
 

Author Comment

by:bitoboy
ID: 24825784
Well bugger...OK I guess I have to give up and get clever with the breaks and stops.
0
 
LVL 11

Expert Comment

by:Antagony1960
ID: 24825836
Thanks for the points and the grade. I just wish I could have offered you a definitive solution.
0
 

Author Comment

by:bitoboy
ID: 24825900
That's what I get for using a 10 year old programming environment!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

777 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