为何 Winsock.LocalHostName 不能获得中文机器名?

tzzxj96 2002-01-28 11:10:18
为何 Winsock.LocalHostName 不能获得中文机器名?
我用 Winsock 记录使用 MIS 系统的用户IP和用户机器名,但只能记录IP和英文机器名,不能获得中文机器名,LocalHostName中文机器名显示为“-------”
...全文
102 5 打赏 收藏 举报
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
tzzxj96 2002-01-28
  • 打赏
  • 举报
回复
to:dbcontrols(泰山__帮助你使我感到快乐.) 你的方法我知道,主要想知道Winsock为何不行。 加 8 分。 
tzzxj96 2002-01-28
  • 打赏
  • 举报
回复
我的机器名为“xxzx” 用 Winsock.LocalHostName 会得到Winsock.LocalHostName =“xxzx”。 我把机器名改为“信息中心”,用 Winsock.LocalHostName 则会得到Winsock.LocalHostName =“-------”。不能得到Winsock.LocalHostName =“信息中心”
dbcontrols 2002-01-28
  • 打赏
  • 举报
回复
当安装 Microsoft FoxPro 数据库的驱动程序时,设置程序会在引擎的 Windows 注册表和 ISAM 格式子键写入一些缺省值。不要直接修改这些设置;请使用应用程序的设置程序来添加、删除、或更改这些设置。下列部分描述 Microsoft FoxPro 数据库驱动程序的初始化和 ISAM Format 设置。

Microsoft FoxPro 初始化设置

Jet\3.5\Engines\Xbase 文件夹包含用来访问外部 FoxPro 工作表的 Msxbse35.dll 驱动程序的初始化设置。文件夹中项目的典型设置显示於下列示例。

win32=<path>\MSXBSE35.dll
NetworkAccess=On
PageTimeout=600
INFPath=C:\DBASE\SYSTEM
CollatingSequence=ASCII
DataCodePage=OEM
Deleted=Off
Century=Off
Date=MDY
Mark=47
Exact=Off

The Microsoft Jet 数据库引擎使用如下的 Xbase 文件夹项目。

项目 说明
win32 Msxbse35.dll 的位置。完整路径在安装时就已确定。在 Windows 95 和 Windows NT 4.0 中的值是字符串类型,而在 Windows NT 3.51 中是 REG_SZ 类型。
NetworkAccess 文件锁定首选项的二进制指示器。如果 Network Access 设为 00,表将被打开为独占访问,不管OpenDatabase 和 OpenRecordset 方法中 exclusive 参数的设置是多少。缺省值是 01。在 Windows 95 和 Windows NT 4.0 中的值是二进制类型,而在 Windows NT 3.51 中是 REG_BINARY 类型。
PageTimeout 从数据放在内部高速缓冲时起,到它变为无效之间的时间长度。此数值以 100 毫秒为单位。缺省值是 600 个单位或 60 秒。在 Windows 95 和 Windows NT 4.0 中的值是 DWORD 类型,而在 Windows NT 3.51 中是 REG_DWORD 类型。
INFPath 到 .inf 文件目录的完整路径。Microsoft Jet 数据库引擎首先在包含该表的目录中查找 .inf 文件。如果 .inf 文件不在数据库目录中,它会在 INFPath中查找。如果没有 INFPath,它会使用在数据库目录中找出的任意索引文件(.cdx 或 .mdx)。在 Windows 95 和 Windows NT 4.0 中的值是字符串类型,而在 Windows NT 3.51 中是 REG_SZ 类型。此项目没有被安装过程写入。
CollatingSequence 所有用 Microsoft Jet 数据库引擎创建或打开的 Microsoft FoxPro 表的排序序列。可能的值为 ASCII 和 International。缺省值是 ASCII。在 Windows 95 和 Windows NT 4.0 中的值是字符串类型,而在 Windows NT 3.51 中是 REG_SZ 类型。
DataCodePage 如何存储文本页的指示器。可能的设置是:?OEM-执行 OemToAnsi 和 AnsiToOem 转换。?ANSI—不执行 OemToAnsi 和 AnsiToOem转换。缺省值是 OEM。在 Windows 95 和 Windows NT 4.0 中的值是字符串类型,而在 Windows NT 3.51 中是 REG_SZ 类型。
Deleted 用以决定 Microsoft Jet 数据库引擎如何处理已标记为删除的记录的二进制指示器。01 值对应 Microsoft FoxPro 的 SET DELETED ON 命令,且指示 Microsoft Jet 不再检索或定位已删除的记录。00 值对应 Microsoft FoxPro 的 SET DELETED OFF 命令,且指示 Microsoft Jet 对待一个删除的记录像对待任何其它的记录一样。缺省值是 00。在 Windows 95 和 Windows NT 4.0 中的值是二进制类型,而在 Windows NT 3.51 中是 REG_BINARY 类型。
Century 在 date-to-string 函数被使用在索引表达式的情况下,格式化日期的世纪部件 (century)的二进制指示器。01 值对应 Microsoft FoxPro 的 SET CENTURY ON 命令,而 00 值对应 Microsoft FoxPro 的 SET CENTURY OFF 命令。缺省值是 00。在 Windows 95 和 Windows NT 4.0 中的值是二进制类型,而在 Windows NT 3.51 中是 REG_BINARY 类型。
Date 在索引表达式中使用 date-to-string 函数的情况下,使用的日期格式化样式。此对应 Microsoft FoxPro 的 SET DATE 命令的项目,可能值为 American、ANSI、British、French、DMY、German、Italian、Japan、MDY、USA、和 YMD。缺省值是 MDY。在 Windows 95 和 Windows NT 4.0 中的值是字符串类型,而在 Windows NT 3.51 中是 REG_SZ 类型。
Mark 用来分隔日期的 ASCII 字符的十进制值。缺省值取决于 Date 设置。如下列:"/" (American, MDY)"." (ANSI)"/" (British, French, DMY)"." (German)"-" (Italian)"/" (Japan, YMD)"-" (USA)0 值指示系统应该使用通常与被选择的日期格式相关联的分隔符。缺省值是 0。在 Windows 95 和 Windows NT 4.0 中的值是 DWORD 类型,而在 Windows NT 3.51 中是 REG_DWORD 类型。
Exact 字符串比较的二进制指示器。01 的值对应 Microsoft FoxPro 的 SET EXACT ON 命令。00 的值对应 Microsoft FoxPro 的 SET EXACT OFF 命令。缺省值是 00。在 Windows 95 和 Windows NT 4.0 中的值是二进制类型,而在 Windows NT 3.51 中是 REG_BINARY 类型。
FoxPro ISAM 格式

Jet\3.5\ISAM Formats\FoxPro 2.0 文件夹包含下列项目。

项目名称 Windows NT 3.51 类型 Windows 95 and Windows NT 4.0 类型 值
Engine REG_SZ String Xbase
ExportFilter REG_SZ String Microsoft FoxPro 2.0(*.dbf)
ImportFilter REG_SZ String Microsoft FoxPro(*.dbf)
CanLink REG_BINARY Binary 01
OneTablePerFile REG_BINARY Binary 01
IsamType REG_DWORD DWORD 0
IndexDialog REG_BINARY Binary 01
IndexFilter REG_SZ String FoxPro 索引(*.idx;*.cdx)
CreateDBOnExport REG_BINARY Binary 00
ResultTextImport REG_SZ String 从外部文件将数据导入当前数据库。对当前数据库中数据的更改将不会更改外部文件中的数据。
ResultTextLink REG_SZ String 在链接到外部文件的当前数据库中创建一个表。更改当前数据库中的数据时将会更改外部文件中的数据。
ResultTextExport REG_SZ String 从当前数据库将数据导入 Microsoft FoxPro 2.0 数据库。如果导入已存在的文件,这次处理将改写已存在的数据。
Jet\3.5\ISAM Formats\FoxPro 2.5 文件夹包含下列项目。

项目名称 Windows NT 3.51 类型 Windows 95 and Windows NT 4.0 类型 值
Engine REG_SZ String Xbase
ExportFilter REG_SZ String Microsoft FoxPro 2.5(*.dbf)
CanLink REG_BINARY Binary 01
OneTablePerFile REG_BINARY Binary 01
IsamType REG_DWORD DWORD 0
IndexDialog REG_BINARY Binary 01
IndexFilter REG_SZ String FoxPro 索引(*.idx;*.cdx)
CreateDBOnExport REG_BINARY Binary 00
ResultTextExport REG_SZ String 从当前数据库将数据导入 Microsoft FoxPro 2.5 数据库。如果导入已存在的文件,这次处理将改写已存在的数据。
Jet\3.5\ISAM Formats\FoxPro 2.6 文件夹包含下列项目。

项目名称 Windows NT 3.51 类型 Windows 95 and Windows NT 4.0 类型 值
Engine REG_SZ String Xbase
ExportFilter REG_SZ String Microsoft FoxPro 2.6(*.dbf)
CanLink REG_BINARY Binary 01
OneTablePerFile REG_BINARY Binary 01
IsamType REG_DWORD DWORD 0
IndexDialog REG_BINARY Binary 01
IndexFilter REG_SZ String FoxPro 索引(*.idx;*.cdx)
CreateDBOnExport REG_BINARY Binary 00
ResultTextExport REG_SZ String 从当前数据库将数据导入 Microsoft FoxPro 2.6 数据库。如果导入已存在的文件,这次处理将改写已存在的数据。
Jet\3.5\ISAM Formats\FoxPro 3.0 文件夹包含下列项目。

项目名称 Windows NT 3.51 类型 Windows 95 and Windows NT 4.0 类型 值
Engine REG_SZ String Xbase
ExportFilter REG_SZ String Microsoft FoxPro 3.0(*.dbf)
CanLink REG_BINARY Binary 00
OneTablePerFile REG_BINARY Binary 01
IsamType REG_DWORD DWORD 0
IndexDialog REG_BINARY Binary 01
CreateDBOnExport REG_BINARY Binary 00
ResultTextExport REG_SZ String 从当前数据库将数据导入 Microsoft FoxPro 3.0 数据库。如果导入已存在的文件,这次处理将改写已存在的数据。
Jet\3.5\ISAM Formats\FoxPro DBC 文件夹包含下列项目。

项目名称 Windows NT 3.51 类型 Windows 95 and Windows NT 4.0 类型 值
Engine REG_SZ String Xbase
ExportFilter REG_SZ String Microsoft FoxPro 3.0(*.dbc)
CanLink REG_BINARY Binary 00
OneTablePerFile REG_BINARY Binary 00
IsamType REG_DWORD DWORD 0
IndexDialog REG_BINARY Binary 00
CreateDBOnExport REG_BINARY Binary 00
ResultTextImport REG_SZ String 从外部文件将数据导入当前数据库。对当前数据库中数据的更改将不会更改外部文件中的数据。
注意 当更改 Windows 注册表设置时,要使新设置生效,必须先退出,然后重新激活数据库引擎。
dbcontrols 2002-01-28
  • 打赏
  • 举报
回复
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Private Sub Command1_Click()
MsgBox "计算机名称是" & MachineName, vbInformation + vbOKOnly, "泰山"
End Sub

Public Function MachineName() As String
Dim sBuffer As String * 255

If GetComputerName(sBuffer, 255&) <> 0 Then
MachineName = Left$(sBuffer, InStr(sBuffer, vbNullChar) - 1)
Else
MachineName = "(未知)"
End If
End Function
saralfq 2002-01-28
  • 打赏
  • 举报
回复
For documentation of the debug/trace feature, as well as this Dt_dll sample source code, consult Dbgspec.doc in this directory.

WinSock 2 Debug and Trace Facilities

Dbgspec.doc (WinSock 2 Debug and Trace Facilities) describes the functionality, design, and implementation of the default debug/trace DLL (named Dt_dll.dll), which is supplied in source-code form with the WinSock 2 SDK. Developers may find that the default debug/trace DLL supplies all the necessary functionality for their purposes. However, they are also free to modify the code to provide additional debugging functionality, or they may start from scratch and build a new debug/trace DLL. In the latter case, only the interface definition portion of this document may be relevant, and the reader can skip the section describing the default DLL. The default DLL does contain hooks, however, which allow it to be extended for all but the most complex types of debugging and tracing.

Developers of WinSock 2 applications and service providers need to be able to isolate bugs to one of the following:

The client application


The WinSock 2 DLL


The service provider (transport or name space)
The WinSock 2 debug/trace layer addresses this problem. It allows all procedure calls across the WinSock 2 API or SPI to be monitored, and to some extent controlled.

Developers can use this mechanism to trace the procedure calls, procedure returns, parameter values, and return values. You can alter parameter values and returns on procedure-call or procedure-return. If desired, you can even prevent or redirect a procedure-call. With access to this level of information and control, it should be easy for you to isolate any problem to the application, WinSock 2 DLL or service provider.

The debug/trace layer is supported only by a specially instrumented version of the WinSock 2 DLL. The SDK license terms do not allow redistribution of this instrumented WinSock 2 DLL in order to prevent inappropriate use of the debug hooks in production systems.

The debug/trace feature of Windows Sockets 2 will only work with the debug version of Ws2_32.dll.

Building SDK Samples

This sample uses the following keywords:

abortandclose; accept; back; bind; callwindowproc; cgetcounter; closehandle; closesocket; connect; cpop; cpush; createevent; createfile; createthread; createwindow; cstack_c; debugdlgproc; defwindowproc; deletecriticalsection; dialogbox; dispatchmessage; dllmain; dteditwndproc; dthandler___wsafdisset; dthandler_accept; dthandler_bind; dthandler_closesocket; dthandler_connect; dthandler_gethostbyaddr; dthandler_gethostbyname; dthandler_gethostname; dthandler_getpeername; dthandler_getprotobyname; dthandler_getprotobynumber; dthandler_getservbyname; dthandler_getservbyport; dthandler_getsockname; dthandler_getsockopt; dthandler_htonl; dthandler_htons; dthandler_inet_addr; dthandler_inet_ntoa; dthandler_ioctlsocket; dthandler_listen; dthandler_nspaddresstostring; dthandler_nspcleanup; dthandler_nspgetaddressbyname; dthandler_nspgetserviceclassinfo; dthandler_nspgetserviceclassnamebyclassid; dthandler_nspinstallserviceclass; dthandler_nsplookupservicebegin; dthandler_nsplookupserviceend; dthandler_nsplookupservicenext; dthandler_nspremoveserviceclass; dthandler_nspsetservice; dthandler_nspstringtoaddress; dthandler_ntohl; dthandler_ntohs; dthandler_recv; dthandler_recvfrom; dthandler_select; dthandler_send; dthandler_sendto; dthandler_setsockopt; dthandler_shutdown; dthandler_socket; dthandler_wpucloseevent; dthandler_wpuclosesockethandle; dthandler_wpucreateevent; dthandler_wpucreatesockethandle; dthandler_wpufdisset; dthandler_wpugetproviderpath; dthandler_wpumodifyifshandle; dthandler_wpupostmessage; dthandler_wpuqueryblockingcallback; dthandler_wpuquerysockethandlecontext; dthandler_wpuqueueapc; dthandler_wpuresetevent; dthandler_wpusetevent; dthandler_wsaaccept; dthandler_wsaaddresstostringa; dthandler_wsaaddresstostringw; dthandler_wsaasyncgethostbyaddr; dthandler_wsaasyncgethostbyname; dthandler_wsaasyncgetprotobyname; dthandler_wsaasyncgetprotobynumber; dthandler_wsaasyncgetservbyname; dthandler_wsaasyncgetservbyport; dthandler_wsaasyncselect; dthandler_wsacancelasyncrequest; dthandler_wsacancelblockingcall; dthandler_wsacleanup; dthandler_wsacloseevent; dthandler_wsaconnect; dthandler_wsacreateevent; dthandler_wsaduplicatesocketa; dthandler_wsaduplicatesocketw; dthandler_wsaenumnamespaceprovidersa; dthandler_wsaenumnamespaceprovidersw; dthandler_wsaenumnetworkevents; dthandler_wsaenumprotocolsa; dthandler_wsaenumprotocolsw; dthandler_wsaeventselect; dthandler_wsagetaddressbynamea; dthandler_wsagetaddressbynamew; dthandler_wsagetlasterror; dthandler_wsagetoverlappedresult; dthandler_wsagetqosbyname; dthandler_wsagetserviceclassinfoa; dthandler_wsagetserviceclassinfow; dthandler_wsagetserviceclassnamebyclassida; dthandler_wsagetserviceclassnamebyclassidw; dthandler_wsahtonl; dthandler_wsahtons; dthandler_wsainstallserviceclassa; dthandler_wsainstallserviceclassw; dthandler_wsaioctl; dthandler_wsaisblocking; dthandler_wsajoinleaf; dthandler_wsalookupservicebegina; dthandler_wsalookupservicebeginw; dthandler_wsalookupserviceend; dthandler_wsalookupservicenexta; dthandler_wsalookupservicenextw; dthandler_wsantohl; dthandler_wsantohs; dthandler_wsarecv; dthandler_wsarecvdisconnect; dthandler_wsarecvfrom; dthandler_wsaremoveserviceclass; dthandler_wsaresetevent; dthandler_wsasend; dthandler_wsasenddisconnect; dthandler_wsasendto; dthandler_wsasetblockinghook; dthandler_wsasetevent; dthandler_wsasetlasterror; dthandler_wsasetservicea; dthandler_wsasetservicew; dthandler_wsasocketa; dthandler_wsasocketw; dthandler_wsastartup; dthandler_wsastringtoaddressa; dthandler_wsastringtoaddressw; dthandler_wsaunhookblockinghook; dthandler_wsawaitformultipleevents; dthandler_wscdeinstallprovider; dthandler_wscenumprotocols; dthandler_wscinstallprovider; dthandler_wspaccept; dthandler_wspasyncselect; dthandler_wspbind; dthandler_wspcancelblockingcall; dthandler_wspcleanup; dthandler_wspclosesocket; dthandler_wspconnect; dthandler_wspduplicatesocket; dthandler_wspenumnetworkevents; dthandler_wspeventselect; dthandler_wspgetoverlappedresult; dthandler_wspgetpeername; dthandler_wspgetqosbyname; dthandler_wspgetsockname; dthandler_wspgetsockopt; dthandler_wspioctl; dthandler_wspjoinleaf; dthandler_wsplisten; dthandler_wsprecv; dthandler_wsprecvdisconnect; dthandler_wsprecvfrom; dthandler_wspselect; dthandler_wspsend; dthandler_wspsenddisconnect; dthandler_wspsendto; dthandler_wspsetsockopt; dthandler_wspshutdown; dthandler_wspsocket; dthandler_wspstartup; dthandlerinit; dtmainwndproc; dttextout; enddialog; entercriticalsection; fillmemory; first; getclientrect; getcurrent; getcurrentdirectory; getcurrentprocessid; getcurrentthreadid; getfile; getfromback; getfromfront; gethostbyaddr; gethostbyname; gethostname; getlasterror; getlocaltime; getmessage; getnideque; getpeername; getprotobyname; getprotobynumber; getsavefilename; getservbyname; getservbyport; getsockname; getsockopt; getstockobject; getwindowtextlength; htonl; htons; hugetlasterror; huprinterror; husetlasterror; inet_addr; inet_ntoa; initialize; initializecriticalsection; insertintoback; insertintofront; ioctlsocket; isdlgbuttonchecked; isempty; last; leavecriticalsection; listen; loadcursor; loadicon; localalloc; localfree; makeintresource; makelparam; memset; messagebox; movewindow; next; nideque_c; nidequeiter_c; nilnode_c; nspaddresstostring; nspgetaddressbyname; nspgetserviceclassinfo; nspgetserviceclassnamebyclassid; nspinstallserviceclass; nsplookupservicebegin; nsplookupserviceend; nsplookupservicenext; nspremoveserviceclass; nspsetservice; nspstringtoaddress; ntohl; ntohs; outputdebugstring; pop; postquitmessage; printf; push; recv; recvfrom; registerclass; remove; removedata; removefromback; removefromfront; replace; select; send; sendmessage; sendto; setevent; setlasterror; setsockopt; setwindowlong; shutdown; socket; stack_c; strcpy; switch; tlsalloc; tlsfree; tlsgetvalue; tlssetvalue; translatemessage; va_arg; va_start; waitforsingleobject; warning; windowthreadfunc; wpucloseevent; wpuclosesockethandle; wpucreateevent; wpucreatesockethandle; wpufdisset; wpugetproviderpath; wpumodifyifshandle; wpupostmessage; wpuqueryblockingcallback; wpuquerysockethandlecontext; wpuqueueapc; wpuresetevent; wpusetevent; writefile; wsaaccept; wsaaddresstostringa; wsaaddresstostringw; wsaasyncgethostbyaddr; wsaasyncgethostbyname; wsaasyncgetprotobyname; wsaasyncgetprotobynumber; wsaasyncgetservbyname; wsaasyncgetservbyport; wsaasyncselect; wsacancelasyncrequest; wsacancelblockingcall; wsacleanup; wsacloseevent; wsaconnect; wsacreateevent; wsaduplicatesocketa; wsaduplicatesocketw; wsaenumnamespaceprovidersa; wsaenumnamespaceprovidersw; wsaenumnetworkevents; wsaenumprotocolsa; wsaenumprotocolsw; wsaeventselect; wsaexceptionnotify; wsagetaddressbynamea; wsagetaddressbynamew; wsagetlasterror; wsagetoverlappedresult; wsagetqosbyname; wsagetserviceclassinfoa; wsagetserviceclassinfow; wsagetserviceclassnamebyclassida; wsagetserviceclassnamebyclassidw; wsahtonl; wsahtons; wsainstallserviceclassa; wsainstallserviceclassw; wsaioctl; wsaisblocking; wsajoinleaf; wsalookupservicebegina; wsalookupservicebeginw; wsalookupserviceend; wsalookupservicenexta; wsalookupservicenextw; wsantohl; wsantohs; wsapostapinotify; wsapreapinotify; wsarecv; wsarecvdisconnect; wsarecvfrom; wsaremoveserviceclass; wsaresetevent; wsasend; wsasenddisconnect; wsasendto; wsasetblockinghook; wsasetevent; wsasetlasterror; wsasetservicea; wsasetservicew; wsasocketa; wsasocketw; wsastartup; wsastringtoaddressa; wsastringtoaddressw; wsaunhookblockinghook; wsawaitformultipleevents; wscdeinstallprovider; wscenumprotocols; wscinstallprovider; wspaccept; wspasyncselect; wspbind; wspcancelblockingcall; wspcleanup; wspclosesocket; wspconnect; wspduplicatesocket; wspenumnetworkevents; wspeventselect; wspgetoverlappedresult; wspgetpeername; wspgetqosbyname; wspgetsockname; wspgetsockopt; wspioctl; wspjoinleaf; wsplisten; wsprecv; wsprecvdisconnect; wsprecvfrom; wsprintf; wspselect; wspsend; wspsenddisconnect; wspsendto; wspsetsockopt; wspshutdown; wspsocket; wspstartup
发帖
通信技术

4284

社区成员

通信技术相关讨论
社区管理员
  • 网络通信
加入社区
帖子事件
创建了帖子
2002-01-28 11:10
社区公告
暂无公告