Click here to Skip to main content
15,926,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralSending images over a tcp socket Pin
cabz2-Jun-05 6:14
cabz2-Jun-05 6:14 
GeneralRe: Sending images over a tcp socket Pin
Trollslayer2-Jun-05 6:31
mentorTrollslayer2-Jun-05 6:31 
GeneralRe: Sending images over a tcp socket Pin
ThatsAlok2-Jun-05 19:11
ThatsAlok2-Jun-05 19:11 
GeneralC++ Redraw the entire window Pin
elapid2-Jun-05 6:13
elapid2-Jun-05 6:13 
GeneralRe: C++ Redraw the entire window Pin
David Crow2-Jun-05 7:10
David Crow2-Jun-05 7:10 
GeneralRe: C++ Redraw the entire window Pin
elapid2-Jun-05 7:54
elapid2-Jun-05 7:54 
GeneralRe: C++ Redraw the entire window Pin
David Crow2-Jun-05 7:59
David Crow2-Jun-05 7:59 
GeneralPropegating System Varaiables Pin
Guinness4Strength2-Jun-05 5:03
Guinness4Strength2-Jun-05 5:03 
I am attempting to create/update system variables in WinXP via the registery. I can add/update the variables and values just fine, however I cannot get the changes to recognized by the OS without rebooting. Now I have searched here and googled this question and everyone has the same answer....Use SendMessageTimeout to send a HWND_BROADCAST message with the WM_SETTINGCHANGE parameter. I have done this, but when I start another program that accesses the variable, the old value is still there... So it must be my program...But its hard to screw up a cut and paste of code so any ideas ?

//cycle through entrys and add to registry
for(int x=0;x<m_VarList.GetItemCount();x++)
{
	if(IsDlgButtonChecked(IDC_USERRADIO))
		SetEnvironmentalVariable(m_VarList.GetItemText(x,0),m_VarList.GetItemText(x,1),FALSE);
	else if(IsDlgButtonChecked(IDC_SYSTEMRADIO))
		SetEnvironmentalVariable(m_VarList.GetItemText(x,0),m_VarList.GetItemText(x,1));
}
if(IsDlgButtonChecked(IDC_FORCEUPDATE))
{
	DWORD dwReturnValue;
	long res;
	res=SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,(LPARAM) "Environment", SMTO_ABORTIFHUNG,5000, &dwReturnValue);
	//res=SendMessageTimeout(HWND_BROADCAST, WM_WININICHANGE, 0,(LPARAM) "Environment", SMTO_ABORTIFHUNG,5000, &dwReturnValue);
	//res=SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,(LPARAM) "Policy", SMTO_ABORTIFHUNG,5000, &dwReturnValue);
	//res=SendMessageTimeout(HWND_BROADCAST, WM_WININICHANGE, 0,(LPARAM) "Policy", SMTO_ABORTIFHUNG,5000, &dwReturnValue);
	if(res!=0)
		AfxMessageBox("System update was successful you will NOT have to reboot the computer");
	else
		AfxMessageBox("System update was successful, but you will have to reboot the computer");
}
CDialog::OnOK()


As you can see I've tried different combinations of broadcast messages, but the value still does not get updated. I'd appreciate any help you could provide.

The program I use that accesses the system variable was written for testing and consists of a single line of C# code
string Value=Environment.GetEnvironmentVariable("TEST_SYS_VAR");

GeneralRe: Propegating System Varaiables Pin
David Crow2-Jun-05 5:51
David Crow2-Jun-05 5:51 
GeneralRe: Propegating System Varaiables Pin
Guinness4Strength2-Jun-05 5:57
Guinness4Strength2-Jun-05 5:57 
GeneralRe: Propegating System Varaiables Pin
David Crow2-Jun-05 6:17
David Crow2-Jun-05 6:17 
GeneralRe: Propegating System Varaiables Pin
Guinness4Strength2-Jun-05 9:42
Guinness4Strength2-Jun-05 9:42 
GeneralRe: Propegating System Varaiables Pin
David Crow2-Jun-05 9:50
David Crow2-Jun-05 9:50 
GeneralRe: Propegating System Varaiables Pin
Guinness4Strength2-Jun-05 9:52
Guinness4Strength2-Jun-05 9:52 
GeneralRe: Propegating System Varaiables Pin
David Crow2-Jun-05 9:58
David Crow2-Jun-05 9:58 
GeneralRe: Propegating System Varaiables Pin
Guinness4Strength2-Jun-05 10:03
Guinness4Strength2-Jun-05 10:03 
GeneralRe: Propegating System Varaiables Pin
David Crow3-Jun-05 4:43
David Crow3-Jun-05 4:43 
GeneralRe: Propegating System Varaiables Pin
Guinness4Strength3-Jun-05 5:00
Guinness4Strength3-Jun-05 5:00 
GeneralRe: Propegating System Varaiables Pin
David Crow3-Jun-05 5:10
David Crow3-Jun-05 5:10 
GeneralRe: Propegating System Varaiables Pin
Guinness4Strength3-Jun-05 5:13
Guinness4Strength3-Jun-05 5:13 
GeneralRe: Propegating System Varaiables Pin
David Crow3-Jun-05 5:20
David Crow3-Jun-05 5:20 
GeneralRe: Propegating System Varaiables Pin
Guinness4Strength3-Jun-05 5:22
Guinness4Strength3-Jun-05 5:22 
GeneralRe: Propegating System Varaiables Pin
Blake Miller2-Jun-05 9:30
Blake Miller2-Jun-05 9:30 
GeneralRe: Propegating System Varaiables Pin
Guinness4Strength2-Jun-05 9:39
Guinness4Strength2-Jun-05 9:39 
GeneralRe: Propegating System Varaiables Pin
Blake Miller2-Jun-05 14:11
Blake Miller2-Jun-05 14:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.