1

I have created a program which takes .GIF images, seperates them into seperate files. Then there is a timer which calls a method to read a file in the sequence and changes the wallpaper. I was just wondering if there is anyway I can make this process take less time. (It works, just not fast enough...)

Note: I know this may be unchangeable for the Desktop is not made for this kind of thing, but I'm wondering if there is maybe even an untidy dirty hack in which I could accomplish this...

Windows Forms C# Code:

    private void CreateAllFramesInTemp()
    {
        for (int i = 0; i < TOTALFRAMES; i++)
        {
            GIF.SelectActiveFrame(GIFDIMENSION, i);
            GIF.Save(tempPath + i.ToString() + ".bmp", ImageFormat.Bmp);
        }
        updateInterval.Start();
    }

    private void updateInterval_Tick(object sender, EventArgs e)
    {
        if (currentWallpaperFrame < TOTALFRAMES)
        {
            currentWallpaperFrame += 1;
        }
        else
        {
            currentWallpaperFrame = 1;
        }

        //_-_-_-_-This sets the wallpaper-_-_-_-_//
        SystemParametersInfo(20, 0, tempPath + (currentWallpaperFrame - 1).ToString() + ".bmp", 0x01 | 0x02);

    }

Ask me any questions about the code if you don't know what a specific part is.

Mr_Rockers
  • 29
  • 5
  • Can you show the code where is your `updateInterval` variable defined and initilized? Did you debug the code and/or used the profiler to see what takes the most time? – walther Mar 05 '15 at 23:50
  • 2
    If you're asking how to increase the speed of `SystemParametersInfo`, you can't. It's an API call, and it's going to execute at the speed that Windows decides it should execute. It's absolutely not designed to be used the way you're using it - the desktop wallpaper was never designed to be used for animation. You're also going to be bound by disk I/O, because every file is being loaded from disk. – Ken White Mar 05 '15 at 23:51
  • 1
    Why do you want to animate wallpaper in the first place? That would be extremely distracting and annoying. – Reticulated Spline Mar 05 '15 at 23:55
  • Before you become disheartened, research that API call. I know that you can change the window notification flash speed on the taskbar, something similar might exist for this. – Mathemats Mar 06 '15 at 00:00
  • [_walther_] I know what the interval times are. Its nothing to do with that. [_Ken White_] I guess so... Its not the Disk Read speeds which are limiting it in this case, I don't think... [_Reticulated Spline_] Some people want Nyan-Cat to play in the background. :-) Also, Microsoft release Dreamscene (or something like that) which played **video files.** This, resource wise, is nothing compared. [_Mathemats_] I'm not sure, I dont think so... (https://msdn.microsoft.com/en-us/library/windows/desktop/ms724947%28v=vs.85%29.aspx#Desktop) – Mr_Rockers Mar 06 '15 at 00:44

0 Answers0