如何在 C++ 中将命令行字符串转换为 hwnd?
我想使用 OpenGL 在 C++ 中创建屏幕保护程序。发送到我的应用程序用于在小窗口中预览屏幕保护程序的命令行包含一个数字,该数字是屏幕保护程序控制面板小程序中小监视器窗口的 hwnd
。如何将此字符串转换为有效的 hwnd
?
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
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自信息:屏幕保护程序命令行参数:
因此,请将十进制数转换为
unsigned int
,然后转换为HWND
。例如:其中
argv[n]
是找到 HWND 值的参数。学究角:我对
atoi()
的使用可能还可以改进,因为命令行上的数字是无符号的。随意。From INFO: Screen Saver Command Line Arguments:
So, convert the decimal number to an
unsigned int
and then cast toHWND
. For example: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.