yyy Posted August 11, 2004 Share Posted August 11, 2004 Hi, I'm trying to develop a program that shows the user's current screen saver in it,just like the screen saver tab in the display menu.I'm using c# but I don't know how to do it. Please help me.Thanks in advance ;) . Link to comment Share on other sites More sharing options...
0 The_Decryptor Veteran Posted August 29, 2004 Veteran Share Posted August 29, 2004 Yeah, your right, i cant get the name, but i checked and windows cant either, i get "Flying_Windows" in the display control panel list It is because the screen saver has been made wrong, instead of the name of the screensaver being resource 1, it's resource 100 So, i recommend putting in some fail safe code, e.g. check for the name of the screensaver, if the string returned is nothing, then display the name of the screensaver as the file name with the extension cut off Link to comment Share on other sites More sharing options...
0 yyy Posted August 29, 2004 Author Share Posted August 29, 2004 Weird My Windows can read it. Probabaly because it's a default screen saver. Thanks, I'll try to do something like waht you said. Link to comment Share on other sites More sharing options...
0 yyy Posted August 29, 2004 Author Share Posted August 29, 2004 Ok, im done, i have code that can set and retrieve the time-out, i was going to post it earlier, but my browser crashed and i decided to change some stuff.Declarations: ? ?<DllImport("user32", CharSet:=CharSet.Auto)> _ ? ?Private Shared Function SystemParametersInfo(ByVal uAction As Integer, ByVal uParam As Integer, ByRef lpvParam As Integer, ByVal fuWinIni As Integer) As Integer ? ?End Function ? ?Private Const SPI_GETSCREENSAVETIMEOUT = 14 ? ?Private Const SPI_SETSCREENSAVETIMEOUT = 15 ? ?Private Const SPIF_UPDATEINIFILE = &H1 ? ?Private Const SPIF_SENDWININICHANGE = &H2 Code: ? ?Public Function GetScreenSaverTimeOut() As Integer ? ? ? ?Dim lRet As Integer ? ? ? ?Dim lSeconds As Integer ? ? ? ?lRet = SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, lSeconds, 0) ? ? ? ?If lRet > 0 Then ? ? ? ? ? ?GetScreenSaverTimeOut = lSeconds / 60 ? ? ? ?Else ? ? ? ? ? ?GetScreenSaverTimeOut = -1 ? ? ? ?End If ? ?End Function ? ?Public Function SetScreenSaverTimeOut(ByVal NewValueInMinutes As Integer) As Boolean ? ? ? ?Dim lRet As Integer ? ? ? ?Dim lSeconds As Integer ? ? ? ?lSeconds = NewValueInMinutes * 60 ? ? ? ?lRet = SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, lSeconds, Nothing, SPIF_UPDATEINIFILE + SPIF_SENDWININICHANGE) ? ? ? ?SetScreenSaverTimeOut = lRet <> 0 ? ?End Function It's pretty much self explanatory. Also, yyy, if you want to see the similarities between vb.net and c#, i recommend you get a copy of .NET Reflector, it's a fully working Disassembler and De-compiler for .net, it allows you to choose from multiple languages, e.g. De-compile a vb app into c#, or vice-versa, it's really good. Also 2, since you and weenur have been so good, and since im feeling generous, pm me if you:Dant a gmail account (I'm feeling generous because i got 6 invites today :D ) Edit: I'll need your names and e-mail address's to send the invites. Can you convert it to c# ? I can't convert it. I get a lot of error messages. Link to comment Share on other sites More sharing options...
0 The_Decryptor Veteran Posted August 29, 2004 Veteran Share Posted August 29, 2004 What code do you get error's with, cause im sort of running out of time on the net and i wont be back on for about 2 or 3 weeks. Link to comment Share on other sites More sharing options...
0 yyy Posted August 29, 2004 Author Share Posted August 29, 2004 Almost all. I tried this: [DllImport("user32", CharSet=CharSet.Auto)] ?private static int SystemParametersInfo(int uAction, int uParam, ref int lpvParam, int fuWinIni) ?{ ?} private const void SPI_GETSCREENSAVETIMEOUT = 14; ?private const void SPI_SETSCREENSAVETIMEOUT = 15; ?private const void SPIF_UPDATEINIFILE = 1; ?private const void SPIF_SENDWININICHANGE = 2; int lRet; ? int lSeconds; ? lSeconds = NewValueInMinutes * 60; ? lRet = SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, lSeconds, null, SPIF_UPDATEINIFILE + SPIF_SENDWININICHANGE); ? SetScreenSaverTimeOut = lRet != 0; But it tells me that there's a poblem with the void. So I replaced it with int. Then it says that this : [DllImport("user32", CharSet=CharSet.Auto)] line is wrong and many others. I just don't know how to write it in c#. PS - it is sad to know that you won't be here for a l:(g time :( Link to comment Share on other sites More sharing options...
0 The_Decryptor Veteran Posted August 29, 2004 Veteran Share Posted August 29, 2004 Yeah, I'm sad about that to (damn financial situation (and family problems) i can afford broadband, but i get told i cant afford it, so im stuck on pre-paid dial-up) Also, since i don't know much about c#, i realised i cant help you with that, your probably going to have to wait until weenur comes back and reads the thread (looks like i cant help you with much more now) So, ill be back in about 2 or 3 weeks (maybe more :angry: ) Link to comment Share on other sites More sharing options...
0 azcodemonkey Posted August 29, 2004 Share Posted August 29, 2004 Exclude the {} from your import, and add a ; to the end of the declaration. Also, it should be private static extern int SystemParametersInfo(... etc ... ); Link to comment Share on other sites More sharing options...
0 yyy Posted August 29, 2004 Author Share Posted August 29, 2004 I don't know how I lived without broadband :D I'm now connected all day. Sorry for you :rolleyes: I'll try wuneers way later. Link to comment Share on other sites More sharing options...
0 Chad.C Posted August 29, 2004 Share Posted August 29, 2004 I sure hope you putting TD and Wuneer in the credits yyy. They seem to have helped you a lot in the dvlopment of this plugin.. Great work guys.. Makes me proud to have such fine people helping eachother out... Link to comment Share on other sites More sharing options...
0 yyy Posted August 29, 2004 Author Share Posted August 29, 2004 I want to put them in the credits but I don't know their real names. I can't just write wuneer and The_Decryptor. I'll do it if they want :laugh: They are really great and really helpful :laugh: Thanks again ;) Link to comment Share on other sites More sharing options...
0 yyy Posted August 29, 2004 Author Share Posted August 29, 2004 Exclude the {} from your import, and add a ; to the end of the declaration. Also, it should be private static extern int SystemParametersInfo(... etc ... ); Works better than anything :laugh: :D Thank you very very very much !!! Link to comment Share on other sites More sharing options...
0 Nelsinho Posted August 30, 2004 Share Posted August 30, 2004 http://www.harding.edu/USER/fmccown/WWW/sc...creensaver.html hello weenur, thanks a lot for this link. Link to comment Share on other sites More sharing options...
0 yyy Posted August 30, 2004 Author Share Posted August 30, 2004 I've released my program about the screen saver :laugh: I've included weenur and The_Decryptor names in it. Thanks guys :happy: Link to comment Share on other sites More sharing options...
0 yyy Posted September 1, 2004 Author Share Posted September 1, 2004 Just one more small thing - How do I activate the screen saver? I know how to run it as a preview but it doesn't show the Welcome Screen even when it is set to do it. How can I do it else? Link to comment Share on other sites More sharing options...
0 darkmark327 Posted September 1, 2004 Share Posted September 1, 2004 By design, previewing a screensaver will not activate the password protection. Link to comment Share on other sites More sharing options...
0 yyy Posted September 1, 2004 Author Share Posted September 1, 2004 I want it to activate the password protectction. How can I do it? Link to comment Share on other sites More sharing options...
0 yyy Posted September 2, 2004 Author Share Posted September 2, 2004 Anyone? I'm using c# and I try to run a screen saver but when it is disactivated it doesn't show the Welcome Screen even though it is set to show it. How can I activate the screen saver? Link to comment Share on other sites More sharing options...
0 darkmark327 Posted September 2, 2004 Share Posted September 2, 2004 You can't. http://support.microsoft.com/default.aspx?...kb;en-us;228160 What you might do is manually lock the workstation (rundll32 user32.dll,LockWorkStation) before showing the screensaver. Link to comment Share on other sites More sharing options...
0 yyy Posted September 2, 2004 Author Share Posted September 2, 2004 :no: :no: :no: It isn't what I ment: The information in this article applies to:Microsoft Windows 2000 Server Microsoft Windows 2000 Advanced Server Microsoft Windows 2000 Professional Microsoft Windows 2000 Datacenter Server That page relates to non Winodws XP versions. These versions doesn't even have the Welcome Screen. I did it once and it worked. I think I just need to use an API but how? I believe that runnung a screen saver using an API will do it. Link to comment Share on other sites More sharing options...
0 yyy Posted September 3, 2004 Author Share Posted September 3, 2004 Anyone? Does Nobody knows how to launch the screen saver using an API ? Link to comment Share on other sites More sharing options...
0 yyy Posted September 3, 2004 Author Share Posted September 3, 2004 And one more thing - can I lauch a screensaver's settings menu with Process.Start() ? How? I tried Process.Start("c:\window\system32\ss3d.scr" + "/c") but it just showed it in full mode :( Can I make it with process? I want my program to do something when the process exites so that's why I'm asking. Link to comment Share on other sites More sharing options...
0 yyy Posted September 3, 2004 Author Share Posted September 3, 2004 And one more thing - can I lauch a screensaver's settings menu with Process.Start() ? How? I tried Process.Start("c:\window\system32\ss3d.scr" + "/c") but it just showed it in full mode :( Can I make it with process? I want my program to do something when the process exites so that's why I'm asking. I found out how to do it :laugh: Now - Does somebody know how to activate a screensaver using an API? In c#? Link to comment Share on other sites More sharing options...
0 yyy Posted September 3, 2004 Author Share Posted September 3, 2004 Oh my Muh!!I am wrong in the begining.. it looks as I had better study English hard you can use this PostMessage(WM_SYSCOMMAND,SC_SCREENSAVE,0); to act current ScreenSaver I think you want to get current Screen picture at the begining. faint~ this is the code; Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32 ? ?Private Const HWND_BROADCAST = &HFFFF& ? ?Private Const WM_SYSCOMMAND = &H112 ? ?Private Const SC_SCREENSAVE = &HF140& ? ?Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ? ? ? ?SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_SCREENSAVE, 0) ? ?End Sub I use VB more than C#. So this code is in VB style. T:laugh:korls :laugh: Link to comment Share on other sites More sharing options...
0 The_Decryptor Veteran Posted September 7, 2004 Veteran Share Posted September 7, 2004 congrats on getting it working, it looks like a cool tile, and although you weren't going to do it on longhorn, it think it would work very well (and be popular) Also, thanks for putting my name in your program, i think that is one of the first programs with my name in it (other than my own) Link to comment Share on other sites More sharing options...
0 yyy Posted September 7, 2004 Author Share Posted September 7, 2004 congrats on getting it working, it looks like a cool tile, and although you weren't going to do it on longhorn, it think it would work very well (and be popular)Also, thanks for putting my name in your program, i think that is one of the first programs with my name in it (other than my own) Hi The_Decryptor :laugh: :happy: I missed you :D As you can see I didn't get much help without you :laugh: But I managed to find out the solutions myself. So far I got around 500 downloads but I hopee that after releasing the 2nd version of it I'll get more. Link to comment Share on other sites More sharing options...
Question
yyy
Hi,
I'm trying to develop a program that shows the user's current screen saver in it,just like the screen saver tab in the display menu.I'm using c# but I don't know how to do it.
Please help me.Thanks in advance ;) .
Link to comment
Share on other sites
150 answers to this question
Recommended Posts