Spy++ hangs getting properties of a window  
Author Message
VoiceOfExperience





PostPosted: Visual C++ General, Spy++ hangs getting properties of a window Top

In trying to troubleshoot difficulty creating a toolbar, I used Spy++ to look at the attributes of the toolbar window. When I select the window from the list in Spy++ and right-click it, select Properties, Spy++ hangs indefinitely.

The toolbar is being created by the following code, in a class derived from CFrameWnd. CFitToolBar is dervied from CToolBar:

pFitToolBar=new CFitToolBar;

pFitToolBar->Create(this);

pFitToolBar->LoadToolBar(IDR_FitToolBar);

pFitToolBar->ShowWindow(SW_SHOW);

The result of this code is nothing, although both Create and LoadToolBar return 1 (success). IDR_FitToolBar is a toolbar resource created by the toolbar editor (i e, a set of images for the buttons).

Q1) How to use Spy++ (i e, get around the bug).

Q2) How to create a toolbar which is visible and shows its buttons.



Visual C++3  
 
 
Bite Qiu - MSFT





PostPosted: Visual C++ General, Spy++ hangs getting properties of a window Top

hi, VoiceofExperience

For Q1: you can use either "F1" in spy++ to open the help file or refer to following link:

http://msdn.microsoft.com/library/default.asp url=/library/en-us/vcug98/html/_asug_starting_spy.2b2b.asp

For Q2: Use CToolBar::Create() method to create a toolbar, try to make "pFitToolBar" a class member rather than a local variable even you are using "new" operator. More information, please refer to:

http://msdn2.microsoft.com/en-gb/library/c512846k(VS.80).aspx

Thanks

Bite



 
 
VoiceOfExperience





PostPosted: Visual C++ General, Spy++ hangs getting properties of a window Top

Spy++ has a BUG. The help files do not describe the behavior of the bug, for obvious reasons.

Further investigation with a 3d-party equivalent to Spy++ found that the toolbar window was 0 size.

The pFitToolBar was a class member. The difficulty there seems to be that the toolbar window must be resized to be non-0, despite what the docs say about creating it at a default size.