home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
code
/
design
/
3ddemo
/
readme.txt
< prev
Wrap
Text File
|
1995-02-26
|
8KB
|
181 lines
CTL3D Demo
This demo shows how one can create 3D Dialogs in Visual Basic
using CTL3D.DLL. It shows a method for subclassing controls
for 3D effects. It also has a routine that if the version of
CTL3D.DLL is not at least 2.63, then it will use a Visual Basic
routine called FormIn3D that paints the controls as 3D. Here
are a list of the procedures that are included in this demo:
App3DRegister - the only function. It returns whether or not
the application could be registered with
CTL3D. If it is, it extracts the Version of
CTL3D for determining if the controls can be
subclassed for 3D effects. Call this procedure
from anywhere once you start your application to
use CTL3D.
Returns True is successful otherwise 0
App3DUnregister Call this procedure to unregister your
application from CTL3D before you end.
ComboBoxIn3D - This procedure is called by the FormIn3D
procedure to paint a Combo Box in 3D that
can't be subclassed.
ControlIn3D - This procedure is called by the FormIn3D
procedure to paint a control in 3D that is
not a special case and cannot be subclassed.
DlgSysMenu - Sets the Form's system menu to display only
the Move and Close options. Make sure that
if you set the ControlBox property to True,
that you set the MinButton and MaxButton
properties to false.
FormIn3D - This procedure is called by the Form_Paint
event and is activated by the setting of the
gSubClassCtls variable. Add this line to
the Form_Paint Event:
If Not gSubClassCtls Then FormIn3D Me, 1
It will make sure that your forms controls
get a 3D appearance.
FormToDialog - This sets the forms attributes to a dialog
box that CTL3D looks at to see if it needs to
paint the form as 3D.
LineIn3D - This procedure is the same as ComboIn3D for
lines drawn on the form in the VB design mode.
Make3DDlg - This procedure is called in the Form_Load
event of the form you want to have look like
a 3D Dialog.
MakeDlgCtrls3D - SubClasses all the controls on the form so
that they will appear 3D.
Reg3DCtrl- Called by MakeDlgCtrls3D for each control.
You can use it too for individual controls
not on dialog forms to give your application's
other controls 3D Appearance.
Undo3DCtrls - Unsubclasses the 3D controls on the form.
Called from the Form_Unload event.
UnReg3DCtrl - UnSubclasses the control specficied.
How to use this in you application:
All you have to do is add the CTL3D.BAS file into your project
and call the appropriate procedures in a specified procedure, if
mentioned (i.e. Form_Load procedure). Then go to it!
*** Problems, quirks, and unusual things... ***
1) I would recommend highly that when you create an
application using CTL3D.DLL that you include this file as you
get close to the end of debugging your product. If you get a
crash or an error during debugging and do not properly
unregister from CTL3D.DLL, you will get a GPF that may
take down your computer. I know.. I have gotten QUITE A FEW,
making this work. It works really well for me. If you do want
to include it in the start, then just add the appropriate lines
and then comment them out until the very end. The logic in
this code works well but can't guarantee it.
2) I would highly recommend that if you want 3D controls in your
dialog boxes and forms to appear correctly, then use whatever
you can from THREED.VBX control. It is easier and more
reliable than using CTL3D.DLL for some controls. The
OptionButton control does not subclass very well and has a
problem visually in that the control does not appear as it
should.
3) There is a DLL called CTL3DV2.DLL which works with this just
as well. I tested this with several CTL3D.DLL's I have found
from various installation disks and this seems to work well.
The CTL3DV2.DLL also works. The version checking algorithm
that I use in this algorithm for some reason seems to report
funny numbers. Not sure why but it works! And is able to
distinguish which versions have the correct call for
subclassing controls.
4) You may get an error if you use attempt to register a
control that does not have an .hWnd property. If you have a
form that you want controls to be in 3D, use the MakeDlgCtls3D
procedure in the Form_Load event, even if the form is not
supposed to be a dialog. If the controls can't be subclassed,
then use the FormIn3D procedure and modify the controls to
appear 3D.
5) If you cannot subclass controls and the form is
sizeable, then you will have a problem using the FormIn3D
because when a paint event happens, the form does not erase the
previously drawn lines. You can use a Cls method in the
FormIn3D but the form appears a little jittery, especially on
slower machines, when it tries to make the controls look 3D.
I believe this procedure was written originally for dialog
boxes but works well with any form.
6) I did not include a Common Dialog example, but it does work
and works very well. This is just incase someone doesn't have
the CMDIALOG.VBX. I suppose I could have used an API call but
I am lazy! That's why I use VBX's!
** OTHER STUFF **
I developed this as a means to write my setup programs with
snazzy appearance. The 3D dialogs in setup programs look very
professional. This should help you all in making good looking
SETUP programs!
This product is the result of research into several areas
consisting of DPM Solutions VB Tips and Tricks, MSDN
Development Libraries, CompuServe's MS Basic Forum and other
places. After numerous GPF Faults and other problems, I
finally think this is it. There are lots of code I
borrowed and some of my own. If a particular person wrote the
procedure, their name is in the commented portions of the
procedure. I think they deserve as much credit.
*****************************************************************
A message about ShareWare and Third Party Products:
There are a number of WONDERFUL controls that you can use to
essentially create 3D effects on forms and controls that are a
HECK of a lot easier to use than this. My primary reason for
developing this was to use it for my colorfully creative SETUP
programs so I didn't have to use controls for it. I have a few
controls that I purchased from shareware vendors and I use them
religiously for my apps. They are much safer than these
procedures and have some capabilities that can't be added by
this file. If you have some of their controls now, USE THEM
instead of this. It's easier and more effective. I would
rather not use VBX's at all if I could help it but in this
world where professional products means money for the developer
and better name recognition, the members of the ASP and those
who aren't but produce quality products have made a commitment
and have a reputation for delivery EXCELLENT products with
OUTSTANDING support for GREAT prices! I highly encourage
people to use their products. Please support the members of
the ASP and anyone else who delivers products in this way.
*****************************************************************
If you have any suggestions or fixes, please let me know. Feel free to
distribute this at your leisure.
Its FREE!
Have Fun and Enjoy!
M. John Rodriguez CIS ID: 100321,602
Internet: jrodrigu@cpd.hqusareur.army.mil
100321.620@compuserve.com