Hi Steven,

Thank you,

As per client requirement I supposed to convert custom actions from C# to
C++.

The below is C# customaction which I used previously,
 [CustomAction]
        public static ActionResult SetPROP(Session session)
        {
            try
            {
                DriveInfo di = new DriveInfo("D");
                if (di.DriveType.ToString().Equals("Fixed") && (di.IsReady))
                {
                    session["PROP1"] = "D:\\";
                    session["PROP2"] = "D:";
                }
                else
                {
                    session["PROP1"] = "C:\\";
                    session["PROP2"] = "C:";
                }
            }
            catch (Exception ex)
            {
            }
            return ActionResult.Success;
        }
My Properies
        <Property Id="PROP1" Value="D:\" />
        <Property Id="PROP2" Value="D:" />

Customaction
<CustomAction Id="SetPROP" BinaryKey="CustomActions.dll" DllEntry="SetPROP"
Execute="immediate" Return="ignore" />

In ExecuteSeq
<Custom Action="SetPROP" After="ValidateProductID"/>


I would like to know how to check disk drives in C++


On Tue, Mar 5, 2013 at 9:02 PM, Steven Ogilvie <steven.ogil...@titus.com>wrote:

> Classification: Public
>
>
> Why use C++ use C# :)
>
> Here is an example:
> http://stackoverflow.com/questions/7222782/how-to-get-the-drive-letter-from-a-full-name-of-the-drive
>
> Here are two functions I use to GET or SET a windows installer property in
> C#
>
> /// <summary>
>         /// Sets a windows installer property
>         /// </summary>
>         /// <param name="session">Session session</param>
>         /// <param name="propertyName">MSI property</param>
>         /// <param name="value">string to populate</param>
>         private static void SetSessionProperty(Session session, string
> propertyName, string value)
>         {
>             try
>             {
>                 if (session == null)
>                 {
>                     throw new ArgumentNullException("session");
>                 }
>
>                 session[propertyName] = value;
>             }
>             catch (Exception ex)
>             {
>                 WriteErrorLogInstall(session, "Exception when executing
> SetSessionProperty.", ex, true);
>             }
>         }
>
>         /// <summary>
>         /// Gets a windows installer property
>         /// </summary>
>         /// <param name="session">Session session</param>
>         /// <param name="propertyName">MSI property</param>
>         /// <param name="isCustomActionData">true or false</param>
>         /// <returns>returns the windows installer property as a
> string</returns>
>         private static string GetSessionProperty(Session session, string
> propertyName, bool isCustomActionData)
>         {
>             string sessionProperty = string.Empty;
>
>             try
>             {
>                 if (session == null)
>                 {
>                     throw new ArgumentNullException("session");
>                 }
>
>                 sessionProperty = isCustomActionData ?
> session.CustomActionData[propertyName] : session[propertyName];
>             }
>             catch (Exception ex)
>             {
>                 WriteErrorLogInstall(session, "Exception when executing
> GetSessionProperty.", ex, true);
>             }
>
>             return sessionProperty;
>         }
>
>
> -----Original Message-----
> From: chintala srinivas [mailto:chentala.srini...@gmail.com]
> Sent: March-05-13 10:23 AM
> To: WiX-users@lists.sourceforge.net
> Subject: [WiX-users] C++ custom actions
>
> Hi,
>
> I am very new to th C++ customaction.
> Can any one help me on how to write C++ custom action for finding
> disk(D:\) is avilable or not. If not then assign c:\ to the property.
>
> Regards,
> Srinivas.
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics Download AppDynamics Lite for
> free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
>
> This message has been marked as Public by Steven Ogilvie.
>
> The above classification labels were added to the message by TITUS Message
> Classification.
> Visit www.titus.com for more information.
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to