4

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?

Sangeeth Saravanaraj
  • 16,027
  • 21
  • 69
  • 98
Sina
  • 41
  • 1
  • 2

1 Answers1

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