用过WOSA/XFS得请进!高分

skyzxg 2005-07-04 04:08:46
WFPRegister

HRESULT WFPRegister(hService,dwEventClass,hWndReg,hWnd,ReqID)
通过指定的hWndReg来激活对指定服务的事件监控;所有指定类别的消息都被发送到hWndReg参数所指定的窗口中。
参数 HSERVICE hService
设备服务供应器的句柄。
DWORD dwEventClass
这是应用程序注册的事件类。以一组位位屏蔽的逻辑或在此参数中被指定。
HWND hWndReg
要注册的窗口句柄,用来接收指定的消息。
HWND hWnd
接收该请求完成信息的窗口句柄。
REQUESTID ReqID
请求识别号。

在此接口中我知简单的回复了WFS_REGISTER_COMPLETE消息
PostMessage(hWnd,WFS_REGISTER_COMPLETE,0,(LPARAM)lpWFSResult);
而没有做其他处理,结果应用接受不到指定的消息接受
...全文
498 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
skyzxg 2005-07-08
  • 打赏
  • 举报
回复
文档已经看过了,不过不知道具体到程序中如何处理
WFPRegister传下来几个参数hWndReg应该是注册的窗口句柄

我使用此句柄发送卡被取走的消息,不成功
::PostMessage(hwndReg, WFS_SRVE_IDC_MEDIAREMOVED, NULL, (LPARAM)lpWFSResult);

WFPRegister中我要对传入的几个参数做什么调用呢,我的源代码中可以说什么都没写
HRESULT extern WINAPI WFPRegister ( HSERVICE hService,
DWORD dwEventClass,
HWND hWndReg,
HWND hWnd,
REQUESTID ReqID)
{
LPWFSRESULT lpWFSResult=new WFSRESULT;
lpWFSResult->hService=hService;
lpWFSResult->RequestID=ReqID;
lpWFSResult->u.dwCommandCode=0;
lpWFSResult->hResult=0;

hwndReg = hWndReg;
PostMessage(hWnd,WFS_REGISTER_COMPLETE,0,(LPARAM)lpWFSResult);

return WFS_SUCCESS;
}
老夏Max 2005-07-05
  • 打赏
  • 举报
回复
参考:http://www.copathway.com/copathway/project_view.asp?prj_id=1239
在这里可以下载WOSA/XFS规范 Ver 2.07。好好读一读规范。做编程的人很多人都不愿意读规范,而注重自己看到的编程结果,这往往是一种错误的、事倍功半的方法!
老夏Max 2005-07-05
  • 打赏
  • 举报
回复
看看WFPRegister调用是否成功。参考:
Error Codes
If the function return is not WFS_SUCCESS, it is one of the following error conditions,
indicating that the asynchronous operation was not initiated. Any service-specific errors that
can be returned are defined in the specifications for each service class.
WFS_ERR_CONNECTION_LOST
The connection to the service is lost.
WFS_ERR_INTERNAL_ERROR
An internal inconsistency or other unexpected error occurred in the XFS subsystem.
WFS_ERR_INVALID_EVENT_CLASS
The dwEventClass parameter specifies one or more event classes not supported by the
service.
WFS_ERR_INVALID_HSERVICE
The hService parameter is not a valid service handle.
WFS_ERR_INVALID_HWND
The hWnd parameter is not a valid window handle.
WFS_ERR_INVALID_HWNDREG
The hWndReg parameter is not a valid window handle.
The following error conditions are returned via the asynchronous command completion
message, as the hResult from the WFSRESULT structure. Any service-specific errors that can
be returned are defined in the specifications for each service class.
WFS_ERR_CANCELED
The request was canceled by WFSCancelAsyncRequest.
WFS_ERR_INTERNAL_ERROR
An internal inconsistency or other unexpected error occurred in the XFS subsystem.
skyzxg 2005-07-05
  • 打赏
  • 举报
回复
自己顶
skyzxg 2005-07-05
  • 打赏
  • 举报
回复
都没人知道吗

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧