|
Hi..
I think i can help you in this regard,because iam working in this area for past 2 months...
But i dont understand your question properly...
Can u pls explain it little more clearly... What exact you want to do?
Is it, to find the MAC address of a XP machine??
Waiting for your reply...
With Best Regards,
A.Ilamparithi
|
|
|
|
|
Yes please do help, no just not XP but any machine, just wanted to understand how to use LANA numbers or just set them to zero and hope for just on nic.
|
|
|
|
|
Hi
first we must find the LANANUM.
LANA_ENUM lna;
NCB nb;
memset((void*)&nb,0,sizeof(NCB));
memset((void*)&lna,0,sizeof(LANA_ENUM));
nb.ncb_buffer = (UCHAR*)&lna;
nb.ncb_length = sizeof(LANA_ENUM);
nb.ncb_command = NCBENUM;
int hh = Netbios(&nb);
int iLanaNum=lna.lana[0]; // here we got the LANANUM
Then you must reset the NCB.
NCB ncb;
UCHAR uRetCode;
memset( &ncb, 0, sizeof(ncb) );
ncb.ncb_command = NCBRESET; // note NCBRESET to reset.
ncb.ncb_lana_num = iLanaNum;
uRetCode = Netbios( &ncb );
Then to find the status, here it is MAC Address, set the command as NCBSTAT.
TCHAR MacAddress[20];
_TCHAR host[16];
ncb.ncb_callname,"MODBUS " ); // here MODBUS is the host name.It must be exactly 15 characters long(Since Netbios names are always 15 characters long). Remaining pad it to spaces.
ncb.ncb_lana_num = iLanaNum;
ncb.ncb_buffer = (unsigned char *) &Adapter;
ncb.ncb_length = sizeof(Adapter);
ncb.ncb_command = NCBASTAT;
uRetCode = Netbios( &ncb ); // make netbios call
printf( "The NCBASTAT return code is: 0x%x \n", uRetCode );
if ( uRetCode == 0 )
{
printf( MacAddress,"%02x-%02x-%02x-%02x-%02x-%02x",
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] );
It works well in all versions of Windows.
Regards,
A.Ilamparithi
|
|
|
|
|
My question,
I execute a ping to a device with the ShellExecuteEx, How can I know if the ping has been successfully??
thanks in advance
|
|
|
|
|
No don't do it that way, it is not a good practice. Look for article by Chris Maunder for MFC ping or just write a console app.
Best Wishes,
ez_way
Wait big error! It was not Chris it was P.J. Naughter in 1999. I made the mistake because they both look alike
|
|
|
|
|
I don't found the article by Chris Maunder, can you tell me the exact title??
thanks
|
|
|
|
|
hi
It is P.J. Naughter article...
Look at it!!!
With Best Regards,
A.Ilamparithi
|
|
|
|
|
No it was P.J. Naughter, and his url is http://www.naughter.com
he and chris worked together, well sort of at codeguru years ago.
|
|
|
|
|
How about a link?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
the application sends this error when compiling, I am not using MFC, I use the Win Api 32 with #include <windows.h>, but the ping classe is designed for MFC, somebody has another solution for monitor a ping to a device?
c:\archivos de programa\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
thanks
|
|
|
|
|
So you want a solution that does not use MFC. Is that correct? You could take what you already have and redirect it to a temporary file and then parse the contents of that file. Something like:
ShellExecute("ping a.b.c.d > ping.out", ...);
I don't know if this would actually work as I've not tried it, nor would I opt for this type of solution.
A more preferred solution would be to use the ICM protocol directly. Examples are plentiful.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
A numpty question I think
I declare a CList in my header (VC6)
public:
CList (less than)CString, CString&(greater than) wordList;
Compiles fine but when I go to use it in a helper function I get an error.
if (!AfxIsValidAddress(pOb, sizeof(CObject)))
{
TRACE0("ASSERT_VALID fails with illegal pointer.\n");
if (AfxAssertFailedLine(lpszFileName, nLine))
AfxDebugBreak();
return; // quick escape
}
If I then go and add the CList declaration into the helper function and comment
out the header declaration it all works fine.
Any Ideas?????
Confused!!!!
Dave
|
|
|
|
|
Why not just use the CStringList class?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Last time I just built my own linked lists using CStrings, I just thought this time I'd try one of the in built templates. The question is more why cant I use this when it is declared in my header but can if declared in the function it's being used in.
I'll have a look at CStringList though!!
Thanks, Dave.
Dave
|
|
|
|
|
Hi.
I need help for create in vc++.net/vc++6 .
When I create template class in vc++ it gives error.
My code is like this :
template <class t="">
class p : public q
....
(I already write it in c++5 , it worked right)
Thank you
|
|
|
|
|
What is the error?
- Mike
|
|
|
|
|
Is there any way of setting toolbar buttons text NOT TO ALL buttons? I mean, buttons which do have text, should have proper size, and buttons which DO NOT have text should be of standard size (something like 24x23 etc.) All my attempts to set button info via CToolbarCtrl::SetButtonInfo() were doomed to failure .
|
|
|
|
|
Sure, if you can group your large an small buttons. Just add another toolbar with the larger buttons. Also if you wish to do it programatically you must leave MFC and build a win32 app.
Best Wishes,
ez_way
|
|
|
|
|
Hi All...
Do any one of you know how to get the MAC address of a system... using SNMP...?
If so, Can u say me the OID that is to be used other than 1.3.6.1.2.1.2.2.1.6
can u pls help if u know...?
Regards,
A.Ilamparithi
|
|
|
|
|
Have you looked at this?
http://www.codeproject.com/internet/getmac.asp
Best Wishes,
ez_way
|
|
|
|
|
Hi Baldwin
Thanks for reply..
I had already seen the getting MAC address using Netbios.
But,i need to get MAC Address using SNMP.
Thanks.
Best Regards,
A.Ilamparithi
|
|
|
|
|
Look at P.J. Naughter class on sntp and see if that might work.
Best Wishes,
ez_way
|
|
|
|
|
Does GetAdaptersInfo() help?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I have problem with sizeof() function in my VC++ 6.0 compiled project
struct A
{
short b;
char c;
}a;
int t = sizeof(a); gives me t=4;
----------------------------------------
I think it have to be 3
struct A
{
char c;
}a;
int t = sizeof(a); gives me t=1; all right
struct A
{
short b;
}a;
int t = sizeof(a); gives me t=2; all right
I think that I have some problem with my project settings but I do not what.
In some other projct the sizeof() works in way a want it gives 3 for the structure above.
Can someoen explan the reason of the sizeof() function behavier.
Thank you in advance,
Seval YILMAZ
|
|
|
|
|
struct elements are aligned to boundaries (particularly word boundaries) to improve performance. Use #pragma pack(push,1) and #pragma pack(pop) to align a struct on byte boundaries:
#pragma pack(push,1)
struct A
{
short b;
char c;
}a;
#pragma pack(pop)
- Mike
|
|
|
|