本文介绍了讨厌的CreateWindow wcex.lpszClassName的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用消息窗口创建DLL时回头,我曾经有段时间正确地将wcex.lpszClassName加载为带引号的字符串.

一段时间以来,它一直是带引号的字符串wcex.lpszClassName =(LPCTSTR)"MyMessageWindow",但是现在我将敏感"字符串编码为base64,并且再次加载wcex.lpszClassName会导致出现未创建的窗口的麻烦.

下面的结果导致一个空的wcex.lpszClassName,其中Dec()是Base64解码器,它接受std :: string并返回这种类型.

Dec("TXlNZXNzYWdlV2luZG93").c_str();

也是这样:

reinterpret_cast<(LPCTSTR)>(Dec("TXlNZXNzYWdlV2luZG93").c_str());

其他所有情况都会导致编译器类型转换错误. Dec()解码器
有效,并且确实返回"MyMessageWindow".

可能是什么问题?

:

Way back when creating my DLL with a message window I had the devil of a time properly loading the wcex.lpszClassName with anything but a quoted string.

It''s been a quoted string wcex.lpszClassName = (LPCTSTR)"MyMessageWindow" for some time but now I am encoding "sensitive" strings to base64 and loading wcex.lpszClassName is trouble again resulting in an uncreated window.

The following results in a empty wcex.lpszClassName, Where Dec() is the Base64 decoder that accepts std::string and returns such a type as well.

Dec("TXlNZXNzYWdlV2luZG93").c_str();

So does this:

reinterpret_cast<(LPCTSTR)>(Dec("TXlNZXNzYWdlV2luZG93").c_str());

Everything else causes a compiler type conversion error. The Dec() decoder
works and is indeed returning "MyMessageWindow".

What might be wrong?

:

推荐答案

std::string sClass = Dec("TXlNZXNzYWdlV2luZG93");
wcex.lpszClassName = sClass.c_str();
RegisterClassEx( &wcex );


这篇关于讨厌的CreateWindow wcex.lpszClassName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 13:37