This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Is this possible without InstallShield.Interop.Msi.dll?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 06, 2009
12:35 PM
Custom Action & Progressbar
Hi:
How can I increment my progressbar when calling a long processing custom action in C#, VBScript, JScript, etc...
Thanks,
Yama
How can I increment my progressbar when calling a long processing custom action in C#, VBScript, JScript, etc...
Thanks,
Yama
(10) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 06, 2009
01:00 PM
It takes some determination, but see for example the MSI help topic "Adding Custom Actions to the ProgressBar".
[thread=105165]This ancient thread[/thread] has some information about using VBScript for progress updates.
[thread=105165]This ancient thread[/thread] has some information about using VBScript for progress updates.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 06, 2009
03:53 PM
I tried to use InstallShield.Interop.Msi.dll located in your default installed location of IS2009 (InstallShield\2009\System folder).
So I created a custom action C#
using InstallShield.Interop; // add reference to: System\InstallShield.Interop.Msi.dll
[Guid("A42E2E16-0062-4998-ABCD-000000000000")]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
public class InstallShieldHelpers : IInstallShieldHelpers
{
public InstallShieldHelpers(){}
public void TestingPassingMSIHandleToCSharp(Int32 hanlder)
{
using (Msi.Install install = Msi.CustomActionHandle(handle))
{
install.IncrementProgressBar(5);
// perform my lenghty action here while incrementing progressbar;
}
}
}
[Guid("5E956C79-CFF4-46d7-ABCD-000000000000")]
public interface IInstallShieldHelpers : IDisposable
{
void TestingPassingMSIHandleToCSharp(Int32 hanlder);
}
Now in InstallShield 2009 I add Custom Action
"New Managed Code" -> "Installed with Product"
Execute After ISSetupFilesCleanup
But it does not seem to work...
Any ideas?
Yama
So I created a custom action C#
using InstallShield.Interop; // add reference to: System\InstallShield.Interop.Msi.dll
[Guid("A42E2E16-0062-4998-ABCD-000000000000")]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
public class InstallShieldHelpers : IInstallShieldHelpers
{
public InstallShieldHelpers(){}
public void TestingPassingMSIHandleToCSharp(Int32 hanlder)
{
using (Msi.Install install = Msi.CustomActionHandle(handle))
{
install.IncrementProgressBar(5);
// perform my lenghty action here while incrementing progressbar;
}
}
}
[Guid("5E956C79-CFF4-46d7-ABCD-000000000000")]
public interface IInstallShieldHelpers : IDisposable
{
void TestingPassingMSIHandleToCSharp(Int32 hanlder);
}
Now in InstallShield 2009 I add Custom Action
"New Managed Code" -> "Installed with Product"
Execute After ISSetupFilesCleanup
But it does not seem to work...
Any ideas?
Yama
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 08, 2009
12:41 PM
I'm unclear why all those Guid attributes and interfaces are being specified - perhaps for use with the InstallScript DotNetCoCreateObject, etc., calls? Getting to the actual problem, what doesn't work - does the action fail to start, does the action fail while running, or does the progress bar just not do what you're expecting? Note that in the thread Robert referenced, the tick counts required to see changes were fairly large.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 09, 2009
11:10 AM
Tee problem was resolved... I am definetely going to become a big fan of the Custom Action with Managed Code; though, I am careful on the planning part from this lesson.
What I did was pass the handler as a parameter to my C# public function then used it to loop through items to process. For each item I incremented the progressbar (installer's SetupProgress dialog). Furthermore I was also able to display a CustomData text by specify a small description of what is happening while the progressbar is augmenting by a step. So right below the progressbar a label gets populated with a short description.
So in a nutshell here is the prototype code:
public void RunMyLongProcess(Int32 windowHandle)
{
try
{
int incrementer = 0;
using (Msi.Install install = Msi.CustomActionHandle(windowHandle))
{
install.ResetProgressBar(1500, true, true);
install.IncrementProgressBar(incrementer ++);
Msi.Record record = new Msi.Record(100);
foreach(string fileName in fileNames)
{
Msi.CustomActionHandle(windowHandle).SetProperty("MYPROPERTY", fileName);
record.SetString(1, fileName);
install.ProcessMessage(Msi.InstallMessage.ActionData, record);
// Execute long process here ....
install.IncrementProgressBar(incrementer++);
}
install.IncrementProgressBar(1500);
}
}
catch(Exception e)
{
}
}
There is a lot more to the concept but this introduced me to the basics.
In the couple of months or so I have began working on my company installer with InstallShield I have learn a great deal about your product.
Although I would have loved to get a head start with some of your advanced courses. What would you guys working for the InstallShield proudct suggest as a side reading on Windows Installers?
Hope this helps others looking for the basics I was so eagerly looking...
Thanks.
Yama
What I did was pass the handler as a parameter to my C# public function then used it to loop through items to process. For each item I incremented the progressbar (installer's SetupProgress dialog). Furthermore I was also able to display a CustomData text by specify a small description of what is happening while the progressbar is augmenting by a step. So right below the progressbar a label gets populated with a short description.
So in a nutshell here is the prototype code:
public void RunMyLongProcess(Int32 windowHandle)
{
try
{
int incrementer = 0;
using (Msi.Install install = Msi.CustomActionHandle(windowHandle))
{
install.ResetProgressBar(1500, true, true);
install.IncrementProgressBar(incrementer ++);
Msi.Record record = new Msi.Record(100);
foreach(string fileName in fileNames)
{
Msi.CustomActionHandle(windowHandle).SetProperty("MYPROPERTY", fileName);
record.SetString(1, fileName);
install.ProcessMessage(Msi.InstallMessage.ActionData, record);
// Execute long process here ....
install.IncrementProgressBar(incrementer++);
}
install.IncrementProgressBar(1500);
}
}
catch(Exception e)
{
}
}
There is a lot more to the concept but this introduced me to the basics.
In the couple of months or so I have began working on my company installer with InstallShield I have learn a great deal about your product.
Although I would have loved to get a head start with some of your advanced courses. What would you guys working for the InstallShield proudct suggest as a side reading on Windows Installers?
Hope this helps others looking for the basics I was so eagerly looking...
Thanks.
Yama
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 20, 2009
04:33 AM
Hi,
I only want to create new progress bar. But not to increment the progress bar.
I had created an empty dialog called "Searching" which will be 1st page of my installer. Then, I placed a progress control on the dialog.
When I run my installer, the "Searching" dialog will prompted out. But the progress bar did not run.
DO anyone got idea about this??
Thank you
I only want to create new progress bar. But not to increment the progress bar.
I had created an empty dialog called "Searching" which will be 1st page of my installer. Then, I placed a progress control on the dialog.
When I run my installer, the "Searching" dialog will prompted out. But the progress bar did not run.
DO anyone got idea about this??
Thank you
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 04, 2009
03:57 PM
It's a little bit hacky but it works and involves using autoit to increment the toolbar. Since Ive put it in QA has stopped complaining that the installer "does nothing" or "just stops" for 5 minutes while im running CAs.
http://meninoumbrella.blogspot.com/2009/04/installshield-progress-bar.html
http://meninoumbrella.blogspot.com/2009/04/installshield-progress-bar.html
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 05, 2009
01:35 PM
Not to rain on an interesting approach, but have you tested this under Vista? I don't know exactly how AutoIt does its magic, but I suspect it may have similar problems to other things we've done that failed on Vista.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 23, 2009
01:56 PM
Is posible create the custom action from InstallScript?
anyone will help me ...please
I have a Progress bar control but I would like know how is the code in installScript in the custom actions
thanks:confused:
anyone will help me ...please
I have a Progress bar control but I would like know how is the code in installScript in the custom actions
thanks:confused:
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 22, 2009
02:06 PM
Is it possible to access a real MSI Handle from managed code? The alleged MSI Handle InstallShield provides is something that appears only to work with their internal InstallShield.Interop.Msi.dll. I would prefer to work directly with the actual MSI Handle (also my assembly is and needs to be strong named and the InstallShield assembly is not signed, so fails to load).
I have tried passing an MsiHandle from an InstallScript custom action to managed code loaded via DotNetCoCreateObject and directly via a managed custom action. In the case of passing the handle from InstallScript, I simply received a (-2) on the other end and was never able to do anything with it. From the managed custom action side, I was never able to call MSI methods like MsiProcessMessage without receiving a (-1) Invalid Handle return code.
Any help would be appreciated,
Todd
I have tried passing an MsiHandle from an InstallScript custom action to managed code loaded via DotNetCoCreateObject and directly via a managed custom action. In the case of passing the handle from InstallScript, I simply received a (-2) on the other end and was never able to do anything with it. From the managed custom action side, I was never able to call MSI methods like MsiProcessMessage without receiving a (-1) Invalid Handle return code.
Any help would be appreciated,
Todd
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 22, 2009
03:11 PM
InstallScript custom actions do have an intentionally incorrect handle, although the reason is mostly historical. You can find the real handle by taking the absolute value of it.
Managed Code Custom Actions should receive the actual MSI handle if they mimic the MSI prototype (they take a single signed or unsigned 32-bit integer; technically unsigned is correct, but it doesn't really matter), or if the MsiHandle token is passed in a custom signature method. You can use this however you like; although InstallShield.Interop.Msi is intended to make things easier, it doesn't do anything fundamentally weird to use the handles. On the other end of the spectrum, I've heard good things about using DTF-built actions with InstallShield.
Managed Code Custom Actions should receive the actual MSI handle if they mimic the MSI prototype (they take a single signed or unsigned 32-bit integer; technically unsigned is correct, but it doesn't really matter), or if the MsiHandle token is passed in a custom signature method. You can use this however you like; although InstallShield.Interop.Msi is intended to make things easier, it doesn't do anything fundamentally weird to use the handles. On the other end of the spectrum, I've heard good things about using DTF-built actions with InstallShield.