Solved

Run VB Code In WISE 6.2

Posted on 2009-07-09
15
802 Views
Last Modified: 2013-11-13
I am trying to create a Wise Installation routine using "Wise for Windows Installer 6.2". What I would like to do, is if the user selected a certain option for install, to display a screen asking for a Procudt ID, this part is fairly simple.  The next thing I would like to do, is "validate" the Product ID entered before allowing the user to continue.  In order to do this, I have to run VB Code using a custom class I created, but I have no clue how to run VB.Net Code inside the Wise Installation & return a "Pass/Fail" flag...

Can anyone help point me in the right direction?
0
Comment
Question by:Ben Santiardo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
15 Comments
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 24819921
Did you read the article "Guidelines for Calling .DLLs " in WfWI Help?
0
 

Author Comment

by:Ben Santiardo
ID: 24822904
Thanks for responding, but that section (which was a pain to find BTW), doesn't really explain much.  It's extremely confusing and has no samples to look at to help explain what it's describing.
I am looking for a more detailed "How To"...
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 24825868
DLL must be C++-type one, that's where there are "functions" inside it, which you specify in the custom action. I don't think you can do it with VB.net.

I think it would be much easier to call executable instead of DLL. Or you can call vbscript that in turn will create an instance of your class, run it, and return the result.

See http://msdn.microsoft.com/en-us/library/aa368085(VS.85).aspx about what to specify. You can pass the the entered product key as parameter using Target column. The executable should return 0 if validation passed, non-zero if not.

I personally would use vbscript if possible. If you make the executable in .net, then you are opening a big can of worms with installed framework, its version, plus ton of various security issues, guaranteed.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Ben Santiardo
ID: 25032903
This question stayed open because no truly useful and/or valid answer has come up.  This problem is still active.  I suppose since no one else has offered suggestions to this thread, it can be closed since apparently no one has an answer.  But accepting vadimrapp1's comment is not valid, since his comment was not an actual useful answer for my problem.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 25032992
> no truly useful and/or valid answer has come up
> his comment was not an actual useful answer for my problem.

the question was:
"I have no clue how to run VB.Net Code inside the Wise Installation & return a "Pass/Fail" flag..."

I explained why DLL made by VB wouldn't work;
and then I suggested what will work instead.

Please clarify why this is not valid, and what you expected.
0
 

Author Comment

by:Ben Santiardo
ID: 25033089
My apologies, no offence was intended.  
I need to know exactly how to incorporate this type of idea into the WFWI project.  I understand that a DLL could help, or an EXE.  I do not write in C++ so that type of DLL idea doesn't help my situation.  And although I could write another VB executable to recieve and return data, I still don't know how to incorporate it into WFWI.  Like I stated in my 2nd posting "I am looking for a more detailed "How To"... "
I need examples, it's makes it easier to understand and grasp.  I am new to using WFWI, I come from using Wise Installation System 9.0 where we had a great amount of control over the scripting directly within the installation routine.  WFWI is very....limited or rather locked down, in what you can access.  Or so it seems compared to what I am used to.  
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 25033499
hold on, let me create a sample for you.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 25034807
here's the sample. Look at the button "next" on the dialog "user information" - it runs custom action "MyValidateProductId" - which is embedded vbscript. That vbscript extracts the property associated with the product id box on the dialog, analyzes it, and depending on the result sets another property MyValidationSuccess to 1 or 0. Following that, button "next" invokes the next dialog only when MyValidationSuccess =  1; there's also textbox "invalid key" that shows up or hides depending on the value of MyValidationSuccess.

This is simple implementation; in fact, the user can bypass UI alltogether by running the installation from command line with /qn , so you have to ensure that validation occurs in the immediate phase as well.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 25034869
the sample can be downloaded from here:
http://rdpvr.polyscience.com/crm/testmsi.msi
0
 

Author Comment

by:Ben Santiardo
ID: 25035778
Ok, thank you for the sample file.  Now where exactly is this Embedded VBScript?
0
 

Author Comment

by:Ben Santiardo
ID: 25035817
Ok, I was able to trrack down the embedded code.  Sorry I found it a few minutes after I posted the previous comment.  
But one remaining question I do have, is it possible to use my own previously created class that will verify the ProductID?  If so, how can I add the class to the project to be able to instantiate it in the VBScript and use?
0
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 500 total points
ID: 25035992
I don't think it's possible. The binaries for custom actions are stored in the installation in the table Binaries, and are extracted just for running custom action, and then deleted. They are extracted with temporary name. In case of your class, the dll would have to be not only extracted, but also registered in the system as COM object, prior to running the vbscript. Which Installer obviously won't do. That's why it allows C++ dll's, because their entry points can be addressed directly by name without any registration in the system.

The only way I can imagine would be by vbscript reaching inside the installation, extracting the binary dll, storing it on the hard drive, running regsvr32, then calling, then unregistering and removing - but as you can see, it's closer to sci-fi than to reality.

Instead of vbscript, you can call an executable - "execute program from installation". Note however the last paragraph from my prior comment 24825868 .
0
 

Author Comment

by:Ben Santiardo
ID: 25036017
Ok, now I see and understand the situation better.  I think you are correct that a simply created EXE that takes parameters and returns a flag would be the best solution...  
Thank you very much for your help, I am going to try that senario now and post my progress.
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been scripting applications way too long and can never remember how to create an ISS file.  So I decided to write this article to act as my own knowledge base for future reference, and hope you will also benefit. An ISS file is a response …
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question