🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

scrnsaver: how to get info from dialog?

Started by
2 comments, last by digburton 24 years, 1 month ago
I''ve been writing opengl stuff for a few months now, but I''m no windows programmer. Is there a tutorial or example somewhere of how to grab info entered into the configuration dialog box of a screensaver? Please help! Thanks. -digburton
-digburton
Advertisement
I really have no idea,
check out at codeguru.com to see if there''s something about it.

When I went to write a screen saver, I could never find any information that allowed writing a screen saver without MFC. However, I did find out that a screen saver is just a regular executable with the extension changed to .scr

So, that being said, here''s how I went about finding out what it was telling me...

I wrote a little app that captured the command line that was passed to it and would save that information. Then, I renamed it with an .scr extension and pretended it was a screensaver.

There are a couple different ones, and I don''t remember them all (I didn''t use the one for the password), but if you want to look at what I did, the screen saver is on my site and it''s got the source as well. The source is a couple years old, and pretty ugly, but if you look through the WinMain portions of it, most of what you need should be there. One other thing about the command line is that all the numbers you get passed are window handles (if I remember correctly) for the relevant parts of the display properties dialog.

BTW, you also have to create your own "Configuration" dialog. I assume what you were really asking about was the display properties dialog. I also never figured out (nor cared since I didn''t want to do windowed direct draw) how to put something in that little window.

Hope that helps.

Mark Fassett
Laughing Dragon Entertainment
http://www.laughing-dragon.com

Mark Fassett

Laughing Dragon Games

http://www.laughing-dragon.com

I have never written a screen saver myself, but I assume it would work exactly like other dialogs. I guess you are not using MFC as it does all the data exchange between classes for you. I can''t speak for the Borland object model as I have not used it.

If you are doing it all in Win32...

To get the values from items on a dialog without using MFC use the SendDlgItemMessage function. It returns different data depending on the message you send. For instance if you are using a combo box you could send the messages...

CB_GETCURSEL with wParam and lParam set to 0, this will return the index of the selected item.

CB_GETITEMDATA with the wParam set to the index of the selected item you got above.

Code.. (from memory, may need to be tweaked)
index = SendDlgItemMessage(hDlg, COMBO1, CB_GETCURSEL, 0, 0);
data = SendDlgItemMessage(hDlg, COMBO1, CB_GETITEMDATA, index, 0);

Different dialog items need different messages to be sent to them, for more information I suggest looking in the help file


Hope this helps.

This topic is closed to new replies.

Advertisement