Article View: borland.public.cppbuilder.nativeapi
Article #1006Re: how to get netcard mac address
From: zhoufanenator
Date: Wed, 31 Oct 2007 04:02
Date: Wed, 31 Oct 2007 04:02
76 lines
3453 bytes
3453 bytes
On Oct 31, 2:09 pm, zhoufanena...@gmail.com wrote:
> On Oct 31, 1:59 pm, zhoufanena...@gmail.com wrote:
>
> > On Sep 30, 1:33 am, "zhan wei ming" <zhanweim...@hotmail.com> wrote:
>
> > > Hi,
> > > Can anybody tell me how to get netcard mac address?
>
> > > Thanks,
> > > Zhan
>
> > 'getmac' in dos
>
> Or in bcb
>
> Sample Code
> -----------
>
> #include <windows.h>
> #include <wincon.h>
> #include <stdlib.h>
> #include <stdio.h>
> #include <time.h>
>
> typedef struct _ASTAT_
> {
> ADAPTER_STATUS adapt;
> NAME_BUFFER NameBuff [30];
> }ASTAT, * PASTAT;
>
> ASTAT Adapter;
>
> void main (void)
>
> {
> NCB Ncb;
> UCHAR uRetCode;
> char NetName[50];
>
> memset( &Ncb, 0, sizeof(Ncb) );
> Ncb.ncb_command = NCBRESET;
> Ncb.ncb_lana_num = 0;
>
> uRetCode = Netbios( &Ncb );
> printf( "The NCBRESET return code is: 0x%x \n", uRetCode );
>
> memset( &Ncb, 0, sizeof (Ncb) );
> Ncb.ncb_command = NCBASTAT;
> Ncb.ncb_lana_num = 0;
>
> strcpy( Ncb.ncb_callname, "* " );
> Ncb.ncb_buffer = (char *) &Adapter;
>
> Ncb.ncb_length = sizeof(Adapter);
>
> uRetCode = Netbios( &Ncb );
> printf( "The NCBASTAT return code is: 0x%x \n", uRetCode );
> if ( uRetCode == 0 )
> {
> printf( "The Ethernet Number is: %02x%02x%02x%02x%02x%02x\n",
> Adapter.adapt.adapter_address[0],
> Adapter.adapt.adapter_address[1],
> Adapter.adapt.adapter_address[2],
> Adapter.adapt.adapter_address[3],
> Adapter.adapt.adapter_address[4],
>
> Adapter.adapt.adapter_address[5] );
> }
> }
or
in win xp:
control panel >>> network connections>>>open it>>>choose one
connection(for example:local area connections )>>>right click>>>choose
status>>> Support>>>Detail...>>>pyhsical address
Technical Details
Message-ID:
<1193803323.950442.199420@i38g2000prf.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!i38g2000prf.googlegroups.com!not-for-mailReferences:
<46fe6444@newsgroups.borland.com> <1193799586.401466.27690@v29g2000prd.googlegroups.com> <1193800169.732669.51260@v29g2000prd.googlegroups.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,4a7fdb078d856a0a X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!i38g2000prf.googlegroups.com!not-for-mail From: zhoufanenator@gmail.com Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: how to get netcard mac address Date: Tue, 30 Oct 2007 21:02:03 -0700 Organization: http://groups.google.com Lines: 77 Message-ID: <1193803323.950442.199420@i38g2000prf.googlegroups.com> References: <46fe6444@newsgroups.borland.com> <1193799586.401466.27690@v29g2000prd.googlegroups.com> <1193800169.732669.51260@v29g2000prd.googlegroups.com> NNTP-Posting-Host: 202.12.144.21 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1193803324 7634 127.0.0.1 (31 Oct 2007 04:02:04 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 31 Oct 2007 04:02:04 +0000 (UTC) In-Reply-To: <1193800169.732669.51260@v29g2000prd.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.0 ncai (NetCache NetApp/5.6.2R1D28), 1.1 ncao (NetCache NetApp/5.6.2R1D28) Complaints-To: groups-abuse@google.com Injection-Info: i38g2000prf.googlegroups.com; posting-host=202.12.144.21; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0