Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2010 > BOOK: Visual Basic 2010 Programmer's Reference
|
BOOK: Visual Basic 2010 Programmer's Reference
This is the forum to discuss the Wrox book Visual Basic 2010 Programmer's Reference by Rod Stephens; ISBN: 9780470499832
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2010 Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2010, 03:48 AM
Registered User
 
Join Date: Jun 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Viewing user window while paused at breakpoint

Rod (or someone), when the VB.net code stops at a breakpoint, the user window disappears and the debug window displays. What is the short-cut key to view the user window without resuming code execution?

Am at p. 156, and example program ChangeFormFont motivated this question.
 
Old June 10th, 2010, 09:16 AM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

I'm not sure I understand. By "user window" do you mean the form that the program displays to the user?

Unfortunately a VB program can't update the form while it is paused in the debugger because it cannot execute to process Window events. You can use the Task Manager or Alt-Tab to switch to that window but you'll only see a blank area.

Of am I missing the question entirely?
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
 
Old June 10th, 2010, 10:19 PM
Registered User
 
Join Date: Jun 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, thank you, Rod. You have understood the question.

When the VB code "breaks", I need to see what the end-user sees on the application's screen. It seems that VS2010 does not support this.

Here is my workaround. Every second a Timer routine calls this routine to copy the screen to the clipboard, and then save it to disk:
Public Sub clip()
SendKeys.Send("{PRTSC}")
Dim grabpicture As System.Drawing.Image
grabpicture = My.Computer.Clipboard.GetImage()
grabpicture.Save("c:\clipboard.bmp")
End Sub

Then, after the "break", type this in the Immediate window to display the screen:
Process.Start("C:\clipboard.bmp")

Instead of the Timer routine, do you think it would be possible to write a VS2010 add-in which intercepted the breakpoint interrupt and ran the clip() subroutine before leaving the user's screen? It would then hand back to the usual break-point routine.

BTW, have now reached p. 265 (but am skipping WPF this time around).
 
Old June 11th, 2010, 04:52 PM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default Clever workaround

That's a pretty clever workaround. I may have to steal it for an example ;-)

I don't know if you can do that (reasonably) in an add-in. I haven't done much with Visual Studio add-ins but there's a DebuggerEvents object that raises an OnEnterBreakMode event when you enter break mode. Unfortunately it seems to wait until the form is no longer visible so if I try to grab an image then I get an image of the IDE.

I've attached my test add-in project.

Let me know if you find a solution.
Attached Files
File Type: zip GetFormImageOnBreak.zip (14.5 KB, 6 views)
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
 
Old June 11th, 2010, 05:19 PM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default Another approach

Another approach would be to make a macro to grab the form. Then set the breakpoint's When Hit action to run the macro.

Unfortunately I can't seem to get the macro to copy an image to the clipboard. For some reason the clipboard always stays empty.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
 
Old June 14th, 2010, 07:51 AM
Registered User
 
Join Date: Jun 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for investigating this, Rod. No doubt someone will discover the "obvious" answer





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get the IP address of the user viewing site crmpicco Perl 2 April 30th, 2007 06:51 AM
The breakpoint is not been Hit uchkid Pro Visual Basic 2005 1 August 29th, 2006 10:52 AM
Breakpoint not hit - "No symbols loaded for page" organicglenn BOOK: ASP.NET Website Programming Problem-Design-Solution 15 August 1st, 2006 06:08 PM
Cant hit a breakpoint in report open event badgolfer Access 1 July 4th, 2004 11:08 PM
Breakpoint Error Msg Louisa VB.NET 2002/2003 Basics 1 March 29th, 2004 06:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.