WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Registry
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Updating the Registry

Keywords: dllcall update registry  flush 

Question:

I have a small problem: changes made to the registry (with WinBatch or even with RegEdit) are taken into account only after the computer reboot.

I have found something in the Windows 95 Resource Kit Help File, which maybe can help solve the problem. There is a topic called "Recovering Registry Data":

"In Windows 95, data is written to the registry only when a flush occurs - that is, when something happens after changed data has aged more than a few seconds or when an application intentionally flushes the data to the hard disk."

The first "when" is not very clear, but the second one indicates the possibility of "applying" the changes. Do you know any DLL which can accept such FLUSH function ? And if yes, which parameters to send ?

You can use the following example:

Col = RegCreateKey ( @RegCurrent , 'Control Panel\Colors' )
RegSetValue ( Col , '[ActiveTitle]' , '166 202 240' )
RegCloseKey ( Col )
The new value appears in the registry, but is not activated.

Answer:

Rather than a "flush" you need to inform the applications that a color change occurred. Try using the function IntControl (22, p1, p2, p3, p4) It issues a Windows "SendMessage".
;p1	Window handle to send to
;p2	Message ID number (in decimal) 
;p3	wParam value
;p4	assumed to be a character string.  String is copied to a
;	GMEM_LOWER buffer, and a LPSTR to the copied string is
;	passed as lParam. The GMEM_LOWER buffer is freed
;	immediately upon return from the SendMessage
IntControl (22, -1, WMSYSCOLORCHG, 0, "") 


Article ID:   W13741
Filename:   Updating the Registry and Broadcast Message with DllCall.txt
File Created: 2001:01:03:15:05:02
Last Updated: 2001:01:03:15:05:02