WFPRegisterHRESULT 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);
而没有做其他处理,结果应用接受不到指定的消息接受
通过指定的hWndReg来激活对指定服务的事件监控;所有指定类别的消息都被发送到hWndReg参数所指定的窗口中。
参数 HSERVICE hService
设备服务供应器的句柄。
DWORD dwEventClass
这是应用程序注册的事件类。以一组位位屏蔽的逻辑或在此参数中被指定。
HWND hWndReg
要注册的窗口句柄,用来接收指定的消息。
HWND hWnd
接收该请求完成信息的窗口句柄。
REQUESTID ReqID
请求识别号。在此接口中我知简单的回复了WFS_REGISTER_COMPLETE消息
PostMessage(hWnd,WFS_REGISTER_COMPLETE,0,(LPARAM)lpWFSResult);
而没有做其他处理,结果应用接受不到指定的消息接受
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.
在这里可以下载WOSA/XFS规范 Ver 2.07。好好读一读规范。做编程的人很多人都不愿意读规范,而注重自己看到的编程结果,这往往是一种错误的、事倍功半的方法!
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;
}