F
Faccey
Unregistered / Unconfirmed
GUEST, unregistred user!
什么是回调消息??<br>在delphi中,创建了一个窗口类,在窗口过程中处理消息,可是好象总是把消息发给自己(使用API),然后自己又接受<br>那不成了死循环了么?<br>代码简单如下:<br><br>。。。。。。。<br>procedure TAppBar.WndProc(var M: TMessage);<br>var<br> State: UINT;<br>begin<br> if M.Msg = AppBarMsg then<br> begin<br> case M.WParam of<br><br> ABN_STATECHANGE:<br> begin<br><br> State := SendAppBarMsg(ABM_GETSTATE);<br> if ABS_ALWAYSONTOP and State = 0 then<br> SetTopMost(False)<br> else<br> SetTopMost(True);<br> end;<br><br> ABN_FULLSCREENAPP:<br> begin<br><br> State := SendAppBarMsg(ABM_GETSTATE);<br> if M.lParam <> 0 then begin<br> if ABS_ALWAYSONTOP and State = 0 then<br> SetTopMost(False)<br> else<br> SetTopMost(True);<br> end<br> else<br> if State and ABS_ALWAYSONTOP <> 0 then<br> SetTopMost(True);<br> end;<br> ABN_POSCHANGED:<br> SetAppBarEdge(FEdge);<br> end;<br> end<br> else<br> inherited WndProc(M);<br>end;<br><br>function TAppBar.SendAppBarMsg(Msg: DWORD): UINT;<br>begin<br> if csDesigning in ComponentState then Result := 0<br> else Result := SHAppBarMessage(Msg, FABD);<br>end;<br>。。。。。。。<br>procedure TAppBar.CreateWnd;<br>begin<br> inherited CreateWnd;<br> FABD.hWnd := Handle;<br> if not (csDesigning in ComponentState) then<br> begin<br> if SendAppBarMsg(ABM_NEW) = 0 then<br> raise EAppBarError.Create('Failed to create AppBar');<br> SetAppBarEdge(FEdge);<br> end;<br>。。。。。。。