Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Deferred CA needs to block installer window


2 replies to this topic

Tifoid

Tifoid
  • Members
  • 27 posts

Posted 02 December 2004 - 22:18


I have a deferred custom action that runs at the very end of the install (I have placed it as the last deferred custom action in the execute sequence directly before InstallFinalize). This custom action displays a dialog to the user while it performs some pretty intense background work (unfortunately it takes a significant amount of time to complete). I’m trying to find a way to attach my dialog to the installers dialog or at a minimum disable the cancel button on the installer dialog while I an performing my processing.

Please note that this is a deferred custom action and I do not have access to any of the installer’s properties. Also the dialog that this custom action ends up preempting is the SetupProgress dialog … so the cancel button needs to be available during the install of the files and disabled only during the running of this custom action.

Preferably I would like a way to get the handle of the installer dialog so I can attach my dialog as a modal child.

Any ideas?


cooki

cooki
  • Full Members
  • 35 posts

Posted 03 December 2004 - 13:09

to disable the cancel button, insert the following in your CA:
QUOTE
    PMSIHANDLE hRecord = MsiCreateRecord(2);
    MsiRecordSetInteger(hRecord,1,2);
    MsiRecordSetInteger(hRecord,2,0);
    MsiProcessMessage(hInstall,INSTALLMESSAGE_COMMONDATA,hRecord);


to restablish the cancel buton:
QUOTE
    MsiRecordSetInteger(hRecord,1,2);
    MsiRecordSetInteger(hRecord,2,1);
    MsiProcessMessage(hInstall,INSTALLMESSAGE_COMMONDATA,hRecord);



Otherwise, to get the msi window handle:
QUOTE
    PMSIHANDLE hDatabase, hView, hRecord;
    CString szTitle;

    // retrieve the title of the dialog
    hDatabase = MsiGetActiveDatabase(hInstall);
    MsiDatabaseOpenView(hDatabase, _T("SELECT `Title` FROM `Dialog` WHERE `Dialog`=\'SetupProgress\'"),&hView);
    MsiViewExecute(hView,0);
    MsiViewFetch(hView,&hRecord);
    DWORD nSize=1024;
    MsiRecordGetString(hRecord,1,szTitle.GetBufferSetLength(nSize),&nSize);
    szTitle.ReleaseBuffer();
    MsiViewClose(hView);

    // format the text
    CString szFormattedTitle;
    PMSIHANDLE hRecord = MsiCreateRecord(1);
    MsiRecordSetString(hRecord,0,szTitle);
    DWORD nSize=1024;
    MsiFormatRecord(hInstall,hRecord,szFormattedTitle.GetBufferSetLength(nSize),&nSize);
    szFormattedTitle.ReleaseBuffer();

    HWND hWnd = FindWindow(NULL,szFormattedTitle);



good luck for your CA and have a nice week-end

Tifoid

Tifoid
  • Members
  • 27 posts

Posted 03 December 2004 - 20:19

That was really good ... my dialog now sits on top of the installer window and it can't fall behind ... but it is not truly modal ... you can still interact with the installer window.

I have tried enabling and disabling the installer window to no avail.

Got any more ideas?