elanius
Posts: 38
Joined: Fri May 15, 2009 9:49 am

Published events for pushbutton (order problem)

Hi.

I have some problem with publish events ordering for pushbutton. I have to call my CA after spawndialog. But this order which I wrote is ignored and my CA is always called before spawndialog. I need it because in spawn dialog user has to select some file (or simple some option) and than I have to use his choice in CA.

If you want to know what I am doing, I am trying make ListBox where user can add or remove some files. I know that in newer version is some support for this but I have only version 5.1.1 so I have to make it everything by myself. But as I wrote my main problem is that spawndialog is not called before my custom action.

thanks for any reply.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Published events for pushbutton (order problem)

Hi,
I have to call my CA after spawndialog. But this order which I wrote is ignored and my CA is always called before spawndialog.
I'm afraid Windows Installer does not support a DoAction control event after a SpawnDialog or NewDialog event. For what you need you can try running the custom action on the spawned dialog (for example on it's OK button).

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
elanius
Posts: 38
Joined: Fri May 15, 2009 9:49 am

Re: Published events for pushbutton (order problem)

Hi

Yes it is good idea. But I found another solution form my problem. I needn't call spawndialog because I can (and must) call FileBrowseDialog from my CA and there handle name of selected file.

For now I have another maybe not so important question. Is there any way how to obtain window handle HWND from MSIHANDLE hInstall on dialog from which was CA called?

I now there are some ways how to obtain it form name of window and I will do it if there won't be some better way.

Thanks for advice and reply.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Published events for pushbutton (order problem)

Hi,

Unfortunately each installation dialog has its own handle and MSIHANDLE is the same for the entire installation process. Therefore, the only way to retrieve a handle to an installer window is by finding it in the existing windows. I'm afraid Windows Installer doesn't offer any support for this.

Can you please give me more details about why you need this handle? If you want to pass information back to the installer, you can try setting installer properties inside the custom action. Please note that from the custom actions which use custom code only VBScript and C++ DLL custom actions can set installer properties.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
elanius
Posts: 38
Joined: Fri May 15, 2009 9:49 am

Re: Published events for pushbutton (order problem)

Hi.

So I need this handle because I am opening FileBrowseDlg from CA and there I need parent HWND, I now it is not necessary but it is better to have it because than is this dlg correctly centered.
For now I use
HWND hWnd = FindWindow(_T("MsiDialogCloseClass"), NULL);

but I am not satisfied with this solution, maybe I send via some property also window name to be sure that I found correct window.

I found some vbs function GetWindowHandle but I am not goot in VBS som I don't know how to write inline script. I am trying something like this.
property("HWND")=GetWindowHandle(HWND_INSTALL)
And than in my CA I'd read this HWND property and than used is as handle. I just need value of handle and than I'd cast it on HWND but I am not sure if it would work.

And there are lot of thing why it is good to have handle on window because than I could made some changes in controls which are on installer dialogs. e.g. extend ListBox with columns but this would be nice hack maybe just for playing with it :)

Regards, elanius

Return to “Common Problems”