View Single Post
Old Mar 25th, 2006, 8:03 AM   #9
Pedja
Programmer
 
Join Date: Nov 2005
Location: Belgrade, Serbia & Montenegro
Posts: 31
Rep Power: 0 Pedja is on a distinguished road
Send a message via ICQ to Pedja Send a message via MSN to Pedja Send a message via Yahoo to Pedja
It works! The SendMessageTimeout function does the trick.
private static extern long SendMessageTimeout(
	int hWnd,
	int Msg,
	int wParam,
	string lParam,
	int fuFlags,
	int uTimeout,
	out int lpdwResult
);
RegistryKey k = Registry.CurrentUser.OpenSubKey("Control Panel").OpenSubKey("Desktop").OpenSubKey("WindowMetrics", true);
k.SetValue("Shell Icon Size", "33");
k.Flush(); k.Close();

int res = 0;
SendMessageTimeout(0xffff, 0x001A, 0, "", 0x0002, 5000, out res);

k = Registry.CurrentUser.OpenSubKey("Control Panel").OpenSubKey("Desktop").OpenSubKey("WindowMetrics", true);
k.SetValue("Shell Icon Size", "32");
k.Flush(); k.Close();

SendMessageTimeout(0xffff, 0x001A, 0, "", 0x0002, 5000, out res);
This function specifies the timeout period. After 5 seconds (in this case) program returns from the function, and icons are reloaded.
I still don't understand why the program never returned from SendMessage function, but it's not so important.
Thanks a lot.
Pedja is offline   Reply With Quote