none
Could not invoke .cpl file from tray icon application

    Question

  • Hi,

        I have a control panel file(.cpl) which deals with certain settings of my bluetooth application. I need to invoke this .cpl file from the menu of my tray icon application. I have updated environment variable path but still I am unable to launch this settings application. I am able to launch in XP but not in win7. I am using ShellExecuteEx()  function to invoke the .cpl file. Return value of ShellExecute function is successful. The same settings application, I am able to launch from control panel window. Can anyone tell me how to launch MyApp.cpl file programmatically using c++? 

    • Moved by Helen Zhou Tuesday, June 08, 2010 2:26 AM (From:ClickOnce and Setup & Deployment Projects)
    Monday, June 07, 2010 10:28 AM

Answers

  • Hi KishoreV,

    Normally you can use ShellExecute to open a control panel file using following code:

      ShellExecute(NULL,  L"open",  L"control.exe",  L"mycpl.cpl",  NULL,  SW_SHOW); 

    If the cpl file requires UAC in windows 7, we should use operation verb ”runas” instead of “open”.

      ShellExecute(NULL,  L"runas",  L"control.exe",  L"mycpl.cpl",  NULL,  SW_SHOW); 

    If I misunderstand you, please let me know.

    Cheers,

    Yi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, June 09, 2010 9:09 AM
    Moderator

All replies

  • This is a forum devoted to Visual Studio ClickOnce/Setup&Depl;oyment projects, and your question isn't related to that at all.  You could try asking in a Windows General Development forum.
    Phil Wilson
    Monday, June 07, 2010 4:42 PM
  • Hi KishoreV,

    I'm moving this thread from Base ”Windows Forms" to "Visual C++ General" forum, since this issue is related to Visual C++ General. There are more Visual C++ General experts in that forum.

    Best Regards,
    Helen Zhou


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Tuesday, June 08, 2010 2:26 AM
  • Hi KishoreV,

    Normally you can use ShellExecute to open a control panel file using following code:

      ShellExecute(NULL,  L"open",  L"control.exe",  L"mycpl.cpl",  NULL,  SW_SHOW); 

    If the cpl file requires UAC in windows 7, we should use operation verb ”runas” instead of “open”.

      ShellExecute(NULL,  L"runas",  L"control.exe",  L"mycpl.cpl",  NULL,  SW_SHOW); 

    If I misunderstand you, please let me know.

    Cheers,

    Yi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, June 09, 2010 9:09 AM
    Moderator