I wanted to see if I could bring this defunct open source project called MouseTool up to date with Windows Vista. It's a dwell-clicker to help people (like myself) who experience pain when they click the mouse. This software simulates a click when the mouse pauses at a location on the screen.
我想知道是否可以将这个名为MouseTool的已停止使用的开源项目与Windows Vista保持同步。这是一个帮助人(如我自己)点击鼠标时遇到痛苦的停留点击工具。当鼠标暂停在屏幕上的某个位置时,此软件会模拟单击。
It seems like no one has touched this project in a few years so when I open it up in Visual Studio 2008, I get a ton of errors. I know very little about Visual Studio and was hoping these errors might ring a bell for someone here. Any tips that someone could provide on how I might go about starting to address some of these errors would be appreciated.
似乎没有人在几年内触及过这个项目,所以当我在Visual Studio 2008中打开它时,我收到了大量的错误。我对Visual Studio知之甚少,并且希望这些错误可能会给这里的某个人敲响一席之地。任何人可以提供的关于如何开始解决其中一些错误的提示将不胜感激。
To excerpt an example, this error . . .
为了摘录一个例子,这个错误。 。 。
Error 18 error C2440: 'static_cast' :
cannot convert from 'void (__thiscall COptionsSheet::* )(UINT,POINTS)'
to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
. . . corresponds to this line:
。 。 。对应这一行:
ON_MESSAGE( WM_NCLBUTTONDOWN, OnNCLDown )
from this block:
从这个块:
BEGIN_MESSAGE_MAP(COptionsSheet, CPropertySheet)
//{{AFX_MSG_MAP(COptionsSheet)
ON_WM_HELPINFO()
ON_WM_MOUSEMOVE()
ON_WM_SETCURSOR()
//}}AFX_MSG_MAP
ON_MESSAGE( WM_NCLBUTTONDOWN, OnNCLDown )
ON_MESSAGE( WM_NCLBUTTONUP, OnNCLUp )
ON_BN_CLICKED(ID_HELP, OnHelpButton)
END_MESSAGE_MAP()
Ring a bell for anyone?
给任何人敲钟?
3 个解决方案
#1
The member signatures for certain MFC event handlers were not properly checked in vc6 - code that compiled in error in VC6 needs to be fixed to compile in the updated compiler you are using.
在vc6中未正确检查某些MFC事件处理程序的成员签名 - 需要修复在VC6中错误编译的代码,以便在您正在使用的更新的编译器中进行编译。
The handler for an ON_MESSAGE target needs to conform to this signature:
ON_MESSAGE目标的处理程序需要符合此签名:
afx_msg LRESULT (CWnd::*)(WPARAM, LPARAM).
Your signature is this:
你的签名是这样的:
void (COptionsSheet::* )(UINT,POINTS)
CWnd already has this member anyway:
无论如何CWnd已经有这个成员:
afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
Use that signature instead of your own hand rolled OnNclDown.
使用该签名而不是您自己的手滚动OnNclDown。
Edit: Use ON_WM_NCLBUTTONDOWN instead of ON_MESSAGE for OnNclButtonDown.
编辑:对OnNclButtonDown使用ON_WM_NCLBUTTONDOWN而不是ON_MESSAGE。
#2
The problem is that in the newer versions of Visual Studio, there is tighter checking on the function signatures. The old MFC macro code would let things slip, but they worked.
问题是在较新版本的Visual Studio中,对功能签名进行了更严格的检查。旧的MFC宏代码会让事情失败,但它们起作用了。
To fix the errors, you will need to check each of the messages in the message map and change the methods to match the signature.
要修复错误,您需要检查消息映射中的每条消息,并更改方法以匹配签名。
Edit: WM_NCLBUTTONDOWN
Notification states that it takes a WPARAM
and LPARAM
, which are treated as an int and a pointer to a POINTS structure. So if you change the signature to use WPARAM w, LPARAM l
instead of UINT, POINTS
and then cast the w
and l
parameters to the type, it should be fine.
编辑:WM_NCLBUTTONDOWN通知声明它需要WPARAM和LPARAM,它们被视为int和指向POINTS结构的指针。因此,如果您更改签名以使用WPARAM w,LPARAM l而不是UINT,POINTS然后将w和l参数强制转换为该类型,那么应该没问题。
This is more about making the signatures and functions match up really than changing how they work.
这更多的是使签名和功能真正匹配,而不是改变它们的工作方式。
#3
I ran into the same problem, but my class that is receiving the messages is not derived from CWnd (derived from CWinThread).
我遇到了同样的问题,但我的类,它是接收消息没有从CWnd(来自衍生的CWinThread)的。
Any ideas on what what macro will let me receive a message?
关于什么宏会让我收到消息的任何想法?
Edit: Took me forever to dig through MSDN to find this, but use ON_THREAD_MESSAGE() for classes derived from CWinThread (should have figured this one...).
编辑:让我永远深入挖掘MSDN来找到它,但是对于从CWinThread派生的类使用ON_THREAD_MESSAGE()(应该已经想到了这个......)。
#1
The member signatures for certain MFC event handlers were not properly checked in vc6 - code that compiled in error in VC6 needs to be fixed to compile in the updated compiler you are using.
在vc6中未正确检查某些MFC事件处理程序的成员签名 - 需要修复在VC6中错误编译的代码,以便在您正在使用的更新的编译器中进行编译。
The handler for an ON_MESSAGE target needs to conform to this signature:
ON_MESSAGE目标的处理程序需要符合此签名:
afx_msg LRESULT (CWnd::*)(WPARAM, LPARAM).
Your signature is this:
你的签名是这样的:
void (COptionsSheet::* )(UINT,POINTS)
CWnd already has this member anyway:
无论如何CWnd已经有这个成员:
afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
Use that signature instead of your own hand rolled OnNclDown.
使用该签名而不是您自己的手滚动OnNclDown。
Edit: Use ON_WM_NCLBUTTONDOWN instead of ON_MESSAGE for OnNclButtonDown.
编辑:对OnNclButtonDown使用ON_WM_NCLBUTTONDOWN而不是ON_MESSAGE。
#2
The problem is that in the newer versions of Visual Studio, there is tighter checking on the function signatures. The old MFC macro code would let things slip, but they worked.
问题是在较新版本的Visual Studio中,对功能签名进行了更严格的检查。旧的MFC宏代码会让事情失败,但它们起作用了。
To fix the errors, you will need to check each of the messages in the message map and change the methods to match the signature.
要修复错误,您需要检查消息映射中的每条消息,并更改方法以匹配签名。
Edit: WM_NCLBUTTONDOWN
Notification states that it takes a WPARAM
and LPARAM
, which are treated as an int and a pointer to a POINTS structure. So if you change the signature to use WPARAM w, LPARAM l
instead of UINT, POINTS
and then cast the w
and l
parameters to the type, it should be fine.
编辑:WM_NCLBUTTONDOWN通知声明它需要WPARAM和LPARAM,它们被视为int和指向POINTS结构的指针。因此,如果您更改签名以使用WPARAM w,LPARAM l而不是UINT,POINTS然后将w和l参数强制转换为该类型,那么应该没问题。
This is more about making the signatures and functions match up really than changing how they work.
这更多的是使签名和功能真正匹配,而不是改变它们的工作方式。
#3
I ran into the same problem, but my class that is receiving the messages is not derived from CWnd (derived from CWinThread).
我遇到了同样的问题,但我的类,它是接收消息没有从CWnd(来自衍生的CWinThread)的。
Any ideas on what what macro will let me receive a message?
关于什么宏会让我收到消息的任何想法?
Edit: Took me forever to dig through MSDN to find this, but use ON_THREAD_MESSAGE() for classes derived from CWinThread (should have figured this one...).
编辑:让我永远深入挖掘MSDN来找到它,但是对于从CWinThread派生的类使用ON_THREAD_MESSAGE()(应该已经想到了这个......)。