以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 来电显示器问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=44134) |
-- 作者:whoami2012 -- 发布时间:2013/12/24 9:19:00 -- 来电显示器问题 购买了来电显示器,其vb.net例程中,有如下打开设备的代码: \'在windowproc处理接收到的消息 BriSDKLib.QNV_Event(i, BriSDKLib.QNV_EVENT_REGWND, CType(Me.Handle, Int32), "", New StringBuilder(0), 0) 其中Me.Handle是获取窗体的句柄,在FT中要如何改写? 问题已解决,请看27楼。
[此贴子已经被作者于2013-12-25 14:01:47编辑过]
|
-- 作者:Bin -- 发布时间:2013/12/24 9:23:00 -- basemainform.Handle 看看 |
-- 作者:whoami2012 -- 发布时间:2013/12/24 9:57:00 -- 可以了,感谢! 再请教一下,这个来电显示盒是USB口的,需要接收窗体消息。VB.net范例中是如下代码: Protected Overrides Sub DefWndProc(ByRef m As System.Windows.Forms.Message) Select Case m.Msg Case BriSDKLib.BRI_EVENT_MESSAGE If True Then Dim EventData As BriSDKLib.TBriEvent_Data = DirectCast(Marshal.PtrToStructure(m.LParam, GetType(BriSDKLib.TBriEvent_Data)), BriSDKLib.TBriEvent_Data) Dim strValue As String = "" Select Case EventData.lEventType Case BriSDKLib.BriEvent_PhoneHook If True Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":电话机摘机" End If Exit Select Case BriSDKLib.BriEvent_PhoneHang If True Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":电话机挂机" End If Exit Select Case BriSDKLib.BriEvent_CallIn If True Then \'两声响铃结束后开始呼叫转移到CC strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":来电响铃" End If Exit Select Case BriSDKLib.BriEvent_GetCallID If True Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":接收到来电号码 " & FromASCIIByteArray(EventData.szData) End If Exit Select Case BriSDKLib.BriEvent_StopCallIn If True Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":停止呼入,产生一个未接电话 " End If Exit Select Case BriSDKLib.BriEvent_GetDTMFChar strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":接收到按键 " & FromASCIIByteArray(EventData.szData) Exit Select Case BriSDKLib.BriEvent_RemoteHang If True Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":远程挂机 " End If Exit Select Case BriSDKLib.BriEvent_Busy If True Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":接收到忙音,线路已经断开 " End If Exit Select Case BriSDKLib.BriEvent_DialTone strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":检测到拨号音 " Exit Select Case BriSDKLib.BriEvent_PhoneDial strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":电话机拨号 " & FromASCIIByteArray(EventData.szData) Exit Select Case BriSDKLib.BriEvent_RingBack strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":拨号后接收到回铃音 " Exit Select Case BriSDKLib.BriEvent_DevErr If True Then If EventData.lResult = 3 Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":设备可能被移除 " End If End If Exit Select Case Else Exit Select End Select If strValue.Length > 0 Then AppendStatus(strValue) End If End If Exit Select Case Else MyBase.DefWndProc(m) Exit Select End Select End Sub 在FT中应该写在哪呢?
|
-- 作者:Bin -- 发布时间:2013/12/24 9:59:00 -- 一样的,没区别 |
-- 作者:Bin -- 发布时间:2013/12/24 9:59:00 -- 注意一下命名空间即可 |
-- 作者:whoami2012 -- 发布时间:2013/12/24 10:02:00 -- 没太明白。上面的代码应该写在哪个位置?放在窗体打开事件中报错。 |
-- 作者:Bin -- 发布时间:2013/12/24 10:09:00 -- 复制到全局代码 |
-- 作者:whoami2012 -- 发布时间:2013/12/24 10:40:00 -- 已经把如下代码复制到全局代码: Public Function FromASCIIByteArray(ByVal characters As Byte()) As String Dim encoding As New ASCIIEncoding() Dim constructedString As String = encoding.GetString(characters) Return (constructedString) End Function Public Sub DefWndProc(ByRef m As System.Windows.Forms.Message) Select Case m.Msg Case BriSDKLib.BRI_EVENT_MESSAGE If True Then Dim EventData As BriSDKLib.TBriEvent_Data = DirectCast(Marshal.PtrToStructure(m.LParam, GetType(BriSDKLib.TBriEvent_Data)), BriSDKLib.TBriEvent_Data) Dim strValue As String = "" Select Case EventData.lEventType Case BriSDKLib.BriEvent_PhoneHook If True Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":电话机摘机" End If Exit Select Case BriSDKLib.BriEvent_PhoneHang If True Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":电话机挂机" End If Exit Select Case BriSDKLib.BriEvent_CallIn If True Then \'两声响铃结束后开始呼叫转移到CC strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":来电响铃" End If Exit Select Case BriSDKLib.BriEvent_GetCallID If True Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":接收到来电号码 " & FromASCIIByteArray(EventData.szData) End If Exit Select Case BriSDKLib.BriEvent_StopCallIn If True Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":停止呼入,产生一个未接电话 " End If Exit Select Case BriSDKLib.BriEvent_GetDTMFChar strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":接收到按键 " & FromASCIIByteArray(EventData.szData) Exit Select Case BriSDKLib.BriEvent_RemoteHang If True Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":远程挂机 " End If Exit Select Case BriSDKLib.BriEvent_Busy If True Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":接收到忙音,线路已经断开 " End If Exit Select Case BriSDKLib.BriEvent_DialTone strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":检测到拨号音 " Exit Select Case BriSDKLib.BriEvent_PhoneDial strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":电话机拨号 " & FromASCIIByteArray(EventData.szData) Exit Select Case BriSDKLib.BriEvent_RingBack strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":拨号后接收到回铃音 " Exit Select Case BriSDKLib.BriEvent_DevErr If True Then If EventData.lResult = 3 Then strValue = "通道" & (EventData.uChannelID + 1).ToString() & ":设备可能被移除 " End If End If Exit Select Case Else Exit Select End Select If strValue.Length > 0 Then MessageBox.Show(strValue) End If End If Exit Select Case Else MyBase.DefWndProc(m) ‘这句报错,注释后项目可正常重启打开 Exit Select End Select End Sub 倒数第四行 MyBase.DefWndProc(m) ‘这句报错,注释后项目可正常重启打开。 设计了一个窗体,放置了打开设备的按钮并加了打开代码,可以调用外部DLL打开设备了(设备提示灯可点亮),但电话进来后,系统好像无法捕捉到来电的事件,没有来电的信息提示弹出。
|
-- 作者:狐狸爸爸 -- 发布时间:2013/12/24 12:10:00 -- 单单这个代码不会显示的啊,至少你没有添加事件处理程序,来电之后,应该会触发一个事件,要给这个事件添加事件处理程序:
http://www.foxtable.com/help/topics/2374.htm
|
-- 作者:whoami2012 -- 发布时间:2013/12/24 16:48:00 -- 感谢狐爸关注! 这个来电显示盒,好像是在来电时,生成一个窗体消息。现在就是不清楚如何捕捉到这个消息。 另外,MyBase.DefWndProc(m) 这句在vb.net中可以编译通过,在FT中应如何改写?
|