PDA

View Full Version : Executable in visual basic?



andrewvanmar
08-16-2007, 02:46 AM
I'm looking to make the rollout of some required software in my company easier:

What i'd like is an executable (or batch , i don't know) that copies this file -mscal.ocx- from inside itself (if that's possible) to "c:\windows" and then runs the command "regsvr32 c:\windows\mscal.ocx".

for starters, is this possible?
and if so how do I do this? (i have access to the visual basic suite)

thnx!:hi:

Bob Phillips
08-16-2007, 04:27 AM
This is normally the sort of thing that you would do within the installer, package mscal.ocx in the installation file, and script it to be registered.

andrewvanmar
08-16-2007, 04:53 AM
i didn't know that that feature existed.

After asking our ops dept i was told that it would be preferable to have this program as an exe instead of an installer , since my version of VB6 is *cough* not so very legal. And distributing a installer which can only be made through the VBsuite would put the company at risk.

they suggested zipping the file in an exe and script the command.


no clue how to do that though?

[edit: never mind the less than legal version: i found we have a license for VB 2005.

about scripting that commant, are there any specifics or is the installer compiler self explanatory?]

Bob Phillips
08-16-2007, 05:46 AM
Your ops department are talking out of ther a##*s!

Even if your VB6 version is not so legal, there is nothing in the exe created from same that would give the game awaya (although of course that does not mean I am condoning what you are doing).

And I was not talking about creating an installer through VB, quite the opposite. I was talking about using a proprietary installer such as MS's MSI, Wise, etc., and your ops department should have said the same thing. These products are specifically built for deploying applications, including DLLs, OCXs, etc., across a department, organisation, even across a market.

Zipping the file is a poor substitute for a proper installer.

Bob Phillips
08-16-2007, 05:47 AM
BTW, anyone can have a licens for VB 2005, it's free!

But it is VB.Net, not standard VB.

andrewvanmar
08-16-2007, 05:58 AM
Heh, yeah talking out of their...erhm.... @$$€$ is one of their specialties. But since I know zilch about this stuff I tend to take what they say at face value (which is most often a mistake ;-) )

I found disks for vb 2005. It's not regular VB?

What's the downside to zipping it into an exe like you said againt using something like msi?

Bob Phillips
08-16-2007, 06:43 AM
VB2005 is the express version of VS2005's VB, which is all dotNet.

Well it won't register the OCX on the target machine, won't even put it in the correct directory as far as I can see. So work will need to be done after the zip file is loaded, which a self-extracting installer will do in one fell swoop.

andrewvanmar
08-16-2007, 06:47 AM
Hmmm yeah i see the problem.

I found a installer program called advanced installer, and trying to see if it can do what I want. not easy.

but since this has gone beyond the realm of VB i'll mark this as solved :)

andrewvanmar
08-16-2007, 06:56 AM
Oh what I do need though, is the VB code to run the regsvr command. I think I can manage the rest.

andrewvanmar
08-16-2007, 07:09 AM
I found this:

Shell "c:\myfolder\myprogram.exe"
This apparantly call the windows run command, but now to make it run the regsvr thing....

Bob Phillips
08-16-2007, 07:29 AM
No you don't the installer should do that.

I use Inno Setup, advanced, market leader, and free.

andrewvanmar
08-16-2007, 07:49 AM
I'll try your program, that way if I run into a snag then'you'll know the program
:)

Bob Phillips
08-16-2007, 07:54 AM
Indeed!

I am no expert, but I do use it.

andrewvanmar
08-16-2007, 09:11 AM
Hmm, made three versions ( two with my other program, and the one with yours, now to try it at home where I haven't registered the OCX yet,k see which one actually works ;-)

Charlize
08-16-2007, 10:44 AM
use in a batchfile 'cmd regsvr32 c:\windows\mscal.ocx' after you have copied the .ocx file to the system. If you can use usb sticks you can create an autostarter for the usb that will run that batchfile to install to the proper directory. You'll probably need some %variable% for the usb rootdrive. I use pstarter (for a non u3-compatible usb stick). If interested I'll take a closer look at those rootvariables you could use for knowing the used driveletter of the usb stick.

andrewvanmar
08-17-2007, 09:31 AM
@XLD:
I tried all versions, but the installers don't automatically register the ocx. I thik i would like to try entering the command through visual basic, since the program specifically allows for it. Would you help me with the code?

@Charlize: This batch file would contain the ocx file to copy? No I won't be able to use usb stick, i'd be zipping it, and mailing it to the offices abroad. No clue how to make a batch file though.

Bob Phillips
08-18-2007, 02:57 AM
What Inno script did you use, it should register it.

andrewvanmar
08-22-2007, 02:40 AM
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "MSCAL"
#define MyAppVerName "Mscal"
#define MyAppPublisher "linxtelecom"
[Setup]
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
DefaultDirName=C:\windows\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "C:\WINDOWS\MSCAL\MSCAL.OCX"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

This one.
But you can leave it, I fixed the other one, it works now :) Thanks for helping !

Bob Phillips
08-22-2007, 05:59 AM
You are not registering, and did you read the note that the wizrd throws out


[Files]
Source: "C:\WINDOWS\MSCAL\MSCAL.OCX"; DestDir: "{app}"; Flags: regserver
; NOTE: Don 't use "Flags: ignoreversion" on any shared system files

andrewvanmar
08-22-2007, 08:44 AM
I saw nothing in the wizard about registering actually, nor a message that referred to registering???

Bob Phillips
08-22-2007, 09:29 AM
No, the wizard is limited, As mos (all?) wizards are. But I did mention that you would register the OCX through the installer (Inno here), so I would have thought you would have looked in the Inno help. It is not quite obvious as it gives more about registering through script, rather than Inno, but it is there.