473,324 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Is it possible to examine a system from within a VBA procedure to read and document system settings?

MLH
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.
Feb 9 '06 #1
10 1973
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.


Feb 9 '06 #2
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
Feb 9 '06 #3
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

Feb 10 '06 #4
Que sera, sera
Whatever will be, will be
The future's not ours to see
Que sera, sera
What will be, will be

Feb 10 '06 #5
MLH
How about fixing your PC clock?


Yep. You're right. Big apology to all for that.
I'm always testing apps that have chronologically
dependent procedures and must often advance
the stupid system clock to test them. I'm terribly
absent minded about the settings I've made. If
interrupted, I leave the work open to go put out
the fire. By the time I return, am lucky to have
a clue as to what I was doing - let alone remembering
the fact that I made the change.

Am curious if there's a system clock simulator that
I could somehow direct all my apps to while under
development. I could play with that all I wanted
during development. Then upon deployment of an
app, I could do a global find 'n replace to change
all references to the FAKE clock in favor of the
real system clock. Anybody ever toyed with that
idea?
Feb 10 '06 #6
MLH
>Do you have any particular users in mind on whom to test this concept?
Nope. Will test it on myself 'n roll it out to about a dozen sites
after I squash all the bugs.

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

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


Feb 13 '06 #7
Make all of your time checks relative to a global constant time interval.
Set the interval appropriate for your development work, then set it to 0
before release. That way you only change it in one place.

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
"MLH" <CR**@NorthState.net> wrote in message
news:mr********************************@4ax.com...
How about fixing your PC clock?


Yep. You're right. Big apology to all for that.
I'm always testing apps that have chronologically
dependent procedures and must often advance
the stupid system clock to test them. I'm terribly
absent minded about the settings I've made. If
interrupted, I leave the work open to go put out
the fire. By the time I return, am lucky to have
a clue as to what I was doing - let alone remembering
the fact that I made the change.

Am curious if there's a system clock simulator that
I could somehow direct all my apps to while under
development. I could play with that all I wanted
during development. Then upon deployment of an
app, I could do a global find 'n replace to change
all references to the FAKE clock in favor of the
real system clock. Anybody ever toyed with that
idea?


Feb 13 '06 #8
MLH
Good suggestion. Certainly better than doing nothing at all.
Feb 13 '06 #9
MLH <CR**@NorthState.net> wrote in
news:nq********************************@4ax.com:
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.


Get one of the books on using WMI (Windows Management Interface) with
VBScript. Or, grok around on MSDN's scripting resources page. They even
have a tool called "Scriptomatic", which is a web-based app, to generate
VBScript for you.

WMI is probably the way to go about doing this kind of heavy lifting,
otherwise you're going to be writing a bunch of Windows API calls to get
the stuff, as well as querying the Registry. WMI is the path of least
resistance for getting a lot of this stuff.

How to use WMI within VBA, then? Well, reference the "Microsoft Scripting
Runtime" (it's got some very useful objects in it that VBA doesn't, such
as the Dictionary object). Next, reference the "Microsoft WMI Scripting
V1.1 Library", or something similarly named.

Off the top of my head, pasting VBScript code into VBA should work just
fine for the most part. If you want it to run faster, then, reference the
WMI library directly.

If your buddy doesn't have WMI (it's installed with Win2K and higher),
it's downloadable from Microsoft.

It's just not worth wrestling with the Win32 API to get some of this
stuff, unless you just want to learn how to call C API calls from VBA. If
you go this route, SAVE YOUR WORK before you run something, because if it
bombs on the API call, you'll probably lock up Access for sure (or
possibly Windows...) and will lose your work...

Mar 30 '06 #10
MLH
Good suggestions, thx Corey.

Apr 1 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hal Vaughan | last post by:
I think I read something about this and I may just be using the wrong terms in search engines. I thought I read about a process where I could write Java classes that would be stored on a server...
1
by: M Wells | last post by:
Hi All, Further to my previous long-winded question about a situation in which we appear to be mysteriously losing data from our mssql2k server. We discovered an update statement, in the...
5
by: Klemens | last post by:
I get SQL30090 reason 18 by trying to do an insert in a federated table and an update in a local table in one transaction Do I have to change some settings to get done or ist this not possible by...
4
by: Greg Bell | last post by:
Hi, Can someone tell me where to look to enable me to read "Folder Options" user settings for hidden/system files from within C#/VB.Net/Any other .NET language. I'm pretty sure it must be part...
3
by: Danny | last post by:
Hello, I was wondering if anyone knew if it was possible to make changes to an application's App.config file at runtime and then be able to access those changes immediately. The following is...
1
by: Billy Hart | last post by:
I am getting this error on my win 2000 server when a .net app that a programmer in my office developed. I have read other posts about the issue but the resolutions to those posts did not solve the...
7
by: Peter Afonin | last post by:
Hello, I'm using this code to access a network share from an asp.net page: Dim dir As DirectoryInfo = New DirectoryInfo("\\10.0.0.150\FormLib\") Dim files() As FileInfo = dir.GetFiles("*.eps")...
8
by: K Viltersten | last post by:
I understand that the new versions of MS Word, MS Excel etc. allow for creation of a document using XML tags (the technique or format is called OOXML, i think). I imagine that the idea behind...
3
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I need to store some configuration settings in a db using an 2 fileds ID Field and String Field The ID Field is a unique key and the string holds a xml string that store my settings...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.