如何在 Powerbuilder 2019 中获取主机名和 ipv4 地址? [英] How to get the host name and ipv4 address in Powerbuilder 2019?

查看:67
本文介绍了如何在 Powerbuilder 2019 中获取主机名和 ipv4 地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用用户名、计算机名和ipv4地址创建一个连接数据库的日志,但是调用kernel32.dll会得到垃圾字符,比如䍐䌭位刹奏.我正在考虑以下方面的事情:

I would like to create a log of connections to the database with the user name, computer name, and ipv4 address, but using calls to the kernel32.dll gets me garbage characters, like 䍐䌭位剎奏. I was thinking on something along the lines of:

$computer = [System.Net.Dns]::GetHostName()$ipcomputer = [System.Net.Dns]::GetHostEntry($computer)

$computer = [System.Net.Dns]::GetHostName() $ipcomputer = [System.Net.Dns]::GetHostEntry($computer)

假设我可以将这些值恢复到 PB2019.任何想法将不胜感激.

assuming I can get those values back to PB2019. Any ideas will be appreciated.

推荐答案

函数吐出的垃圾需要先转换为 ANSI,然后才有意义.感谢@Slapout 提供的链接帮助我解决了这个问题.

The garbage the function spits needs to be converted to ANSI before making any sense. Thanks to @Slapout for the link that helped me solve this.

这篇关于如何在 Powerbuilder 2019 中获取主机名和 ipv4 地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆