CSDN PB社区中部分FAQ链接地址收集

1、如何在PB中设置NotifyIconData 这个结构以实现在系统栏图标上显示冒泡式提示

http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=207025

2、如何获取图片文件原始大小(BMP、JPG、GIF)

http://community.csdn.net/Expert/topic/3602/3602171.xml?temp=.1074793

3、如何打开pbl中的一个对象

http://community.csdn.net/Expert/topic/3618/3618373.xml?temp=.2883264

4、用PB开发MAPX的两个例子

http://community.csdn.net/Expert/topic/3778/3778076.xml?temp=.4666101

5、pb中怎么通过嵌入ole来控制Ie浏览器控件?

http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=139347

http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=205495

6、如何切换中文输入法

http://community.csdn.net/Expert/topic/3278/3278194.xml?temp=.8663294

网上收集FAQ

04-26

*********************************************************************rn使用WINSOCK控件通讯,可否使用自定义类型数据包?rn*********************************************************************rnrn问:rnrn 两台机子使用WINSOCK控件通讯,不知可否使用自定义类型数据包?如果可以该怎样做? 我欲使用WINSOCK控件接发自定义类型的数据,如 rn Type sendpack rn Flag As Byte rn connum As String rn weight1 As long rn weight2 as long rn End Type rn 将上述定义放在MODULES中或使用WINSOCK的窗体中,定义STR1 为以上类型,使用 rn Winsock1.senddata str1 rn 结果都出错,提示: rn “只有在公共对象模块中定义的公共用户定义类型可以被使用为类模块公共过程的参数或返回类型、或作为公共用户定义类型的字段 rn 这个错误的原因与解决方法如下: rn 试图使用一个公共用户定义类型作为类模块公共过程的参数或返回类型、或作为公共用户定义类型的字段。只有在公共对象模块中定义的公共用户定义类型才可以这样使用。” rn 虽有如上提示,可是我并不十分明白,也不知如何解决,请指教,万分感谢! rn----------------------------------------------------------------------rn回答: rnrn SendData只处理字符串和字节数组,所以其他类型应该转换为这两种类型。对于自定义类型只能转换为字节数组。可以利用CopyMemory函数: rn Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" ( _ rn hpvDest As Any, hpvSource As Any, ByVal cbCop rn 先定义一个字节数组: rn Dim b() As Byte, Str1 As sendpack rn 发送时: rn ReDim B(Len(Str1)) As Byte rn CopyMemory B(0), Str1, Len(Str1) rn Winsock1.SendData B rn 接收时: rn ReDim B(Len(Str1)) As Byte rn Winsock1.GetData B rn CopyMemory Str1, B(0), Len(Str1)rn rn*********************************************************************rn怎样读取本机在Internet上的IPrn*********************************************************************rnrn 问题:我在写一个VB的远程数据库的软件,其中涉及到一个问题:怎样读取本机在Internet上的IP,用传统的方法如SockDLL或WinSock控件只能得到当前本机的第一个IP,如计算机上有两块网卡(如ADSL+LAN)的情况下则只能读取第一个网络设备的当前IP,请指教用那个API及其在VB的用法。谢谢! rn 水平: 中级 rn----------------------------------------------------------------------rn回答: rnrn 关键是 GetIpAddrTable (注意:Windows 95 没有 IPHlpApi 连接库,可以从 98 复制过去,NT 4 SP4 以前没有,可以从 SP6a 包里复制过去)。 rn C 原型: rn DWORD GetIpAddrTable( rn PMIB_IPADDRTABLE pIpAddrTable, rn PULONG pdwSize, rn BOOL bOrder rn ); rn 参数: rn pIpAddrTable rn [out] Pointer to a buffer that receives the interface–to–IP address mapping table as a MIB_IPADDRTABLE structure. rn pdwSize rn [in, out] On input, specifies the size of the buffer pointed to by the pIpAddrTable parameter. rn On output, if the buffer is not large enough to hold the returned mapping table, the function sets this parameter equal to the required buffer size. rn rn bOrder rn [in] Specifies whether the returned mapping table should be sorted in ascending order by IP address. If this parameter is TRUE, the table is sorted. rn rn VB 声明: rn Declare Function GetIpAddrTable Lib "IPHlpApi" (pIPAdrTable As Byte, pdwSize As Long, ByVal Sort As Long) As Long rn rn rn rn 返回值: rn ERROR_INVALID_PARAMETER The pdwSize parameter is NULL, or GetIpAddrTable is unable to write to the memory pointed to by the pdwSize parameter. rn ERROR_INSUFFICIENT_BUFFER The buffer pointed to by the pIpAddrTable parameter is not large enough. The required size is returned in the DWORD variable pointed to by the pdwSize parameter. rn ERROR_NOT_SUPPORTED This function is not supported on the operating system in use on the local system. rn Other Use FormatMessage to obtain the message string for the returned error. rn rn 给一段示范程序: rn Private Const MAX_IP = 255 rn Private Type IPINFO rn dwAddr As Long rn dwIndex As Long rn dwMask As Long rn dwBCastAddr As Long rn dwReasmSize As Long rn unused1 As Integer rn unused2 As Integer rn End Type rn Private Type MIB_IPADDRTABLE rn dEntrys As Long rn mIPInfo(MAX_IP) As IPINFO rn End Type rn Private Type IP_Array rn mBuffer As MIB_IPADDRTABLE rn BufferLen As Long rn End Type rn Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) rn Private Declare Function GetIpAddrTable Lib "IPHlpApi" (pIPAdrTable As Byte, pdwSize As Long, ByVal Sort As Long) As Long rn Dim strIP As String rn rn Private Sub main() rn Start rn MsgBox strIP rn End Sub rn rn Private Function ConvertAddressToString(longAddr As Long) As String rn Dim myByte(3) As Byte rn Dim Cnt As Long rn CopyMemory myByte(0), longAddr, 4 rn For Cnt = 0 To 3 rn ConvertAddressToString = ConvertAddressToString + CStr(myByte(Cnt)) + "." rn Next Cnt rn ConvertAddressToString = Left$(ConvertAddressToString, Len(ConvertAddressToString) - 1) rn End Function rn rn Public Sub Start() rn Dim Ret As Long, Tel As Long rn Dim bBytes() As Byte rn Dim Listing As MIB_IPADDRTABLE rn On Error GoTo END1 rn GetIpAddrTable ByVal 0&, Ret, True rn If Ret <= 0 Then Exit Sub rn ReDim bBytes(0 To Ret - 1) As Byte rn GetIpAddrTable bBytes(0), Ret, False rn CopyMemory Listing.dEntrys, bBytes(0), 4 rn strIP = "你机子上有 " & Listing.dEntrys & " 个 IP 地址。" & vbCrLf rn strIP = strIP & "------------------------------------------------" & vbCrLf & vbCrLf rn For Tel = 0 To Listing.dEntrys - 1 rn CopyMemory Listing.mIPInfo(Tel), bBytes(4 + (Tel * Len(Listing.mIPInfo(0)))), Len(Listing.mIPInfo(Tel)) rn strIP = strIP & "IP 地址 : " & ConvertAddressToString(Listing.mIPInfo(Tel).dwAddr) & vbCrLf rn strIP = strIP & "子网掩码 : " & ConvertAddressToString(Listing.mIPInfo(Tel).dwMask) & vbCrLf rn strIP = strIP & "广播地址 : " & ConvertAddressToString(Listing.mIPInfo(Tel).dwBCastAddr) & vbCrLf rn strIP = strIP & "------------------------------------------------" & vbCrLf rn Next rn Exit Sub rn END1: rn MsgBox "ERROR" rn End Sub rnrn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试