Hi there,

well, no answer is also an answer, hence I just created a little exe
(for a student) that uses the API mentioned in the earlier post, which
might be useful for others as well:

    /*
       purpose: Program to notify the shell that file associations have 
changed, hence
                the icons may need to be refreshed.

       author:  Rony G. Flatscher, WU

       date:    2010-06-30

       license:

    ------------------------ Apache Version 2.0 license 
-------------------------
       Copyright 2010 Rony G. Flatscher

       Licensed under the Apache License, Version 2.0 (the "License");
       you may not use this file except in compliance with the License.
       You may obtain a copy of the License at

           http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing, software
       distributed under the License is distributed on an "AS IS" BASIS,
       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       See the License for the specific language governing permissions and
       limitations under the License.
    
-----------------------------------------------------------------------------

     */

    #include <windows.h>
    #include <stdio.h>

    #include <ShlObj.h>     // get the constant definitions


    int main( int argc, char *argv[] )
    {
        if (argc>1)
        {
            fprintf(stdout, "%s: notify shell that file associations have 
changed. [rgf, WU, 2010-06-30; open-source license: Apache License (AL) 2.0]\n",
                            argv[0]);
            return 0;
        }

        // notify Shell that icons have changed; available from Windows XP on
        SHChangeNotify( SHCNE_ASSOCCHANGED,
                        SHCNF_IDLIST,
                        NULL, NULL);

       return 0;
    }

    // to compile:            cl shell32.lib associationChanged.c

      

It works from Windows XP on.

---rony


On 28.06.2010 23:42, Rony G. Flatscher wrote:
> Hi there,
>
> the WindowsManager class' method broadcastSettingChanged works as designed.
>
> However, if one changes file-associations programmatically the
> iconcache.db is not updated immediately and the changes are not visible
> immediately (and broadcastSettingChanged does not work for
> iconcache.db). It seems to be a known problem, e.g.
> <http://www.google.at/search?hl=de&client=firefox-a&hs=K4g&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&q=iconcache.db+refresh+programmatically+howto&aq=f&aqi=&aql=&oq=&gs_rfai=>.
>
>
> Researching a little bit brought me to
> <http://blogs.sepago.de/e/helge/2007/11/22/free-tool-refresh-the-desktop-programmatically#comment-form>,
> which eventually led to:
> <http://msdn.microsoft.com/en-us/library/bb762118.aspx>, which would be
> an API that would help in this particular situation.
>
> Does anyone know of a way to refresh the iconcache.db on WinXP, Vista
> and W7, other than the above mentioned API?
>
> ---rony
>   

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to