 |
|
|
|
| Author |
Message |
MM
Joined: 04 Oct 2007 Posts: 319
|
Posted: Tue Feb 26, 2008 8:15 pm Post subject: VB6: Show value tip (in break mode) in hex by default? |
|
|
How could I display the value of a numeric variable in the immediate
window in break mode and have it shown in hexadecimal? It's a PIT to
have to keep typing Hex( ) around a var all the time.
Another question: Whenever I do a search I mainly want to search
throughout the project, but the default is always Current Module. Is
there a value in the registry that I can change to make the default
Current Project?
Maybe an add-in could achieve these? In the first case the value tip
must be shown in a window, presumably with an hwnd? Or is it perhaps
just a label with no hwnd?
The second one could be easier. One watches for the Find dialogue to
be displayed, then jumps in and sets the third option button.
MM
Archived from group: microsoft>public>vb>general>discussion |
|
| Back to top |
|
 |
Ken Halter
Joined: 04 Oct 2007 Posts: 4150
|
Posted: Tue Feb 26, 2008 1:24 pm Post subject: Re: Show value tip (in break mode) in hex by default? |
|
|
"MM" wrote in message @4ax.com...
> How could I display the value of a numeric variable in the immediate
> window in break mode and have it shown in hexadecimal? It's a PIT to
> have to keep typing Hex( ) around a var all the time.
The easiest way would be to convert it to hex before it gets to the
immediate window.
'============
Option Explicit
Private Sub Command1_Click()
Dim d As Double
Dim l As Long
d = Rnd * Timer
l = Rnd * d
Call ShowHexData(d, l)
d = Rnd * Timer
Call ShowHexData(d, l)
End Sub
'Drop something like this in a module and call it any time you want.
Public Sub ShowHexData(ParamArray HexData())
Dim l As Long
For l = LBound(HexData) To UBound(HexData)
Debug.Print "Dec:"; HexData(l), "Hex:"; Right$("0000000" _
& Hex$(HexData(l)), & "h"
Next
End Sub
'============
> Another question: Whenever I do a search I mainly want to search
> throughout the project, but the default is always Current Module. Is
> there a value in the registry that I can change to make the default
> Current Project?
I've never noticed .. I use CodeSMARTs search functionality almost
exclusively.
The image shown is the immediate window... note the tabs. 2 of those tabs
are for search results.
http://www.axtools.com/products/cs2k3vb_screenshots.htm#T3-1
--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm |
|
| Back to top |
|
 |
MikeD
Joined: 04 Oct 2007 Posts: 3348
|
Posted: Tue Feb 26, 2008 4:32 pm Post subject: Re: Show value tip (in break mode) in hex by default? |
|
|
"MM" wrote in message @4ax.com...
> How could I display the value of a numeric variable in the immediate
> window in break mode and have it shown in hexadecimal? It's a PIT to
> have to keep typing Hex( ) around a var all the time.
No way that I am aware of. One thing you could do is create a watch expression, though.
>
> Another question: Whenever I do a search I mainly want to search
> throughout the project, but the default is always Current Module. Is
> there a value in the registry that I can change to make the default
> Current Project?
Again, nothing I'm personally aware of.
>
> Maybe an add-in could achieve these?
MZ Tools has a Find feature that you may like better than VB's own. It defaults to "project group" scope and can optionally exclude
comments from being searched. Downside (IMO) is that it brings up a window with the find results rather than taking you directly to
the found text in a code window.
Download MZ Tools here: http://mztools.com/index.aspx
Personally, however, I think you're being a tad trivial here. It's not anything major to change the scope on VB's Find dialog box.
--
Mike
Microsoft Visual Basic MVP |
|
| Back to top |
|
 |
Ken Halter
Joined: 04 Oct 2007 Posts: 4150
|
Posted: Tue Feb 26, 2008 1:42 pm Post subject: Re: Show value tip (in break mode) in hex by default? |
|
|
"MikeD" wrote in message
news:%23VionUJeIHA.5856@TK2MSFTNGP05.phx.gbl...
>
>
> MZ Tools has a Find feature that you may like better than VB's own. It
> defaults to "project group" scope and can optionally exclude comments from
> being searched. Downside (IMO) is that it brings up a window with the find
> results rather than taking you directly to the found text in a code
> window.
I've been spoiled by CodeSMARTs find features. It can optionally skip
strings, comments, whatever too and the default scope = the same you used
last time (per window, there are 2). When the results are shown in their
tabs (inside the immediate window), double-clicking that "result" takes you
directly to the code.... wonderful feature
--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm |
|
| Back to top |
|
 |
Larry Serflaten
Joined: 04 Oct 2007 Posts: 2644
|
Posted: Tue Feb 26, 2008 7:54 pm Post subject: Re: Show value tip (in break mode) in hex by default? |
|
|
"MM" wrote
> How could I display the value of a numeric variable in the immediate
> window in break mode and have it shown in hexadecimal? It's a PIT to
> have to keep typing Hex( ) around a var all the time.
Do the first one by hand such that you have a line in the Immediate
window:
? Hex(MyVar)
From then on, (while in Break mode) double click the variable you
want to examine (to highlight it) hit Ctrl+C or otherwise copy that text,
then double click the variable in the Immediate window (to highlight it)
and hit Ctrl+V or otherwise paste the name there. When you hit Enter
the value shows up on the following line.
If you do it all by the mouse, you double-click and then right click
the beginning of the variable you want, then select Copy from the menu
and double-click plus right-click the variable in the Immediate window,
selecting Paste. After that you have to hit Enter to see the result.
OR, as others have pointed out, include a routine in your code to print
the Hex result:
Sub xx(ByVal Value As Long)
Debug.Print Hex(Value)
End Sub
Then, "xx MyVar" is all you type...
> Another question: Whenever I do a search I mainly want to search
> throughout the project, but the default is always Current Module. Is
> there a value in the registry that I can change to make the default
> Current Project?
If you use Ctl+F to show the Find dialog, get used to adding Alt+CF
to that squence... (Ctl+F Alt+CF)
No biggie...
LFS |
|
| Back to top |
|
 |
Bob O`Bob
Joined: 04 Oct 2007 Posts: 1456
|
Posted: Tue Feb 26, 2008 6:58 pm Post subject: Re: VB6: Show value tip (in break mode) in hex by default? |
|
|
MM wrote:
> How could I display the value of a numeric variable in the immediate
> window in break mode and have it shown in hexadecimal? It's a PIT to
> have to keep typing Hex( ) around a var all the time.
As already mentioned, you can put functions in a watch expression, so
that instead of just "l" you have a watch on "Hex(l)"
Perhaps you'd like putting debugging calls into Debug.Assert statements
so that they won't exist in a compiled version:
Option Explicit
Private Sub Text1_Change()
'example code
Dim l As Long, s As String
l = Val(Text1.Text)
'maybe we've done some calcs...
'now while stepping through code
'we want to easily observe l, BUT in hex
Debug.Assert True Or HoverHex(l, s)
Debug.Assert 0
End Sub
Public Function HoverHex(l As Long, s As String) As Boolean
s = Hex(l)
End Function
It takes an extra function and an extra string variable, but while
stepping through now, you can hover over the "s" in the Assert and
see what the hex value was when the helper function was called.
I've seen stuff like that used effectively, though personally,
I believe I'd just use the watch window. Debugging styles vary.
> Another question: Whenever I do a search I mainly want to search
> throughout the project, but the default is always Current Module. Is
> there a value in the registry that I can change to make the default
> Current Project?
I have abandoned the built in search in favor of MZTools.
Built in search can be especially bad on multimonitor setups,
as the dialog can make really stupid decisions about where to
display itself, especially if any of your screens have portions
with coordinates in the negative.
Bob
-- |
|
| Back to top |
|
 |
MikeD
Joined: 04 Oct 2007 Posts: 3348
|
Posted: Tue Feb 26, 2008 11:35 pm Post subject: Re: Show value tip (in break mode) in hex by default? |
|
|
"Ken Halter" wrote in message @TK2MSFTNGP06.phx.gbl...
> "MikeD" wrote in message
> news:%23VionUJeIHA.5856@TK2MSFTNGP05.phx.gbl...
>>
>>
>> MZ Tools has a Find feature that you may like better than VB's own. It
>> defaults to "project group" scope and can optionally exclude comments
>> from being searched. Downside (IMO) is that it brings up a window with
>> the find results rather than taking you directly to the found text in a
>> code window.
>
> I've been spoiled by CodeSMARTs find features. It can optionally skip
> strings, comments, whatever too and the default scope = the same you used
> last time (per window, there are 2). When the results are shown in their
> tabs (inside the immediate window), double-clicking that "result" takes
> you directly to the code.... wonderful feature
Double-clicking the find result in MZTools takes you to the code too...but I
don't think that's as easy or convenient as just pressing F3 to do a Find
Next.
--
Mike
Microsoft MVP Visual Basic |
|
| Back to top |
|
 |
MM
Joined: 04 Oct 2007 Posts: 319
|
Posted: Wed Feb 27, 2008 1:26 pm Post subject: Re: Show value tip (in break mode) in hex by default? |
|
|
On Tue, 26 Feb 2008 14:54:43 -0600, "Larry Serflaten"
wrote:
>
>"MM" wrote
>> How could I display the value of a numeric variable in the immediate
>> window in break mode and have it shown in hexadecimal? It's a PIT to
>> have to keep typing Hex( ) around a var all the time.
>
>
>Do the first one by hand such that you have a line in the Immediate
>window:
>
>? Hex(MyVar)
That's what I do. But I would much prefer the value to be shown in hex
directly, as soon as I hover the mouse pointer over the variable.
Something in the bowels of VB must be retrieving the value from the
variable in order to display it. If one could break into that chain,
one could convert the value on the fly to hex, octal, whatever.
>
>From then on, (while in Break mode) double click the variable you
>want to examine (to highlight it) hit Ctrl+C or otherwise copy that text,
>then double click the variable in the Immediate window (to highlight it)
>and hit Ctrl+V or otherwise paste the name there. When you hit Enter
>the value shows up on the following line.
That is all too cumbersome for my liking!
>If you do it all by the mouse, you double-click and then right click
>the beginning of the variable you want, then select Copy from the menu
>and double-click plus right-click the variable in the Immediate window,
>selecting Paste. After that you have to hit Enter to see the result.
Again, hardly a quick review of what a variable contains.
>
>OR, as others have pointed out, include a routine in your code to print
>the Hex result:
>
>Sub xx(ByVal Value As Long)
> Debug.Print Hex(Value)
>End Sub
>
>Then, "xx MyVar" is all you type...
>
>
>> Another question: Whenever I do a search I mainly want to search
>> throughout the project, but the default is always Current Module. Is
>> there a value in the registry that I can change to make the default
>> Current Project?
>
>If you use Ctl+F to show the Find dialog, get used to adding Alt+CF
>to that squence... (Ctl+F Alt+CF)
Well, yeeeessss.. that is admittedly something I didn't try yet, even
thought the accelerator key is staring me in the face! Still, I've
just tried it, and it's awkward. I'll see what I think after today's
session.
MM |
|
| Back to top |
|
 |
Ken Halter
Joined: 04 Oct 2007 Posts: 4150
|
Posted: Wed Feb 27, 2008 1:23 pm Post subject: Re: Show value tip (in break mode) in hex by default? |
|
|
"MM" wrote in message @4ax.com...
>
> Again, hardly a quick review of what a variable contains.
>
Actually a review of what the variable contains will show a numeric
value. Hex is a string, so what you're really asking for is to have VB show
a "converted review of what a variable contains"
> variable in order to display it. If one could break into that chain,
> one could convert the value on the fly to hex, octal, whatever.
(showing age here) breaking into that chain was easy back in the DOS days.
All you needed was a debugger... when you found the bits you were looking
for, just Poke different bits there and the code'll take off in an entirely
new direction.... ahhhh... the good ol' days.
--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm |
|
| Back to top |
|
 |
Lorin
Joined: 04 Oct 2007 Posts: 312
|
Posted: Wed Feb 27, 2008 5:02 pm Post subject: RE: VB6: Show value tip (in break mode) in hex by default? |
|
|
I have been using this find addin.
It will park.
It shows all matches.
Also can be used to "fix" code.
Only a few complaints for 'fix'.
Very verbose comments inserted and not easy to remove.
Errors a legal use of a reserved word, like 'next' in a type def.
Does crash on rare occasions.
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=59247&lngWId=1
Help File is here
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=59248&lngWId=1
"MM" wrote:
> How could I display the value of a numeric variable in the immediate
> window in break mode and have it shown in hexadecimal? It's a PIT to
> have to keep typing Hex( ) around a var all the time.
>
> Another question: Whenever I do a search I mainly want to search
> throughout the project, but the default is always Current Module. Is
> there a value in the registry that I can change to make the default
> Current Project?
>
> Maybe an add-in could achieve these? In the first case the value tip
> must be shown in a window, presumably with an hwnd? Or is it perhaps
> just a label with no hwnd?
>
> The second one could be easier. One watches for the Find dialogue to
> be displayed, then jumps in and sets the third option button.
>
> MM
> |
|
| Back to top |
|
 |
MM
Joined: 04 Oct 2007 Posts: 319
|
Posted: Thu Feb 28, 2008 1:34 am Post subject: Re: VB6: Show value tip (in break mode) in hex by default? |
|
|
On Wed, 27 Feb 2008 12:02:04 -0800, Lorin
wrote:
>I have been using this find addin.
>It will park.
>It shows all matches.
>Also can be used to "fix" code.
>Only a few complaints for 'fix'.
> Very verbose comments inserted and not easy to remove.
> Errors a legal use of a reserved word, like 'next' in a type def.
> Does crash on rare occasions.
>
>
>http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=59247&lngWId=1
>Help File is here
>http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=59248&lngWId=1
Interesting. I'll definitely take a look, thanks.
MM |
|
| Back to top |
|
 |
MM
Joined: 04 Oct 2007 Posts: 319
|
Posted: Thu Feb 28, 2008 1:41 am Post subject: Re: Show value tip (in break mode) in hex by default? |
|
|
On Wed, 27 Feb 2008 08:23:54 -0800, "Ken Halter"
wrote:
>"MM" wrote in message
>@4ax.com...
>>
>> Again, hardly a quick review of what a variable contains.
>>
>
>Actually a review of what the variable contains will show a numeric
>value. Hex is a string, so what you're really asking for is to have VB show
>a "converted review of what a variable contains"
That's right. MIDI programming books and code tend to refer to the
various bytes in a MIDI message in hex, not decimal.
>
>> variable in order to display it. If one could break into that chain,
>> one could convert the value on the fly to hex, octal, whatever.
>
>(showing age here) breaking into that chain was easy back in the DOS days.
>All you needed was a debugger... when you found the bits you were looking
>for, just Poke different bits there and the code'll take off in an entirely
>new direction.... ahhhh... the good ol' days.
Well, I might try poking about a bit with an hwnd detector. However, I
reckon it's a label, not a window. I note that VB.Fred has a
"hexademical display" option for the "debugger tooltip". (I've just
gleaned that from Google/MSDN.)
MM |
|
| Back to top |
|
 |
Karl E. Peterson
Joined: 04 Oct 2007 Posts: 4836
|
Posted: Wed Feb 27, 2008 7:49 pm Post subject: Re: Show value tip (in break mode) in hex by default? |
|
|
Ken Halter wrote:
> "MM" wrote ...
>>
>> Again, hardly a quick review of what a variable contains.
>
> Actually a review of what the variable contains will show a numeric
> value. Hex is a string, so what you're really asking for is to have VB show
> a "converted review of what a variable contains"
Actually , to really twist it, what we consider a numeric, VB considers a string!
--
..NET: It's About Trust!
http://vfred.mvps.org
|
|
| Back to top |
|
 |
|
|
| Related Topics: | How to break If statement Dear all, I have if Statement as follows. IF a < B Then if C < D then break if Statement A Statement B Statement C End IF What I want is when C Why VB Break or Skip Dear all, I have two SQL statement in a the program. If it runs normally, both should be executed. But I have found in some case the second statement is not executed. It is so confused. It seems that VB has break or Skip some code. What happened and how c
break statement equivalent in VB? Need to quickly write a test app in VB, and this involves porting some C++ code to VB6. I can't seem to find an equivalent of the break statement - specifically, to allow me to break out of a WHILE loop (without having to resort to 'goto' etc) - whats the
VB break point does not work?? I run Access 2003 form and put break point on VB code (VB6.3). Some home the program skips break points. It happens with all the VB modules. Any idea is appreciated. Thanks, Henry
conditional break on error? Hi Beginner question here: I'm trying to debug a program trying to figure best way to handle different kinds of errors some just need to report they occurred then take some kind of restorative action others I want to stop dead in tracks and see whats goi |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|