IniWrite: flush WritePrivateProfileString

Get help with using AutoHotkey and its commands and hotkeys
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

IniWrite: flush WritePrivateProfileString

24 Nov 2018, 18:00

WritePrivateProfileString is the basis for the IniWrite and IniDelete commands.

The AHK source code (script_registry.cpp) uses this, twice:
WritePrivateProfileString(NULL, NULL, NULL, szFileTemp); // Flush
Should it be this or not? Thanks.
WritePrivateProfileString(NULL, NULL, NULL, NULL); // Flush

WritePrivateProfileStringA function | Microsoft Docs
https://docs.microsoft.com/en-us/window ... ilestringa
The system keeps a cached version of the most recent registry file mapping to improve performance. If all parameters are NULL, the function flushes the cache.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
guest3456
Posts: 2981
Joined: 09 Oct 2013, 10:31

Re: IniWrite: flush WritePrivateProfileString

24 Nov 2018, 19:39

if it aint broke, don't fix it?

unless there are some bugs somewhere with IniWrite, i don't know why anything should be changed

User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: IniWrite: flush WritePrivateProfileString

21 Feb 2019, 20:49

- Bump. I'm trying to understand the difference between the 2 code lines above.
- I quoted re. all 4 null parameters, here's a quote re. 3 leading null parameters plus a path:
WritePrivateProfileStringA function | Microsoft Docs
https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-writeprivateprofilestringa
•After following the preceding steps, an application setup program should call WritePrivateProfileString with the first three parameters set to NULL, and the fourth parameter set to the INI file name. For example:

WritePrivateProfileString( NULL, NULL, NULL, L"appname.ini" );

•Such a call causes the mapping of an .ini file to the registry to take effect before the next system reboot. The system rereads the mapping information into shared memory. A user will not have to reboot their computer after installing an application in order to have future invocations of the application see the mapping of the .ini file to the registry.
- Do you know if it's broken? How broken is it?
- Btw this is not just for AHK, this is important for any program that writes to ini files.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot] and 255 guests