Programatically switch profile on WM 5.0 Device?

J

jminiman

Pretty simple! I'd like to, via managed code, switch between the
various profiles available on my phone (Normal, Silent, Meeting,
Outdoor, Automatic, etc.). I understand that the values can be READ
from:

HKCU\ControlPanel\Profiles\ActiveProfile

But making changes here only changes the Profiles selector menu - it
doesn't actually impact the OS (the Today screen doesn't change, and
the device still behaves as if the new Profile is ignored).

Couldn't find a way to do this in the WM 5.0 SDK...thanks in advance
for any help?
 
P

Peter Foot [MVP]

Have you tried broadcasting a WM_SETTINGCHANGE message after changing the
registry key?

Peter
 
J

jminiman

Have you tried broadcasting a WM_SETTINGCHANGE message after changing the
registry key?

Peter

Not to be lazy, but I see many posts suggesting the same window
message. But I have yet to see sample code. Any help in this regard?
 
J

jminiman

Not to be lazy, but I see many posts suggesting the same window
message. But I have yet to see sample code. Any help in this regard?

Okay, here is the code I tried:

SendMessage((IntPtr)HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0);

private const int WM_SETTINGCHANGE = 0x001A;
private const int HWND_BROADCAST = 0xffff;

This does not result in the OS updating itself. I know the wParam
value must be 0, but what should the lParam be?
 
J

jminiman

Update: I tried using rapiconfig.exe with the following XML:

<wap-provisioningdoc>
<characteristic type="Registry">
<parm name="PreviousProfile" value="Normal"
datatype="string" />
</characteristic>
</characteristic>
</wap-provisioningdoc>

No error came back (the status was success), but none of the profile
values were updated! Here was the output:

<wap-provisioningdoc>
<characteristic type="Registry">
<characteristic type="HKCU\ControlPanel\Profiles">
<parm name="ActiveProfile" value="Silent" datatype="string"
label="Active Profile:" maxlength="50" rw-access="3"/>
<parm name="PreviousProfile" value="Normal" datatype="string"/>
</characteristic>
</characteristic>
</wap-provisioningdoc>
 
P

Peter Foot [MVP]

This is functionally equivalent to calling the registry methods directly. I
had a quick look and there doesn't appear to be a configuration service
provider which specific support the phone profile :-(

The WM_SETTINGCHANGE was only a guess and I don't have any experience of
whether it works in this case.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top