Here is a revised COM Wizard tool to work with Japheth's model and tools. I have written it mainly for my own uses, however, if you want to use it as well here it is.

Please pay attention to the README.TXT. I outline alot of issues you may need to know.

Its fully tested on Win98SE. I suspect the windows shell stuff my have a problem with Windows NT/XP/2000 if so tell me and i will guide you the lines to change. If not... all the better ;)

It will generate RADAsm project by default for you to start with and all needed COM code to make a Dispatchable interface.

Regards,
:NaN:
Posted on 2003-09-28 01:00:48 by NaN
Hi NaN,

I had a first look at your tool and would like to mention:

1. MIDL is included in Platform SDK, so you possibly dont need VC.

2. I have a problem with "Browse" button in "Create Project" dialog. Method "BrowseForFolder" cannot be executed and returns a "Permission denied" error. Since I allow everything in the local intranet zone, I have no idea how to solve this problem (with comview I CAN create a shell automation object and there is no problem with executing method BrowseForFolder). Any ideas appreciated.


problem with "Browse" occurs on winXP only, but works for Win98.


Japheth
Posted on 2003-09-28 02:59:14 by japheth
Im at a loss for explainations, other than perhaps some level of Active-X and Shell object protection. Here is the source for that buttons function. As you can see its not very complicated (It works here too on my 98SE):
// ----------------------------------------------------------------------------------------------------------------------------

// INDEX21 : Internal BROWSE Function
// ----------------------------------------------------------------------------------------------------------------------------
function Browse()
{
var oFolder = new Object;
var oShell = new Object;
var oFolderItem = new Object;

oShell = new ActiveXObject("Shell.Application");
oFolder = oShell.BrowseForFolder(0, "Select a project folder:", 0);

if ( oFolder != null)
{
oFolderItem = oFolder.Items().Item();

if (oFolderItem.Path != null)
{
projectfolder.value = oFolderItem.Path;
}

}
}


Its all COM calling. In the Theory of things it *should* universally work :rolleyes:

:NaN:
Posted on 2003-09-28 09:27:52 by NaN
Hi NaN

I was a bit too optimistic about the need of VC for MIDL compiler. In fact, without further actions it calls VC's precompiler, which isnt included in the platform sdk.

But you can tell MIDL with option /nocpp to not call any precompiler (it is not at all required for the tasks in question here). Regretably, some of the .IDL files in your package have "#define" lines included, which MIDL cannot handle. But they can easily be replaced by other code, which I have done and attached here.

So now the only files additionally required for compiling a COM project are MIDL.EXE and MIDLC.EXE, which both are included in platform sdk (which is virtually free).

Japheth
Posted on 2003-09-28 13:15:00 by japheth
Thanks i will check it out tomorrow and probably repackage another version.

Any luck with the Browse issue?

:NaN:
Posted on 2003-09-28 22:37:47 by NaN
Hi


Any luck with the Browse issue?

No. IE and its security settings are the same both on winxp and win98.
Mysteriously if I execute file create.htm directly theres no problem with BrowseForFolder method.
Posted on 2003-09-29 12:58:42 by japheth
I see 33 people are taking advantage of the tool so far.

Out of this, is there anyone who has tested the Browse button on WinXP other than Japheth?? It would be nice to determine concretely that its an XP issue and not something else...

:NaN:
Posted on 2003-09-29 19:23:31 by NaN
Tested the browse on Win2000, got the error below. I don't have MASM32 etc. installed on the W2K machine, but i guess it does not affect the browse problem.

Did not get such error on Win98.
Posted on 2003-09-30 02:52:50 by Janne
I'm running Windows 2000 but I don't have the above problem!

Anyway, I can confirm that the only additional files needed in MASM32, using /nocpp directive, are: Midl.exe (the driver), and Midlc.exe (the compiler engine).

The problem I've found, running WSH 5.1, is that .CurrentDirectory is not supported.

For midl is not a problem, adding the /out directive. For ComView it needs a little workaround, but I think that the "out" option could be simply implemented for the /B option (japheth??).

Here the changed code in app.js:


try
{
var WshShell = new ActiveXObject("WScript.Shell");
[COLOR=red]//WshShell.CurrentDirectory = ProjectFolder;[/COLOR]
var midlfile = fso.BuildPath( MasmDir, "bin\\MIDL.EXE" );
//alert( midlfile+" "+COMName+".idl /I "+MastersIDL )
[COLOR=red]//WshShell.Run(midlfile+" "+COMName+".idl /I "+MastersIDL);
WshShell.Run(midlfile+" "+fso.BuildPath( ProjectFolder, COMName+".idl" )+" /out "+ProjectFolder+" /win32 /nocpp /I "+MastersIDL);[/COLOR]
WshShell = null
alert("Click OK when TLB is finished building!")

var WshShell = new ActiveXObject("WScript.Shell");
[COLOR=red]//WshShell.CurrentDirectory = ProjectFolder;
//var midlfile = fso.BuildPath( MasmDir, "Comview\\COMView.exe /B "+COMName+".tlb" );
var midlfile = fso.BuildPath( MasmDir, "Comview\\COMView.exe")+" /B "+fso.BuildPath( ProjectFolder, COMName+".tlb" );
//WshShell.Run(midlfile);
WshShell.Run(WshShell.Environment("Process").Item("COMSPEC")+" /c \"cd "+ProjectFolder+" \& "+midlfile+"\"");[/COLOR]
WshShell = null
//alert("COM Interface Include Built!")

}

Note: that I've added /win32 in order to create files for 32bit target environment (I'm running midl v6.00.0361, and the default output is 64bit). COMSPEC will be cmd.exe or command.com, depending on the OS.

And one suggestion: a bigger "Project Folder" textbox in the CreateProject dialog... I can read only the drive letter after the selection ;)

Attached the modified app.js file...
Posted on 2003-09-30 10:26:24 by Cip
I tried to fix all the issues.. however i dont have win2000/xp so im coding in the dark.. I more or less directly copied from M$'s MSDN page to hopefully fix the browse issue.

As for the Command / CMD issue, i found that cip's solution doesnt work in 9x. So i scratched the entire thing and made a batch file instead. You have to manually run it and it is always created.

The up side to this is you can now easily edit your IDL and create new TBL and INC's with the same batch file at a later point.

Regarding the Create window having a small edit window for the path. On win 9x i have no problem, it spans the width of the table column. However, to be safe i hard coded a width in anyways (hopefully this will make other OS's happy ;) ).

Lemme know how things turn out..
Thanks alot!
:alright:
NaN
Posted on 2003-09-30 22:59:32 by NaN

As for the Command / CMD issue, i found that cip's solution doesnt work in 9x. So i scratched the entire thing and made a batch file instead. You have to manually run it and it is always created.

The up side to this is you can now easily edit your IDL and create new TBL and INC's with the same batch file at a later point.

As I don't have a 9x environment, I've blindly implemented the modification, but probably the support for the & operator is not working as it works with cmd.exe.

Anyway the solution with a batch file it's nice and it helps a lot if you need to recreate TLB and INC files. And if one day ComView will support an output directory parameter when used in batch mode, you'll be able to get rid of the "cd" command as it could generate some issues when project and binaries are on different drives (I'm not sure if "cd /D" is fully supported on all OS's).

Regarding the Create window having a small edit window for the path. On win 9x i have no problem, it spans the width of the table column. However, to be safe i hard coded a width in anyways (hopefully this will make other OS's happy ;) ).

I can confirm that W2K is happy now :grin:

Also the About dialog it's working fine! I know that it didn't had any issue, but I'm always testing it... :tongue:
Posted on 2003-10-01 04:25:12 by Cip
I even changed the revision :P

BTW: Any of you NT/XP/2000 people test out the new 'Browse' button yet?
Posted on 2003-10-01 15:42:05 by NaN
Yes, still doesnt work.

Doing some research the reason seams to be that this dialog is "untrusted". So if I insert Browse() in function Init() it is executed without problems.

Another (minor) point is height of dialogs. I've set DPI of display to 120 instead of 96 and are unable to see the Ok and Cancel buttons. Possibly dialog height shouldnt be set in pixels units.

In file objbase.inc I found these lines


.data
IID_NULL dd 0,0,0,0

Theres possibly a better solution. One should avoid data definitions in include files. Actually IID_NULL is defined in every main file. Ok, youre current implementation has only 1 main file, so thats no real issue, but it looks bad.

Japheth
Posted on 2003-10-01 23:31:21 by japheth
About the "Browse" issue, I'm running W2k and I don't have any problem with it.

I've tested it on two different workstations, one with SP2 and IE version 5.50.4522.1800, and the other with SP3 and IE version 6.0.2800.1106CO.

It works fine... both with or without local admin priviledges.
Posted on 2003-10-02 04:43:11 by Cip
Hi,

i finally solved the Browse issue simply by changing file extension to .hta. But I absolutely dont understand why this changes behaviour because the HTA:APPLICATION tag in file "com wizard.htm" should indicate already that this file is a HTA-application.

To work properly I had to change another line


f = fso.GetFolder( unescape(window.location.pathname.slice(0, window.location.pathname.lastIndexOf("\\"))) );


Again I have no clue why this is needed (in fact changed array from 1-based to zero-based).

But it works now :)

Japheth
Posted on 2003-10-04 11:22:38 by japheth
Alot of the support code is not my own. Mostly it came from Xtreme's first attemp at this tool. As a result i have left in alot without really analysing it too deeply. Basicaly if it wasnt broken (from my testing anyways), dont fix it ;)

Thanks for finding this solution. I will work it in the next version. I want to get multiple interface support as well as work in Event code... but first i have to learn it ;)

:NaN:
Posted on 2003-10-04 15:01:22 by NaN