Hello All,

Heres the COM Wizard. You can make objects with properties and methods but not events yet. The wizard doesnt generate HTAs yet as well.

Double-Click "COM Object Wizard.hta" to run the wizard.

25 Downloads, no comments?
Posted on 2002-12-04 23:27:42 by Xtreme
very nice ideea for a wizard ... groovy about box :alright:
now i must understand this stuph :tongue:

maybe in the future an example would be great ... step by step
Posted on 2002-12-05 00:58:19 by TBD
Keep in mind that this is only version 1.0 beta. I'll add a lot more features and documentation for the wizard as time passes.

For now, lets start with a simple tutorial and create the "HelloWorld Object". The HelloWorld object will have 1 property, named "SomeNumber" and 1 method named "HelloWorld".

    [*]Launch the Wizard by clicking the "COM Object Wizard.hta" file.

    [*]On the Wizard interface click Add on the Properties List.

    [*]When the Property Editor dialog appears, change the example Property Name to SomeNumber.

    [*]Leave the example setting for Property Type as DWORD.

    [*]Notice when you entered the Property Name that the Help String changed automatically. This string appears as documentation for your property; as in the object browser for VB.

    [*]Now the property is complete. Click OK to add your property to the Properties List on the Wizard interface.

    [*]If you need to change anything about this property from now on, select the property in the Properties List and click Edit.

    [*]On the Wizard interface click Add on the Methods List.

    [*]When the Method Editor dialog appears, change the example Method Name to HelloWorld.

    [*]Below the blue horizontal line there are boxes for up to 5 method parameters. For now, just leave the example parameters as they are. I.E., the HelloWorld method will have two parameters: MyFirstParameter and MySecondParameter.

    [*]Now the method is complete. Click OK to add your method to the Method List on the Wizard interface.

    [*]If you need to change anything about this method from now on, select the method in the Method List and click Edit.

    [*]Now, click Create Project on the Wizard Interface.

    [*]In the Project Name box, enter HelloWorld. (This is the name of our project and COM object).

    [*]Next, click the Browse Button and select a folder to create the project files in.

    [*]Check the Build Project and Show Project Folder checkboxes.

    [*]Last, click OK on the Create Project window.

    The Wizard will run the make.bat file to build the COM object and Register it with RegSvr32. While the project is building, look for GOOD BUILD on line number 4 of the command window. The project folder should then display in Windows Explorer.

    Congratulations! You just created a COM object in Win32ASM!

    Want to see it work now? Just copy the following code in to a file with an ".hta" extension (I.E., index.hta). Run the hta file and click the link. Methods are generated with sample code that displays a messagebox with the method name on it. If you run this sample hta and click the link, you should see a message box with ERROR in the title and HelloWorld in the message area.

    <script language="JScript">
    function a()
    var obj = new ActiveXObject("HelloWorld");
    <a href="#" onClick="a()">HelloWorld(0,0);</a>
Posted on 2002-12-05 12:26:22 by Xtreme
Version 1.0 Beta:
Uploaded - See Above Post

Version 2.0 Beta:
1. Selection of all text in dialogs so example entries are easier to type-over.
2. Project Creation/Build progress bar.
3. Wizard code optimization.
4. Ability to add additional Interfaces.
5. Example HTA generation.
6. Arbitrary number of parameters in methods.
7. Implement Events.

Version 1.0 FINAL:
1. Production quality tool that generates production quality COM objects.
Posted on 2002-12-05 16:14:41 by Xtreme
Im all About this COM wizard... Nice work... (wink, wink, nudge, nudge)

And Err, I like you taste... :grin:

: NaN :
Posted on 2002-12-05 19:09:56 by NaN
You should see her sister :grin:

Has anyone build a COMponent with the wizard yet? Even a little one?
Posted on 2002-12-05 19:19:12 by Xtreme
Ya, well kinda... I made piece-o-crap build so far.. but i have not populated it with anything practicle...

Still tinkering :)

(( Im impressed on the format however ~ im not to web savy ))

PS: In the CreateProject Window, you should add a field to give the person the option to create a new folder in the specified directory... (as well, if possible, remember the directory path for future uses).
Posted on 2002-12-05 19:24:27 by NaN
Another suggestion is an options box, to set up properties. Such as an optional 'undo' batch file to unregister the object.

To keep new commers from polluting their registry any more than it is ;)

More thought to come, im sure.. :alright:

Posted on 2002-12-05 19:50:23 by NaN
Hmm... Ok.. heres the Deal on my Machine..

Its not outputing the .tlb file.. I get a script error:

Char: 4
Error: Object Doesnt Support This Property or Method

As well, after all events (even after i close the about box), i get the standard window pop-up:

The page cannot be displayed

From microsoft...

Perhaps there is some "special" install location? Or is there files im supposed to make public via %path%??

Cause it stops short here... (the make output is):
Building 'TestCreate' COM Object DLL

1) Generating TestCreate.tlb from TestCreate.idl

rsrc.rc (5): error RC2135 : file not found: TestCreate.tlb
CVTRES : fatal error CVT1101: cannot open rsrc.res for reading

2) Assembling TestCreate.asm

3) Linking without resources

Bad command or file name

5) Registered COM Object with Regsvr32

Press any key to continue . . .

(Again, this ball starts rolling because the .tlb file is not generated).
:me shrugs:
Posted on 2002-12-05 20:02:25 by NaN

Added features:

1. Save options to registry
2. Generate Undo.bat

Does your Browse Window look like the one below?
You can add a new folder from the highlighted button.
Posted on 2002-12-05 20:12:43 by Xtreme
Nope... The highlighted button doesnt exist for me.. Does this have something to do with the fact it also generates the indicated error? (ie, my win98se is not up to par with some verion of os?)

(had me worried i put my foot in my mouth there ;) . Its not been the first time <g> )

Posted on 2002-12-05 20:20:47 by NaN

You need "midl.exe". My copy is located at "C:\Program Files\Microsoft SDK\Bin" and is apart of the PATH variable so it can be run from any folder.

Let's see where it can be downloaded.....

....Well it seems to only be installed w/ the MS PSDK. So I've zipped it up and attached it to this message. I'll include it with the next beta and final version of the Wizard. Unzip it to your System (or System32 on NT) folder.
Posted on 2002-12-05 20:24:26 by Xtreme

For Windows 9x machines

    [*]The Windows 98/ME Shell might not be 100% compatible with the Wizard. I'm looking into this...

    [*]Code on line 612 of the Wizard needs to be fixed to call on "Command.com" instead of "cmd". All of you 9x'ers will get a "Object Doesnt Support This Property or Method" error. Nan, will you post a list of Command.com command-line switches? (ie, from DOS call "command/?")

    [*]Also the Wizard needs a DOS applet from Microsoft named midl.exe to generate the Type Library for your COM object. I will include this applet in the next upload.

    [*]The Wizard also needs Regsvr32 to register the COM object with the system. I thought this shipped on all MS OSes? Maybe Nan's %PATH% is incomplete?

    We'll get it all figured out.... ;)
Posted on 2002-12-05 20:41:21 by Xtreme
Thanx. I have it.. I have MS VC++ installed... but i suspect its because its not pathed.

I manually edited the make file to:


And got me one step closer, but then it sends back this error box:

"A required .DLL file, MSPDB50.DLL, was not found."

Im doing a search for it as I type this...

(it doesnt exist on my system :rolleyes:)
Posted on 2002-12-05 20:43:41 by NaN
C:\Program Files\DevStudio>command /?

Starts a new copy of the Windows Command Interpreter.

COMMAND [[drive:]path] [device] [/E:nnnnn] [/L:nnnn] [/U:nnn] [/P] [/MSG]
[/LOW] [/Y [/[C|K] command]]
[drive:]path Specifies the directory containing COMMAND.COM.
device Specifies the device to use for command input and output.
/E:nnnnn Sets the initial environment size to nnnnn bytes.
(nnnnn should be between 256 and 32,768).
/L:nnnn Specifies internal buffers length (requires /P as well).
(nnnn should be between 128 and 1,024).
/U:nnn Specifies the input buffer length (requires /P as well).
(nnn should be between 128 and 255).
/P Makes the new Command Interpreter permanent (can't exit).
/MSG Stores all error messages in memory (requires /P as well)
/LOW Forces COMMAND to keep its resident data in low memory.
/Y Steps through the batch program specified by /C or /K.
/C command Executes the specified command and returns.
/K command Executes the specified command and continues running.

Hope it helps..
Posted on 2002-12-05 20:47:05 by NaN
Well you got me there... :)

I dunno why, cause i definitely didnt take it out, but C:\WINDOWS\SYSTEM was not placed in the startup path, at least on my system...

However, the .DLL i mentioned above doesnt exist on my system at all. Wierd..

Posted on 2002-12-05 20:51:52 by NaN
Ok... got it all hacked now.

I *do* have it after all.. Im a moron, and typed in MSPDB500.dll (one to many zeros) in the search...

Turns out its in the MASM\BIN dir.

So this run around has been enough headache for me, Im going to pernamently modify my path... to include VC++ and MASM..

(( I personally dont want to, but I give in ~ Call me wierd (or a control freak), but i like programs to be self contained, and not need to rely on things that im not directly aware of, secretly behind the schenes))

Posted on 2002-12-05 20:59:17 by NaN
Thanks Nan,

I looked at the command-line switches you posted. I won't have to change what I've got. I'll just need to detect the OS in use via the "Navigator Agent" and run "command.com" or "cmd.exe".

As far as the script errors go, you may need to download: "Windows Scripting Componets 5.6"
Posted on 2002-12-05 21:13:13 by Xtreme
As you can tell, im not so web savy ;)

Nor have i gone beyond simply reading how to make com's. I knew you had to use MIDL and create and IDL. But i never knew you had to have all this other crap set up. To be honest, i've never had a need to make one yet.

Kinda irritated to be honest. This is why i hate C++ and love MASM. Masm is nicely contained and doesnt require all this crap.

I set up my path to include VC\BIN, and MASM\BIN. Rebooted. Got another error. Can't find its oaidl.idl (found in VC\INCLUDE). So i change my path again and add this. It refused to recognize it. I assume its cause its not an .exe extension. Cause there is a path to the proper folder now, and the oaidl.idl and the rest of them are there!

It would be nice to get all these 'bumps' understood, and packaged into one folder for MASM development. Cause it would be nice to NOT expect every new COM'r to have VC++ or something alike. (Even tho i have it installed, and it still does me no good from its installed arrangements, outside of VC++ itself).

Posted on 2002-12-05 21:25:04 by NaN

Ok... here is what i managed to research on this whole MIDL business:

It needs:

    [*]MIDL setup path: MIDL /I Path_to_Directory_OF_IDLs MyCom.IDL

    Hmmm.. I dunno if CL and C1.DLL is non-propriatery, or MIDL for that fact?

    At anyrate, could you add an 'options' box to specify a MIDL include path for the /I switch?? (i can copy the rest outa VC++ and keep it contained under a MASM path)

    PS: I finally got a full make, with no errors. However, i did modify the make file to include an /I path (shown above) and this in the begining:
    @echo off
    echo Building 'Ctest' COM Object DLL

    I suggest you add this into the template as well, cause other OS's may be the same as me, and not directly 'path' out the system dir (where REGSVR32.EXE exists on my 98 OS). (( Trust me, i didnt remove any paths, so im left assuming it was never there, or some installer f&cked it up for me :rolleyes: )). Besides, its not pernament, it only modifies the path for the existance of the batch file, then the path resets to normal anyways.

Posted on 2002-12-05 21:49:43 by NaN