按下Win API C ++按钮 [英] Handle Win API C++ button press
问题描述
我想在原生窗口中处理c ++ win32 API按钮,我现在正在尝试这样做 -
http://pastie.org/10845044< - 代码可以在这里找到,http://stackoverflow.com/questions/37342605/win32-c-handle-button-press-peekmessage-not-工作 - 为SO帖子
当我加载OBS时,包括 dll
发生的是 -
- OBS开始
- Window pops u
- 我点击窗口
- 什么都没发生
其中在第4步,点击按钮后,MessageBox应该弹出说 - MessageBox(hWnd,
if if into into the else,if if statement  ;
L" else",L" else",0); 是
然后
true MessageBox(hWnd,
L" if",L" if",0);
但是我的代码甚至不会进入回调函数,为什么会这样?
从粗略看看stackoverflow上的代码看来,窗口类的注册注册了一个窗口过程名称WndProc。然而,显示的代码在一个名为WindowProcedure的函数中。
假设您的代码已针对所指出的错误(包括按钮单击处理)进行了更正并实际编译并运行,则WindowProcedure函数将永远不会被调用,因为它是在类注册中指定的WndProc。
当然,如果你发布了你在这里使用的ACTUAL代码会更好。
I want to handle a c++ win32 API button press in a native window, I'm currently attempting doing it like so -
http://pastie.org/10845044 <- code can be found here,http://stackoverflow.com/questions/37342605/win32-c-handle-button-press-peekmessage-not-working - for the SO post
When I currently load OBS, after having included the dll
what
happens is -
- OBS starts
- Window pops u
- I click on window
- Nothing happens
where on step 4, right after clicking on the button a MessageBox should popup saying - MessageBox(hWnd,
L"else", L"else", 0);
if it goes into the else, and if the if statement is
true
then MessageBox(hWnd,
L"if", L"if", 0);
However my code won't even enter the callback function, why is this?
From a cursory look at the code on stackoverflow it appears that the registration of the window class registers a window procedure name WndProc. However, the code displayed is in a function named WindowProcedure.
Assuming that your code was corrected for the errors noted (including button click handling )and actually compiles and runs, the WindowProcedure function will never be called since it is WndProc that is specified in the class registration.
Of course it would be better if you posted the ACTUAL code you are using here.
这篇关于按下Win API C ++按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!