469,643 Members | 1,800 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

Seeking old Access 2.0 code for reading MAC address

MLH
Would like to roll out something in Access 2.0 to read MAC
address on 16-bit systems. Have resolved on 32-bit platforms
but still need help with Access Basic code to do it from within
Access 2.0.
Nov 13 '05 #1
28 1991
On Fri, 01 Jul 2005 14:16:52 -0400, MLH <CR**@NorthState.net> wrote:
Would like to roll out something in Access 2.0 to read MAC
address on 16-bit systems. Have resolved on 32-bit platforms
but still need help with Access Basic code to do it from within
Access 2.0.

Hi
Best of luck.
If you mean 16 bit platform eg Win3 don't think you can get it using
API, it is in device driver for network card or in INI file
somewhere.
If you mean running Access2 on 32 bit machine I would store the MAC in
a file by running some other (32 bit) program first, then read from
the file.
Note, MAC not always same as NIC eg machine may have been ghosted,
or be linked by cable modem and USB.
HTH David

Nov 13 '05 #2
MLH
<censored>
Yep. Sure do. Some customers have 16-bit win3x boxes and I'm bending
over backwards to support them. I like A2.0 and am quite familiar with
it. Since I can do it, I do. But reading the MAC address, I'm probably
gonna need a C-program to do the work & write the results to a text
file. I was just hoping Access Basic and an API call might do the
trick.

That last note shakes me a bit. I definitely want to read it directly
off the hard-coded address on the NIC itself. What does ghosting
mean and what impact might cable modem links and USB have on
my reading the NIC's MAC address. I can't afford to screw up. There's
no room for ambiguity, I'm afraid.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Best of luck.
If you mean 16 bit platform eg Win3 don't think you can get it using
API, it is in device driver for network card or in INI file
somewhere.
If you mean running Access2 on 32 bit machine I would store the MAC in
a file by running some other (32 bit) program first, then read from
the file.
Note, MAC not always same as NIC eg machine may have been ghosted,
or be linked by cable modem and USB.
HTH David


Nov 13 '05 #3
MLH
David, important is the fact that I'm running software locally
on the PC in which the NIC is installed and it is that local
NIC whose MAC address I'm attempted to read. I'm not trying
to read one across a network or WAN or anything like that.

Am I still facing the host of uncertainties you mentioned?
Nov 13 '05 #4

"MLH" <CR**@NorthState.net> wrote
. . .. But reading the MAC address, I'm
probably gonna need a C-program to do
the work & write the results to a text
file. I was just hoping Access Basic and
an API call might do the trick.


Very likely, you can find an API call that will work with Access Basic.
Almost, but not quite, all API calls that could be done from VB could also
be done from Access Basic. So, the place to start searching for those calls
would be VB websites (a good starting point is http://www.mvps.org, then
find the links to MVP's websites for VB -- almost all of them will have a
lot of API information, and some may go back to Win 3.x days) or VB
newsgroups (you can search the old posts at http://groups.google.com....
comp.lang.basic.visual.misc is a USENET newsgroup where you might start
searching).

Don't rush out to hire a C programmer, or brush up your 16-bit dialects of C
programming skills, before you poke around a bit.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #5
On Sat, 02 Jul 2005 04:01:01 GMT, "Larry Linson"
<bo*****@localhost.not> wrote:

"MLH" <CR**@NorthState.net> wrote
. . .. But reading the MAC address, I'm
probably gonna need a C-program to do
the work & write the results to a text
file. I was just hoping Access Basic and
an API call might do the trick.


Very likely, you can find an API call that will work with Access Basic.
Almost, but not quite, all API calls that could be done from VB could also
be done from Access Basic. So, the place to start searching for those calls
would be VB websites (a good starting point is http://www.mvps.org, then
find the links to MVP's websites for VB -- almost all of them will have a
lot of API information, and some may go back to Win 3.x days) or VB
newsgroups (you can search the old posts at http://groups.google.com....
comp.lang.basic.visual.misc is a USENET newsgroup where you might start
searching).

Don't rush out to hire a C programmer, or brush up your 16-bit dialects of C
programming skills, before you poke around a bit.

Larry Linson
Microsoft Access MVP

Hi
My belief is that Win3 didn't support network cards directly but that
there was some DOS thingy which set up the information in the driver,
either in booting up or on installation. I don't think there is any
direct API to get it. It may be possible to shell out to ipconfig in
some way.
David

Nov 13 '05 #6
MLH wrote:
Would like to roll out something in Access 2.0 to read MAC
address on 16-bit systems. Have resolved on 32-bit platforms
but still need help with Access Basic code to do it from within
Access 2.0.


http://www.planetsourcecode.com/vb/s...50934&lngWId=1

--
[OO=00=OO]
Nov 13 '05 #7
On Fri, 01 Jul 2005 22:51:29 -0400, MLH <CR**@NorthState.net> wrote:
David, important is the fact that I'm running software locally
on the PC in which the NIC is installed and it is that local
NIC whose MAC address I'm attempted to read. I'm not trying
to read one across a network or WAN or anything like that.

Am I still facing the host of uncertainties you mentioned?

Hi
(this answer is for Win32, not 16 bit platforms)
Not the cable modem one, not sure about the other.

Ghosting is used when support staff need to set up a lot of PCs with
the same configuration. They normally all have the same MAC.The MAC
can also be spoofed for other reasons, eg see "change Mac Address in
seconds!" at http://amac.paqtool.com/

or look at http://www.klcconsulting.net/smac/readme.htm
which says
"SMAC was developed for RESPONSIBLE, LEGAL AND ETHICAL USE ONLY!!!"

The registry holds the spoofed MAC, not sure what NetBIOS can give
you.
David
..

Nov 13 '05 #8
MLH
<censored>
Sounds interesting, but can I get a MAC address with ipconfig somehow?

Hi
My belief is that Win3 didn't support network cards directly but that
there was some DOS thingy which set up the information in the driver,
either in booting up or on installation. I don't think there is any
direct API to get it. It may be possible to shell out to ipconfig in
some way.
David


Nov 13 '05 #9
MLH
Thanks, Trevor. I had a look at it. Appears to be quite thorough.
Am writing the author, as he requested, to tell him I would like to
use his code. I'll try it out for sure.

http://www.planetsourcecode.com/vb/s...50934&lngWId=1


Nov 13 '05 #10
On Sat, 02 Jul 2005 10:29:15 -0400, MLH <CR**@NorthState.net> wrote:
<censored>
Sounds interesting, but can I get a MAC address with ipconfig somehow?

Hi
My belief is that Win3 didn't support network cards directly but that
there was some DOS thingy which set up the information in the driver,
either in booting up or on installation. I don't think there is any
direct API to get it. It may be possible to shell out to ipconfig in
some way.
David

Hi
In Win32 you would do this:

1. Create a file C:\getconfig.bat consisting of

ipconfig /all >C:\config.txt

2. launch this file using ShellWait (see http://www.mvps.org) (or just
shell out and doevents and wait a few seconds)

3. open the file config.txt and parse out the information you want.
(Easier said than done, look for lines "physical address".However not
obvious which one is primary NIC. Also I'm not sure this is really the
physical address though it probably is.)

In the above instead of C: you should really get a suitable path, eg
use apiGetTempDir (also http://www.mvps.org) though C:\temp would
probably be OK.

In Win3.x you can do more or less the same probably but this all looks
far too complicated.
David

Nov 13 '05 #11
MLH wrote:
Thanks, Trevor. I had a look at it. Appears to be quite thorough.
Am writing the author, as he requested, to tell him I would like to
use his code. I'll try it out for sure.

http://www.planetsourcecode.com/vb/s...50934&lngWId=1



It may not be the only one on that site, but it was the first I came
across that had 16 bit version as well. I just searched for "MAC
Address" in language "Visual Basic", of course it seems to do an "or"
search so there's a lot of address book applications in the results.

--
[OO=00=OO]
Nov 13 '05 #12
MLH <CR**@NorthState.net> wrote in
news:d5********************************@4ax.com:
David, important is the fact that I'm running software locally
on the PC in which the NIC is installed and it is that local
NIC whose MAC address I'm attempted to read. I'm not trying
to read one across a network or WAN or anything like that.

Am I still facing the host of uncertainties you mentioned?


Yes, of course.

I don't know what happens if the NIC is disabled in Windows, though.
It may be that neither of the methods provided will work.

Stepping back a bit for the big picture, I think you're wasting your
time trying to tie your application to the MAC of the machine it's
installed on. I've never ever written an application where any form
of copy protection or licensing was necessary, and I never intend to
do so.

That's because of several factors:

1. nothing I do is actually unique enough to justify the extra time.
That is, anybody with smarts could reverse engineer my work just by
examining the part they'd be allowed to see as a licensed user.

2. the amount of time it takes to write and test these things is
HUGE, and it also increases the failure rate of installations by a
vast margin.

3. the apps I do are all customized to the clients' needs, and that
means there's been lots of time invested with the client working out
what they need. Their investment of time went into that application
(in addition to the money they paid me for investing *my* time), so
they are, in a sense, co-authors of the apps. Thus, there's no
benefit to them to try to steal, since they'd be, in effect,
stealing from themselves.

4. if they tried to give it away to someone else, if it didn't break
because of things hardwired to their own setup (like network paths
and the like), it probably wouldn't work all the well, precisely
because of #3, since it's so carefully adapted to the particular
clients' needs.

5. I've never had an idea that was unique enough that I figured I
could market something to multiple clients. Yes, at one time I was
providing the same application to penny stock brokerage firms, but
those don't really exist any more. Yes, I have my parking garage app
that I've sold 3 times, but each time I make major adaptations to
the particular customer's setup (you'd be surprised at how much
variety there is). To redesign an app to handle all possibilities
would vastly increase the complexity of it, and require far, far
more testing than just adapting it for each new customer that comes
along.

So, maybe you should not bother with worrying about the MAC address
at all.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #13
Trevor Best <no****@besty.org.uk> wrote in
news:42***********************@news.zen.co.uk:
MLH wrote:
Would like to roll out something in Access 2.0 to read MAC
address on 16-bit systems. Have resolved on 32-bit platforms
but still need help with Access Basic code to do it from within
Access 2.0.


http://www.planetsourcecode.com/vb/s...sp?txtCodeId=5
0934&lngWId=1


That code doesn't work if NetBIOS over TCP/IP is turned off -- I
just tested it, and it worked only after I turned on NetBIOS.

Last of all, none of the code I've mentioned here, including the
above, returns a value if the NIC is disabled. This means that an
un-used NIC won't provide you with a MAC address, as you said in
another post is your requirement.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #14
MLH
Well put! You might have just saved me a lot
of trouble. I think I'll try it, but I'll have a cheat
code to give users on whose machine it doesn't
work. That'll blow my security out-a-the water
right there. Well, life's a joke anyway. There
are more important things to worry about such
as health and those you love.

I appreciate your thoughtful comments.
Nov 13 '05 #15
MLH
Yeah. You're right. I'm gonna set this app up for users making one
of the system requirements a high speed internet connection. I'm
hoping that will equate to each of them having a NIC installed. Am
I making an assumption that is unreliable?

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Last of all, none of the code I've mentioned here, including the
above, returns a value if the NIC is disabled. This means that an
un-used NIC won't provide you with a MAC address, as you said in
another post is your requirement.


Nov 13 '05 #16
MLH wrote:
Yeah. You're right. I'm gonna set this app up for users making one
of the system requirements a high speed internet connection. I'm
hoping that will equate to each of them having a NIC installed. Am
I making an assumption that is unreliable?

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Last of all, none of the code I've mentioned here, including the
above, returns a value if the NIC is disabled. This means that an
un-used NIC won't provide you with a MAC address, as you said in
another post is your requirement.



I'd search for code that allows you to do a ARP request and submit your current (local) IP
address as the IP to use in the ARP request. This will return the MAC address.

Let's see if I can quickly find VB code to do this....

Here - this will get you on the right track:

http://vbnet.mvps.org/index.html?cod...ressremote.htm

--
'---------------
'John Mishefske
'---------------
Nov 13 '05 #17
David W. Fenton wrote:
Last of all, none of the code I've mentioned here, including the
above, returns a value if the NIC is disabled. This means that an
un-used NIC won't provide you with a MAC address, as you said in
another post is your requirement.


I'm using an app that's tied to my MAC address ATM, thought I'd be safe
on my laptop as the NIC is always enabled (well, I never disable it). I
send the output of "ipconfig/all" to the company to get a license, all
was well until I got fed up with the wireless NIC disconnecting due to
low signal and disabled that (wired NIC still enabled). You can guess
what's coming next, yep, they'd tied the thing to my wireless NIC and
not the wired one.

--
[OO=00=OO]
Nov 13 '05 #18
MLH
<censored>
compile error, user defined type not defined...
Dim proc As PROCESS_INFORMATION
Is what I get in the class module running the
shellwait call. I cut 'n pasted it right out-a-the
mvps.org site.


2. launch this file using ShellWait (see http://www.mvps.org) (or just
shell out and doevents and wait a few seconds)

<snip>
Maybe I'll just try shelling, doeventing and waiting.
Nov 13 '05 #19
MLH
<snip>

2. launch this file using ShellWait (see http://www.mvps.org) (or just
shell out and doevents and wait a few seconds)

<snip>
Best way to wait a few seconds? I know you're not gonna say a do-loop.
But don't know what you will say. I'm still struggling with A97
unfamiliarity. Sorry.
Nov 13 '05 #20
Trevor Best <no****@besty.org.uk> wrote in
news:42***********************@news.zen.co.uk:
David W. Fenton wrote:
Last of all, none of the code I've mentioned here, including the
above, returns a value if the NIC is disabled. This means that an
un-used NIC won't provide you with a MAC address, as you said in
another post is your requirement.


I'm using an app that's tied to my MAC address ATM, thought I'd be
safe on my laptop as the NIC is always enabled (well, I never
disable it). I send the output of "ipconfig/all" to the company to
get a license, all was well until I got fed up with the wireless
NIC disconnecting due to low signal and disabled that (wired NIC
still enabled). You can guess what's coming next, yep, they'd tied
the thing to my wireless NIC and not the wired one.


Well, that raises the issue of how an app developer deals with
supporting changes of configuration. I wouldn't want the enormous
headache of having to support this kind of configuration.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #21
You wrote
Yeah. You're right. I'm gonna set this app up for users making one
of the system requirements a high speed internet connection. I'm
hoping that will equate to each of them having a NIC installed. Am
I making an assumption that is unreliable?

Probably. You can get a high speed Internet connection with a USB modem
and not a NIC in sight (yes, I know that won't work for a Win 3.x setup,
bus one of your clients may have an updated machine). It also seems a
tad unlikely to me that a PC that's still running Win 3.x would have the
grunt to make a broadband connection worthwhile.

Out of interest, does all this talk of MAC addresses mean anything if
you're on token ring -- the last Win 3.x network I used ran that, rather
than ethernet.
--
Albert Marshall
Marshall Le Botmel Ltd
01242 222017
Nov 13 '05 #22
On Sun, 03 Jul 2005 13:42:46 -0400, MLH <CR**@NorthState.net> wrote:
<censored>
compile error, user defined type not defined...
Dim proc As PROCESS_INFORMATION
Is what I get in the class module running the
shellwait call. I cut 'n pasted it right out-a-the
mvps.org site.


2. launch this file using ShellWait (see http://www.mvps.org) (or just
shell out and doevents and wait a few seconds)

<snip>
Maybe I'll just try shelling, doeventing and waiting.

Hi
1.
Did you copy all the text? the private type is declared in it.
You should use an ordinary module not a class module.
2.
Private Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)

Public Sub Wait(Seconds As Single)

Dim lMilliSeconds As Long
lMilliSeconds = Seconds * 1000
Sleep lMilliSeconds

End Sub

David

Nov 13 '05 #23
MLH
WHat app was that, Trevor?
Nov 13 '05 #24
MLH
AFAIK, yes.
xxxxxxxxxxxxxxxxxxxxx

Out of interest, does all this talk of MAC addresses mean anything if
you're on token ring -- the last Win 3.x network I used ran that, rather
than ethernet.


Nov 13 '05 #25
MLH wrote:
WHat app was that, Trevor?


I-Sketch - http://www.alias.ltd.uk/products/isketch.htm

--
[OO=00=OO]
Nov 13 '05 #26
MLH
Hey, John. That's super cool. I can retrieve MAC addresses from my
gentoo linux box on my LAN. It doesn't work on my WFW 3.11 box.
Dunno why not. No possibility of this being used to read the MAC
addresses on machines on the web? I assume not. But I do like
this. Thank-you.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I'd search for code that allows you to do a ARP request and submit your current (local) IP
address as the IP to use in the ARP request. This will return the MAC address.

Let's see if I can quickly find VB code to do this....

Here - this will get you on the right track:

http://vbnet.mvps.org/index.html?cod...ressremote.htm


Nov 13 '05 #27
MLH
Pipe drawing, ehhh? Does that include meerschaums, water
pipes and bongs of all varieties? With pipe drawings like that,
one could have pipe dreams.
Nov 13 '05 #28
MLH wrote:
Pipe drawing, ehhh? Does that include meerschaums, water
pipes and bongs of all varieties? With pipe drawings like that,
one could have pipe dreams.


Nah, it's for designing a new screensaver for Longhorn.

--
[OO=00=OO]
Nov 13 '05 #29

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Greg M | last post: by
11 posts views Thread by joelbyrd | last post: by
7 posts views Thread by Cheryl Langdon | last post: by
2 posts views Thread by ramasubramanian.rahul | last post: by
13 posts views Thread by kolmogolov | last post: by
13 posts views Thread by evancater | last post: by
5 posts views Thread by dhcrusoe | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.