|
TAPI编程,lineGetID返回正确,但是得到的Modem句柄为NULL
[复制链接]
HANDLE ONetwork::GetCommPort(int p_iSessionID)
{
DWORD dwSize = sizeof(VARSTRING);
DWORD dwReturn;
LPVARSTRING lpVarString =(LPVARSTRING)LocalAlloc(LPTR, dwSize);
if(lpVarString == NULL)
return NULL;
lpVarString->dwTotalSize = dwSize;
do{
dwReturn = lineGetID(m_hLine,
0, // address ID ignored
NULL,
LINECALLSELECT_LINE,// we're only passing a line handle
lpVarString,
_T("comm/datamodem"));
if(dwReturn != 0)
{
cout<<_T("Could not get line ID")<
return NULL;
}
if(lpVarString->dwNeedSize>lpVarSring->dwTotalSize)
{
dwSize=lpVarString->dwNeedSize;
free(lpVarString);
lpVarString =(LPVARSTRING)LocalAlloc(LPTR, dwSize);
continue;
}
break;
}while(true);
LPHANDLE lpHandle = (HANDLE*)((LPBYTE)
lpVarString + lpVarString->dwStringOffset);
HANDLE hComm = *lpHandle;
return hComm;
}
此函数中lineGetID返回为0,即成功,可是hComm却为NULL,不知道我错在哪里,请大家多多指教,不尽感激。
由于本人刚注册帐号,现在积分只有16分了,请大家看在我第一次发帖的份上,多多帮助新手。谢谢。
|
|