I've written a screen saver in C# but whenever I run it on preview mode or let it kick in, it throws an exception. When I double click it in Windows\System32 it runs fine. With the Visual studio debugger I sussed out that it doesn't read the .config file of the application, which is also in Windows\System32.
I think that when rundll32.exe executes the screen saver, the app.config file is being omitted. Is there a way to force it to load?
Thanks
Thanks to those who recommended SysInternals' Process Monitor. Using that, I saw that it's looking for an 8-letter version of the config filename. It's the first six letters of the SCR file then ~1.scr, because that's the name of the process. All I have to do is rename the file or, rather keep 2 versions of it as I don't want to change the name of the scr file.
As far as I remember from my previous experience, screen savers run with its "current directory" set to %userprofile%. You may check if it is true or not by temporarily placing your config file into that directory. And if it happens to be true then you have to add code to read your config from the directory in which your screen saver sits, not from its current directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With