to fancier(OP&&(C/C++)) : MM_JOY1MOVE不用自己定义,mmsystem.pas里已经有了,自己定义反而收不到消息。
我已经捕捉了joySetCapture,而且提示"捕捉成功"了,我用的方法如下:procedure TForm1.WndProc(var Msg: TMessage); var CallInherited: Boolean; begin CallInherited := True; if Msg.Msg = MM_JOY1MOVE then begin showmessage('11'); end; if CallInherited then inherited WndProc(Msg); end;我移动腰杆,但是没有反应,事实可以证明,当事件为其他时候响应的,但是摇杆没有反应
我刚刚学习delphi,大家帮帮忙阿
type
form1:=class(Tform)
...
public
...
privite
procedure mymsgproc(参数列表);
message MM_JOY1MOVE;
end;
implementation
procedure Tform1.mymsgproc(参数列表);
begin
这里添加你的code
end;
....
end.
unit unit1
type
form1:=class(Tform)
...
public
...
privite
procedure mymsgproc(msg:Tmessage);
message MM_JOY1MOVE;
end;
implementation
procedure Tform1.mymsgproc(msg:Tmessage);
begin
这里添加你的code
end;
....
end.
unit unit1
cosnt
MM_JOY1MOVE = WM_USER+100; // 加上这句type
form1:=class(Tform)
...
public
...
privite
procedure mymsgproc(msg:Tmessage);
message MM_JOY1MOVE;
end;
implementation
procedure Tform1.mymsgproc(msg:Tmessage);
begin
这里添加你的code
end;
....
end.
joySetCapture(Handle, JOYSTICKID1, 0, False);
const //
MM_JOY1MOVE = WM_USER+100; 使用的时候用 PostMessage 或 SendMessage 把消息发送到目标就行。
MM_JOY1MOVE不用自己定义,mmsystem.pas里已经有了,自己定义反而收不到消息。
var
CallInherited: Boolean;
begin
CallInherited := True;
if Msg.Msg = MM_JOY1MOVE then
begin
showmessage('11');
end;
if CallInherited then inherited WndProc(Msg);
end;我移动腰杆,但是没有反应,事实可以证明,当事件为其他时候响应的,但是摇杆没有反应