WiX: conditionally register application to start when Windows launches -


i want register application start windows launches based on check box in exit dialog.

i followed this seem writing registry done before end dialog (and relevant check box) appear.

my code is: in product.wxs:

<property id="app_automatic_start_up">1</property> .... <component id="appautostartup" guid="{myguid}"> <registryvalue id="app.rst" root="hkcu" action="write" key="software\microsoft\windows\currentversion\run" name="app" value="[#myapp.exe]" type="string" /> <condition><![cdata[installed or app_automatic_start_up]]></condition> 

in myexitdialog.wxs:

<control id="automaticstartup" type="checkbox" height="18" width="295" x="135" y="190" text="run app upon windows startup" property="app_automatic_start_up" checkboxvalue="1"> <condition action="hide" >installed</condition> <condition action="show" >not installed</condition> 

edit: tried adding key registry , in case user un-check check box delete using custom action. code:

[customaction] public static actionresult notrunonstartup(session session) {     session.log("begin notrunonstartup");     registrykey rk = registry.currentuser.opensubkey("software\\microsoft\\windows\\currentversion\\run", true);     rk.deletevalue("myapp");      return actionresult.success; }  <binary id="notrunonstartupbinary" src="..\customactions\notrunonstartup\bin\$(var.configuration)\notrunonstartup.ca.dll" />  ... <customaction id="notrunonstartupca"         return="check"         execute="immediate"         binarykey="notrunonstartupbinary"         dllentry="notrunonstartup" />  ...    <publish dialog="myexitdialog" control="finish" event="doaction" value="notrunonstartupca">app_automatic_start_up= 0 , not installed</publish> 

the result is, during instalation write key registry, when uncheck check box , press finish, key in not removed registry. ideas why?

the other choice write custom action runs @ end of install based on value of checkbox, , again you'd need remove registry entry @ uninstall.

as suggested, better make configuration of app , not install. if user changes mind, what's supposed do? fiddle in registry (if can figure out is)? uninstall , re-install change setting?

by way, program not start "as windows launches". start when user logs on, , that's not same thing. if want launch when user logs on describe users "when logon". if want launch when windows starts need service.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -