• 0

C# Screen saver?


Question

Recommended Posts

  • 0

(using Microsoft.Win32)

string screenSaver

try
{
    screenSaver = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop").GetValue("SCRNSAVE.EXE").ToString
catch
{
    // no screensaver selected
}

This gets the filename of the current screensaver. I don't know how to get the 'friendly' name of the screensaver, though.

Link to comment
https://www.neowin.net/forum/topic/202313-c-screen-saver/#findComment-584349341
Share on other sites

  • 0

Are you doing this? (from that page I linked to)

Note the string[] cmdList. It splits off of a space. Also note that if the cmdList[1] is "/p" then cmdList[2] is the handle to the parent.

static void Main()

{

       string[] cmdList = Environment.CommandLine.Split(' ');



       // First command-line param is the exe name, second param is the mode



       if (cmdList.Length >= 2) {

              if (cmdList[1].IndexOf("/c") >= 0) {        // Configuration mode

                     Application.Run(new OptionsForm());

                     return;

              }



              parentHwnd = IntPtr.Zero;

                          

              if (cmdList[1] == "/p") {               // Preview mode

                     previewMode = true;



                     // Handle to preview dialog box is next command-line param

                     parentHwnd = (IntPtr) uint.Parse(cmdList[2]);

              }

       }



       Application.Run(new ScreenSaverForm());

}

Link to comment
https://www.neowin.net/forum/topic/202313-c-screen-saver/#findComment-584416385
Share on other sites

  • 0

The site you gave me shows how to create a new custom screen saver. I want to be able to show the current user's screen saver inside my application. The example you give refers only to a real screen saver. It doesn't show how to show any screen saver in preview mode. Do you know how to do that ?

Link to comment
https://www.neowin.net/forum/topic/202313-c-screen-saver/#findComment-584416405
Share on other sites

  • 0

A dll written in c

I have tried playing around with stuff in screen-savers, i don't know how windows gets the name, i have found string resources in the scr's resources section, but they are only used when the screen-savers files are in the 8.3 format (i think, it's been a while, it got me fed up so i stopped)

Link to comment
https://www.neowin.net/forum/topic/202313-c-screen-saver/#findComment-584416639
Share on other sites

  • 0

The problem with doing this is that a screen saver is an exe, not a dynamic linking library(dll). You can't really use platforrm invoke with an exe. You have to invoke the ScreenSaverProc of the scr file, passing in the WM_CREATE message along with the handle to the picturebox that you want to have it previewed in.

If someone wrote a dll that exported a screensaver loader function, then you could do it easily... I may just do that as I'm in project burn out mode at the moment. I doubt it would take that long.(famous last words)

Link to comment
https://www.neowin.net/forum/topic/202313-c-screen-saver/#findComment-584416683
Share on other sites

  • 0
  yyy said:
Oh, thanks. What do you mean how windows gets the name ? I know how to get the current screen saver :)

The name that appears in the combo-box in the display properties window.

Also, i think exe files can have functions exported, i think i can remember doing it with a linker override thing in vb6

Link to comment
https://www.neowin.net/forum/topic/202313-c-screen-saver/#findComment-584416707
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • More Microsoft Account headaches: Office 2024 licensing bug finally gets detailed fix by Sayan Sen Microsoft often highlights the benefits of a Microsoft account (MSA) as it points out the unified access users get across devices and services like Windows, Office, OneDrive, and Xbox, which can help in synchronization of files and settings for convenience. That is also why it is a mandatory requirement during Windows 11 installs. However, there can be major problems too. For example, earlier this month, we reported on an incident wherein a Windows user was locked out of their Microsoft Account when Windows flagged their OneDrive upload activities, and apparently there was no way to recover their account. We discussed how, in such a case, users can lose all their data, especially if it's BitLocker encrypted, which is not all that unlikely on Windows 11 24H2. You can read the story in full in this article here. Meanwhile, on the topic of MSA, Microsoft has finally released a detailed step-by-step guide for fixing the Office 2024 licensing bug. The tech giant had already published an update earlier back in December last year. While that was supposed to fix the issue, the problem likely persisted for many users. For those who need a refresher, users whose Microsoft accounts held licenses for both Office 2024 and earlier editions like Office 2021. After upgrading to Office 2024, the MSA continued to display the older version. At the time, Microsoft only stated that installing the latest version of the Office 2024 app would fix the issue. This week, though, a detailed guide has been shared. The company writes: You can find the support article here on Microsoft's official website.
    • Hey Neowin folks, I’m struggling with my Samsung QLED Q80C smart TV’s Wi-Fi dropping randomly. It connects to my 5GHz network but loses signal every 20–30 minutes, interrupting streaming. Details: Device: Samsung QLED Q80C (2023 model), Tizen OS, firmware updated to latest (May 2025). Network: TP-Link Archer AX73 router, Wi-Fi 6, 5GHz band, WPA3 security. Environment: TV ~10 feet from router, no major interference (tested without microwave or cordless phones). Setup: Streaming Netflix, YouTube via built-in apps; issue persists across apps. Steps Tried: Restarted TV, router, and modem. Switched to 2.4GHz band—same issue, slower speed. Assigned static IP to TV in router settings. Reset TV network settings and reconnected. Checked router logs; no disconnect errors logged. Searched Neowin; found a 2024 thread on Wi-Fi issues but no TV-specific fixes. Expected: Stable Wi-Fi connection for uninterrupted streaming. Actual: Wi-Fi drops every 20–30 minutes, requiring manual reconnect. Has anyone faced Wi-Fi dropouts on Samsung QLED TVs or Tizen OS? Could it be a firmware bug or router setting? Any debug tips or workarounds? Thanks for any ideas!
    • I can see why you would need an AI browser
    • if you get your MSA locked and can't recover it, and if you are on win 11 24H2 that can do automatic encryption (on Home editions too), then the BitLocker key goes with that account.
  • Recent Achievements

    • Conversation Starter
      sophiaisabella32 earned a badge
      Conversation Starter
    • First Post
      Brett76 earned a badge
      First Post
    • One Year In
      78andyp earned a badge
      One Year In
    • One Month Later
      Cottonbud earned a badge
      One Month Later
    • One Month Later
      langat earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      594
    2. 2
      ATLien_0
      219
    3. 3
      Michael Scrip
      191
    4. 4
      +FloatingFatMan
      146
    5. 5
      Xenon
      135
  • Tell a friend

    Love Neowin? Tell a friend!