PB WinSpy++++
The ultimate RAD (Rapid Application Development) tool for PB/DLL, PB/WIN.

Visual designer fans - eat your hearts out, because here is a program that can
make PB coding fly in circles around all other languages when it comes to rapid
dialog and control design. And best of all - it's freeware..

PURPOSE
To provide PowerBASIC programmers with a quick way to design dialogs and
controls via automatic DDT or SDK-style code generation for existing dialogs and
controls, and/or via a set of provided templates.

WHAT DO YOU WANT TO STEAL TODAY..
Simply click in top-left yellow area, hold down mouse button, drag/move the
mouse to the control or dialog you wish to copy and release the button over it.
The program will look at the underlying window, grab styles and positions, etc,
and generate the code needed to create a duplicate.

WHAT DO YOU WANT TO LEARN TODAY..
PBWinSpy can also be used as a good learning tool in that it can reveal many
"secrets" behind things in dialogs or controls, and give hints on how others
have done this or that. MS dialogs are always interesting to investigate, for
example. :)

TEMPLATES
Template code for a main dialog, a pop-up child dialog, a DLL file, a Resource
file with version info and all standard DDT controls are provided. Just select
from the ComboBox in upper right corner and code to create selected object will
be generated in the viewer. Then just copy and paste this code into PBEdit, or
any other code editor. Code generation can be set to DDT or SDK -style in the
Options dialog.

Main dialog template is complete with WndProc procedure and a couple of buttons.
Pop-up dialog template is also complete with a PopupDlgProc and a button, so put
together, these two can be used for direct compile of a complete program with
pop-up dialog! Just add "ShowPopupDialog hWnd" to %IDOK in WndProc and off you go..

SETTINGS
An Options dialog provides different ways to alter code generation. All
settings, including position on screen, are stored between sessions.

* Enumerate children: As it sounds, all eventual child windows will be
  enumerated and included in code generation.

* Generate full code: Adds complete WinMain and WndProc/DlgProc to result. If a
  dialog was the target, this often means resulting code can be used directly to
  compile a perfect copy of the dialog, complete with controls, eventual menus and
  all, depending on following three settings:

* Group ID equates at top: The program will generate suitable ID equates for all
  found controls, with exact ID values taken from the original. By default, these
  equates will be placed together in declares section at top, but if you uncheck
  here, ID's will be placed right above creation code.

* Grab eventual menu: If checked and target is a dialog with a menu, code to
  create an exact copy of this menu will be generated.

* Grab eventual colors. If checked and a dialog or control is painted via a
  WM_CTLCOLOR.. message, this will be included in generated code. Only
  SysColorBrush backgrounds are supported, but text and text background colors
  are fully covered via RGB() function.

* DDT/SDK-style code: Enables you to select resulting code style. This also
  affects template code generation.

* Program always on top: Default is on, so the program stays floating on top of
  all other programs. Off, means "normal" zorder behavior.

LOG
version 1.17
* Added DLL and Resource file templates.
* Added icons to buttons.
* Compiled with updated EDM32 code viewer, with better wheel scroll support, etc.
* Changed handles to DWORD instead of LONG in generated code.
* Changed Info dialog to show RTF formatted text.
version 1.16
* Made corrections to import table for VB6 dialogs and controls.
* Added distribution "policy" (totally free) to documentation.

GETTING STARTED
First test - click once in left-top yellow area and look at result in the
viewer. Code to create an exact copy, complete with positions, size, styles and
id will be generated. Next to the yellow "click-down" area, a read-only textbox
will provide information about underlying windows if the mouse is moved with
button held down.

Repeat test, but keep mouse button down and drag mouse to another control.
Release button and look at generated code. Repeat test and release the mouse
button over the desktop - it reveals that the desktop is nothing but a simple
ListView control. So WinSpy can also be used as a good learning tool - it can be
very interesting to explore MS dialogs, for example..

Or why not make your own, perfect copy of PBWinSpy? Open up the Options dialog
and make sure Enumerate children, Generate full code and Grab eventual colors
are checked, click Ok to store settings and close the dialog, then click in the
yellow area, drag & release mouse button over PBWinSpy's caption. Copy the
resulting code, paste it into PBEdit or whatever code editor you use, compile
and voila - you have just built a complete interface for "your own" version of
WinSpy. Now all it needs is a couple of hundred KB's of code and lookup tables.. :)

Ok, time for final test. Make sure Enumerate children, Generate full code and
Grab eventual menu are checked in Options dialog, start up NotePad and release
mouse button over its menu. Copy the result (use right-click menu or press
Ctrl+A to select and Ctrl+C to copy), start up PBEDIT, paste and compile to get
a perfect copy of NotePad. Instant software - here enabling you to do your own
customized version of NotePad in no time at all!

Working code will of course have to be added, but at least design is ready in
just a couple of seconds. You will have to check resulting code carefully,
because not even the best Spy program can reveal all secrets, since some styles
are dynamic and may change as a control gets focus, or new contents, etc.

COMMENTS
There is a one-level deep recursive enumeration of Tab controls, but the results
may become uncertain and only code for creating the dialogs and controls will be
produced. Menus are scanned down to one submenu level's dept. Use the program
with intelligence, and it can become a time saver without compare.

The program is prepared for doing rough translation of running VB and Delphi
standard controls and dialogs. In some cases it works fine, in some it don't,
because visual designers often like to place controls inside containers, use
custom classes, or not even provide a handle to the control in question (like VB
labels). It can still always be of some help in converting slow and bloated VB
or Delphi app's into lean, mean PB versions, though..

DISTRIBUTION
PB WinSpy++++ is Freeware, free to use and distribute in any possible way.


Borje Hagsten
