C++记录鼠标释放
我试图让一个程序在释放鼠标左键并且仅释放时写入文本文件。下面是我尝试过的代码。 GUI 中有一个滑块,用户可以前后移动来放大和缩小视频。我希望能够只获取用户停止的值。目前,它打印起始值和停止值以及其间的所有值。我认为让它在鼠标释放时打印停止值会起作用。目前它仍然只打印所有信息,而不仅仅是鼠标释放的信息。
if(WM_LBUTTONUP)
{
myfile1.open("testing.txt", std::ios_base::app);
myfile1 << "testing";
myfile1 << "\n";
myfile1.close();
}
I am trying to get a program to write to a text file when the left button on the mouse is released, and only released. Below is the code that I have tried. In the GUI there is a slider that the user can move back and forth to zoom in and out on a video with. I want to be able to grab just the value the user stops at. Currently it prints the starting and stopping values as well as all the values in between. I thought that getting it to print the stopping value on the mouse release would work. Currently it still just prints all the info not just on the mouse release.
if(WM_LBUTTONUP)
{
myfile1.open("testing.txt", std::ios_base::app);
myfile1 << "testing";
myfile1 << "\n";
myfile1.close();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的条件始终为真,因为
WM_LBUTTONUP
是一个非零常量。您应该比较 WindowProc 回调。Your condition is always true because
WM_LBUTTONUP
is a non-zero constant. You should compare auMsg == WM_LBUTTONUP
in your WindowProc callback.