I want to create a screen saver in C++ using OpenGL. The command line sent to my app for previewing the screen saver in a small window contains a number which is the hwnd
of the small monitor window in screen saver control panel applet. how can I convert this string to a valid hwnd
?
Asked
Active
Viewed 2,831 times
4

Sangeeth Saravanaraj
- 16,027
- 21
- 69
- 98

Sina
- 41
- 1
- 2
1 Answers
5
From INFO: Screen Saver Command Line Arguments:
<HWND>
is a HWND presented on the command line as an unsigned decimal number.
So, convert the decimal number to an unsigned int
and then cast to HWND
. For example:
(HWND)atoi(argv[n])
where argv[n]
is the argument where the HWND value is found.
Pedant's corner: My use of atoi()
can probably be improved, since the number on the command line is unsigned. Feel free.

Greg Hewgill
- 951,095
- 183
- 1,149
- 1,285
-
1Duct Tape Programmer (TM)- certified design :) – Kos Dec 29 '11 at 08:46
-
here it is: HWND h = atoi(argv[5]); – blaze Dec 29 '11 at 08:53