是否可以从VBA过程中检查系统以读取和记录系统设置? [英] Is it possible to examine a system from within a VBA procedure to read and document system settings?

查看:62
本文介绍了是否可以从VBA过程中检查系统以读取和记录系统设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望给某人一个A97数据库,他们可以在他们的PC上安装

作为运行时应用程序。我希望他们点击

表格上的按钮(frmDocumentMyPC)。我想尽可能多地记录

关于PC的有用信息,保存表格中的数据
并打印好的报告。我知道怎么用
运行IPconfig并将其输出读入Access表。


我不知道可以读取多少有用的信息

并保存,但我想得到所有可能证明

对主人有用的东西。例如,我可以确定所有者的电子邮件地址,他们的默认浏览器

是什么,机器名称等等?也许甚至算上所有文件/目录,确定所有磁盘上耗尽了多少磁盘空间

。我想探索pos-

的可能性,并且正在寻找一个好的起点。

解决方案

On Mon ,2006年3月27日22:13:16 -0500,MLH< CR ** @ NorthState.net>写道:


你可以从任何Office

应用程序的关于框运行的系统信息小程序怎么样?不确定你是否可以实现自动化,但是在做客户支持时非常有帮助。


-Tom。

< blockquote class =post_quotes>我希望给某人一个A97数据库,他们可以在他们的PC上安装作为运行时应用程序。我希望他们点击表格上的按钮(frmDocumentMyPC)。我想尽可能多地记录关于PC的有用信息,保存表格中的数据并打印好的报告。我知道如何运行IPconfig并将其输出读入Access表。

我不知道有多少有用信息可以读取和保存,但我想得到所有可能证明对所有者有用的东西。例如,我可以确定所有者的电子邮件地址,他们的默认浏览器是什么,机器名称等?也许甚至可以统计所有文件/目录,确定所有磁盘上已用完了多少磁盘空间。我想探索一下这个可能性,并且正在寻找一个好的起点。




On Mon,27 2006年3月22:13:16 -0500,MLH写道:

我希望给某人一个A97数据库,他们可以在他们的PC上安装作为运行时应用程序。我希望他们点击表格上的按钮(frmDocumentMyPC)。我想尽可能多地记录关于PC的有用信息,保存表格中的数据并打印好的报告。我知道如何运行IPconfig并将其输出读入Access表。

我不知道有多少有用信息可以读取和保存,但我想得到所有可能证明对所有者有用的东西。例如,我可以确定所有者的电子邮件地址,他们的默认浏览器是什么,机器名称等?也许甚至可以统计所有文件/目录,确定所有磁盘上已用完了多少磁盘空间。我想探索一下这个可能性,并且正在寻找一个好的起点。




如何修理你的PC时钟?

-

Fred

请回复此新闻组。

我不回复个人电子邮件


fredg写道:

2006年3月27日星期一22:13:16 -0500,MLH写道:

我想给某人一个A97数据库,他们可以在他们的PC上安装
作为运行时应用程序。我希望他们点击表格上的按钮(frmDocumentMyPC)。我想尽可能多地记录关于PC的有用信息,保存表格中的数据并打印好的报告。我知道如何运行IPconfig并将其输出读入Access表。

我不知道有多少有用信息可以读取和保存,但我想得到所有可能证明对所有者有用的东西。例如,我可以确定所有者的电子邮件地址,他们的默认浏览器是什么,机器名称等?也许甚至可以统计所有文件/目录,确定所有磁盘上已用完了多少磁盘空间。我想探索一下这个可能性,并且正在寻找一个好的起点。



如何修理你的PC时钟?
-
Fred
请回复此新闻组。
我不回复个人电子邮件




我同意。顺便说一下,不是有人会这样做,而是安装

试用软件,系统时钟设置为未来的假日期

如果时钟设置回现在安装后?不要死了CMOS电池会导致时钟速度变慢吗?


MLH,


让我来吧看我是否理解这个问题。您希望用户能够从他们的PC上读取他们的电子邮件地址。例如,(一个电子邮件地址我最近查了很久以前在这里发帖的人)

tg *@sfu.ca


然后你想搜索一些浏览器历史记录。例如,(我最近浏览过的
个地方的例子,试图获得关于这个NG的老朋友的一些信息)

http://www.elinc.sfu.ca/people/people_16_tb.htm




http://groups.google.com/group/comp....57047ef04a7b81




http:// groups.google.com/group/comp....c8d7b4ac79f6a2


然后你想知道目录是什么。例如,(虚构的,

目录名称的幽默或投机可能性):


C:\ eLINCPeopleDoingSideJobs





C:\ AdministerProfitsFrom_aislebyaisle_com




C:\Databases \\ \\ shoppingList_mdb


(请注意,上面列出的任何感知假设都是基于

最脆弱和最奇特的可以想象的间接证据所以

请不要认真对待或打扰任何人。此外,如果

由于一些非常遥远的机会,任何一个都是真的他会很感激免费

宣传:-)。)


那么你希望能够找出使用了多少硬盘空间。

我接近理解问题?


对于硬盘空间,请尝试使用API​​函数:


''来自Microsoft知识库文章的代码

私人类型LARGE_INTEGER

lowpart A. s长

highpart As Long

结束类型


公共声明函数GetDiskFreeSpaceEx Lib" kernel32"别名_

" GetDiskFreeSpaceExA" (ByVal lpRootPathName As String,_

lpFreeBytesAvailableToCaller作为LARGE_INTEGER,lpTotalNumberOfBytes

_

作为LARGE_INTEGER,lpTotalNumberOfFreeBytes作为LARGE_INTEGER)作为




私有函数CLargeInt(Lo As Long,Hi As Long)As Double

''此函数将LARGE_INTEGER数据类型转换为double

Dim dblLo As Double,dblHi As Double


如果Lo< 0然后

dblLo = 2 ^ 32 + Lo

否则

dblLo = Lo

结束如果

如果你好< 0然后

dblHi = 2 ^ 32 +嗨

否则

dblHi =嗨

结束如果

CLargeInt = dblLo + dblHi * 2 ^ 32

结束功能


代码用途如下:


Public Function FreeSpaceA()As Double

Dim lResult As Long

Dim liAvailable As LARGE_INTEGER

Dim liTotal As LARGE_INTEGER

Dim liFree作为LARGE_INTEGER

Dim dblAvailable As Double

Dim dblTotal As Double

Dim dblFree As Double


''确定驱动器的可用空间,总大小和可用空间

lResult = GetDiskFreeSpaceEx(" A:\",liAvailable,liTotal,liFree)


''将返回值从LARGE_INTEG转换为双打

dblAvailable = CLargeInt(liAvailable.lowpart,liAvailable.highpart)

dblTotal = CLargeInt(liTotal.lowpart,liTotal.highpart)

dblFree = CLargeInt(liFree.lowpart,liFree.highp)艺术)


''显示结果

''Debug.Print'可用空间:" &安培; dblAvailable& "字节(& _

''格式(dblAvailable / 1024 ^ 3," 0.00")&"" G)" &安培; vbCr&

_

''"总空间:" &安培; dblTotal& "字节(& _

''格式(dblTotal / 1024 ^ 3," 0.00")&"" G)" &安培; vbCr& _

''" Free Space:" &安培; dblFree& " bytes(& _

''格式(dblFree / 1024 ^ 3," 0.00")&"">

FreeSpaceA = dblFree

结束功能


注意: http://www.microsoft.com 是回答这些问题的好消息。

。您可以使用Dir()函数遍历

目录。


电子邮件附件应该被压缩(cab格式?)中的一些

隐藏的,有点秘密的MS目录看起来像

MW3RW5IR。尝试谷歌搜索。


浏览器历史记录应该类似于C:\ Windows \ Temporary

Internet Files \ Content.IE5但它取决于特定的操作系统。


获取电子邮件地址可能会检查Outlook对象模型

它或者它可能存储在用户的注册表项中的电子邮件

读者。


也许其他人可以对这些问题给出更详细的答案。


Do你有什么特别的用户可以测试这个概念吗?


James A. Fortune
CD ******** @ FortuneJames.com

http://www.mw.com/cgi-bin/dictionar...ouble+entendre


I wish to give someone an A97 database they can install
on their PC as a runtime application. I want them to click
a button on a form (frmDocumentMyPC). I want to document
as much useful information about the PC as possible, save
the data in table(s) and print a nice report. I know how to
run IPconfig and read its output into Access tables.

I don''t know how much useful information can be read
and saved, but I would like to get all that may prove of
some use to the owner. For example, could I determine
the owner''s eMail address(es), what their default browser
is, the machine name, etc? Perhaps even count up all
the files/dirs, determine how much diskspace has been
used up on all the disks. I would like to explore the pos-
sibilities and am looking for a good place to start.

解决方案

On Mon, 27 Mar 2006 22:13:16 -0500, MLH <CR**@NorthState.net> wrote:

How about the System Info applet that you can run from any Office
application''s About box? Not sure if you can automate it, but it is
very helpful when doing customer support.

-Tom.

I wish to give someone an A97 database they can install
on their PC as a runtime application. I want them to click
a button on a form (frmDocumentMyPC). I want to document
as much useful information about the PC as possible, save
the data in table(s) and print a nice report. I know how to
run IPconfig and read its output into Access tables.

I don''t know how much useful information can be read
and saved, but I would like to get all that may prove of
some use to the owner. For example, could I determine
the owner''s eMail address(es), what their default browser
is, the machine name, etc? Perhaps even count up all
the files/dirs, determine how much diskspace has been
used up on all the disks. I would like to explore the pos-
sibilities and am looking for a good place to start.




On Mon, 27 Mar 2006 22:13:16 -0500, MLH wrote:

I wish to give someone an A97 database they can install
on their PC as a runtime application. I want them to click
a button on a form (frmDocumentMyPC). I want to document
as much useful information about the PC as possible, save
the data in table(s) and print a nice report. I know how to
run IPconfig and read its output into Access tables.

I don''t know how much useful information can be read
and saved, but I would like to get all that may prove of
some use to the owner. For example, could I determine
the owner''s eMail address(es), what their default browser
is, the machine name, etc? Perhaps even count up all
the files/dirs, determine how much diskspace has been
used up on all the disks. I would like to explore the pos-
sibilities and am looking for a good place to start.



How about fixing your PC clock?
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail


fredg wrote:

On Mon, 27 Mar 2006 22:13:16 -0500, MLH wrote:

I wish to give someone an A97 database they can install
on their PC as a runtime application. I want them to click
a button on a form (frmDocumentMyPC). I want to document
as much useful information about the PC as possible, save
the data in table(s) and print a nice report. I know how to
run IPconfig and read its output into Access tables.

I don''t know how much useful information can be read
and saved, but I would like to get all that may prove of
some use to the owner. For example, could I determine
the owner''s eMail address(es), what their default browser
is, the machine name, etc? Perhaps even count up all
the files/dirs, determine how much diskspace has been
used up on all the disks. I would like to explore the pos-
sibilities and am looking for a good place to start.



How about fixing your PC clock?
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail



I agree. BTW, not that anyone would do this, but would installing
trial software with the system clock set to a bogus date in the future
work if the clock is set back to the present after the install? Don''t
dying CMOS batteries cause the clock to slow down?

MLH,

Let me see if I understand the problem. You want the user to be able
to read their email address from their PC. E.g., (an email address I
looked up recently of someone who posted here long ago)

tg*@sfu.ca

Then you want to search some browser history. E.g., (examples of
places I browsed recently to try to get some information about the old
friend of this NG)

http://www.elinc.sfu.ca/people/people_16_tb.htm

or

http://groups.google.com/group/comp....57047ef04a7b81

or

http://groups.google.com/group/comp....c8d7b4ac79f6a2

Then you want to find out what the directories are. E.g., (fictitious,
humorous or speculative possibilities for directory names):

C:\eLINCPeopleDoingSideJobs

or

C:\AdministerProfitsFrom_aislebyaisle_com

or

C:\Databases\ShoppingList_mdb

(Note that any perceived hypothesis outlined above is based on the
flimsiest and most whimsical circumstantial evidence imaginable so
please don''t take it seriously or bother anyone about it. Besides, if
by some very remote chance any of it is true he''ll appreciate the free
publicity :-).)

Then you want to be able to find out how much hard drive space is used.
Am I close to understanding the problem?

For hard drive space try the API function:

''Code from knowledgebase article by Microsoft
Private Type LARGE_INTEGER
lowpart As Long
highpart As Long
End Type

Public Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias _
"GetDiskFreeSpaceExA" (ByVal lpRootPathName As String, _
lpFreeBytesAvailableToCaller As LARGE_INTEGER, lpTotalNumberOfBytes
_
As LARGE_INTEGER, lpTotalNumberOfFreeBytes As LARGE_INTEGER) As
Long

Private Function CLargeInt(Lo As Long, Hi As Long) As Double
''This function converts the LARGE_INTEGER data type to a double
Dim dblLo As Double, dblHi As Double

If Lo < 0 Then
dblLo = 2 ^ 32 + Lo
Else
dblLo = Lo
End If
If Hi < 0 Then
dblHi = 2 ^ 32 + Hi
Else
dblHi = Hi
End If
CLargeInt = dblLo + dblHi * 2 ^ 32
End Function

The code is used something like:

Public Function FreeSpaceA() As Double
Dim lResult As Long
Dim liAvailable As LARGE_INTEGER
Dim liTotal As LARGE_INTEGER
Dim liFree As LARGE_INTEGER
Dim dblAvailable As Double
Dim dblTotal As Double
Dim dblFree As Double

''Determine the Available Space, Total Size and Free Space of a drive
lResult = GetDiskFreeSpaceEx("A:\", liAvailable, liTotal, liFree)

''Convert the return values from LARGE_INTEGER to doubles
dblAvailable = CLargeInt(liAvailable.lowpart, liAvailable.highpart)
dblTotal = CLargeInt(liTotal.lowpart, liTotal.highpart)
dblFree = CLargeInt(liFree.lowpart, liFree.highpart)

''Display the results
''Debug.Print "Available Space: " & dblAvailable & " bytes (" & _
'' Format(dblAvailable / 1024 ^ 3, "0.00") & " G) " & vbCr &
_
'' "Total Space: " & dblTotal & " bytes (" & _
'' Format(dblTotal / 1024 ^ 3, "0.00") & " G) " & vbCr & _
'' "Free Space: " & dblFree & " bytes (" & _
'' Format(dblFree / 1024 ^ 3, "0.00") & " G) "
FreeSpaceA = dblFree
End Function

Note: http://www.microsoft.com is a good source of information for
answering these questions. You can use the Dir() function to traverse
the directories.

Email attachments should be found compressed (cab format?) in some
hidden and somewhat secret MS directories that look something like
MW3RW5IR. Try Googling.

Browser history should be in something like C:\Windows\Temporary
Internet Files\Content.IE5 but it depends on the particular OS.

For getting the email address maybe check the Outlook Object Model for
it or maybe it''s stored in a Registry entry for the user''s email
reader.

Maybe others can give more detailed answers to these questions.

Do you have any particular users in mind on whom to test this concept?

James A. Fortune
CD********@FortuneJames.com

http://www.m-w.com/cgi-bin/dictionar...ouble+entendre


这篇关于是否可以从VBA过程中检查系统以读取和记录系统设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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