Sorry, Im not sure how you would determine if you were in a DoAction custom action. Its not something Ive ever done.
BTW it might be worth looking through the Wix SDK to see if any of the example code is implemented within it. It was written quite a while ago, perhaps for Wix 2. -----Original Message----- From: Igor Paniushkin [mailto:ipaniush...@sdl.com] Sent: 09 October 2009 13:17 To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Showing error message from CAwhichiscalledthroughpublish event DoAction Thank you very much for helping me out and for example! I was thinking about the same, but it looked to me really ugly solution and I thought that maybe there is easy way to do that. And the last question, how is it better to check if action is performed in InstallUISequence or in InstallExecuteSequence, because I want to show this message only in InstallUISequence? -----Original Message----- From: Peter Shirtcliffe [mailto:pshirtcli...@sdl.com] Sent: Friday, October 09, 2009 2:10 PM To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Showing error message from CA whichiscalledthroughpublish event DoAction Here is the sequence of actions. Im using some wix sdk functions to make the job easier and STL strings and a couple of my own utility classes but Im sure you can follow what's going on. Get the error message from the MSI database using a function like this. The "query" argument would be something like L"SELECT Message FROM Error WHERE Error=25000" wstring MsiQueryGetString(const wstring & query) { PMSIHANDLE view; HRESULT hr = WcaOpenExecuteView(query.c_str(), &view); if (FAILED(hr)) throw WindowsError(L"Couldn't open and execute view: " + query, hr); PMSIHANDLE record; hr = WcaFetchSingleRecord(view, &record); if (FAILED(hr)) throw WindowsError(L"Couldn't fetch record using query: " + query, hr); LPWSTR bufferPtr = 0; hr = WcaGetRecordString(record, 1, &bufferPtr); if (FAILED(hr)) { ReleaseStr(bufferPtr); // Must freed, even on error. throw WindowsError(L"Couldn't get string from record in query: " + query, hr); } wstring result(bufferPtr); ReleaseStr(bufferPtr); return result; } If your error messages are more than simple strings i.e. they have placeholders for other values in them, you can expand on the above by calling MsiFormatRecord. For example: const wstring SQLResult = MsiQueryGetString( <<<query string>>> ); PMSIHANDLE record = MsiCreateRecord(1); MsiRecordSetString(record, 0, SQLResult.c_str()); MsiRecordSetString(record, 1, <<<someStringParameter>>>.c_str()); wstring message = formatRecord(record); // then display message with a messagebox wstring formatRecord(MSIHANDLE record) { MSIHANDLE installer = WcaGetInstallHandle(); wchar_t dummyBuffer; DWORD bufferSize = 0; UINT ret = MsiFormatRecord(installer, record, &dummyBuffer, &bufferSize); if (ret != ERROR_MORE_DATA) throw WindowsError(L"Couldn't get formatted size of error to display.", ret); vector<wchar_t> buffer(++bufferSize); ret = MsiFormatRecord(installer, record, &buffer[ 0 ], &bufferSize); if (ret != ERROR_SUCCESS) throw WindowsError(L"Couldn't format error message.", ret); return &buffer[ 0 ]; } Hope that helps. -----Original Message----- From: Igor Paniushkin [mailto:ipaniush...@sdl.com] Sent: 09 October 2009 12:47 To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Showing error message from CA which iscalledthroughpublish event DoAction Thank you, I will try that out. But also then I have related question, how can I get right error message which I need to show on message box? I mean that currently I have error messages (localizable) in Error table, and in c++ I know the error code of that message, how can I get message itself in c++ and not error code? -----Original Message----- From: Peter Shirtcliffe [mailto:pshirtcli...@sdl.com] Sent: Friday, October 09, 2009 1:37 PM To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Showing error message from CA which is calledthroughpublish event DoAction With DoAction custom actions in the UI sequence, there doesnt seem to be any MSI specific way so just use MessageBox(). To get the parent window for the message box, so that it appears on top of your dialog, see http://www.mail-archive.com/wix-users@lists.sourceforge.net/msg00415.htm l -----Original Message----- From: Igor Paniushkin [mailto:ipaniush...@sdl.com] Sent: 09 October 2009 11:25 To: wix-users@lists.sourceforge.net Subject: [WiX-users] Showing error message from CA which is called throughpublish event DoAction Hi All, I have a couple of validation custom actions in C++ and C# which I want to call in dialogs and if installer executed without UI in install execute sequence. And in case of error I want to show error message, currently I'm using MsiProcessMessage and session.Message methods, which are working fine if CA performed in install execute sequence. But message is not shown if I'm trying to execute these actions in UI sequence through DoAction publish event. I have read in msi documentation, that it is be design, so my question what is the best approach to show error message box from such situation? Best Regards, Igor SDL PLC confidential, all rights reserved. If you are not the intended recipient of this mail SDL requests and requires that you delete it without acting upon or copying any of its contents, and we further request that you advise us. SDL PLC is a public limited company registered in England and Wales. Registered number: 02675207. Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6 7DY, UK. ------------------------------------------------------------------------ ------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------ ------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------ ------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------ ------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------ ------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users