|
|
Hi everyone,
I need some help
I'm trying to get the MAC addresses for physical NIC's on the local P.C using multiple methods, getadapterinfo and snmp.
I have one instance where a P.C has VPN software installed (not microsofts) and thier virtual adapter is returning in these programs with a adapter type = 6 (ethernet adapter). I need only physical addresses for use of licensing.
Is there any way to identifier what adapters are physical, and what adapters are virtual???
Also should all virtual adapters be classified as a PPP adapter???
any help would be appreciated
Thanks in advance
Gilc137
|
|
|
|
|
I am not really sure what you want,
but if you were to do it in Windows,
you can use WMI to query the Win32_NetworkAdapterConfiguration object to get the MAC address
or via the registry - SOFTWARE\\Microsoft\\Windows NT\\Current Version\\NetCards
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Thanks for your reply,
Let me just clarify exactly what I trying to do (I fairly new to this):-
We have a application software that can run on windows and currently the way the software licensing piece works, is that it using the netbios method to retrieve the NIC's mac address. This method works fine if you have netbios installed and are physically connected to a network. There are situations that clients do not have netbios or that they want to run this application on a standalone P.C (not connected to a network).
What I trying to do is to include other methods of obtaining the MAC addresses as part of the licensing checking to ensure that we get all valid ethernet MAC addresses from the physical network cards installed on the local server or local p.c, Then just pass a list of valid MAC address to the licensing function (Clients can have mupltiple network cards installed).
I have added the use of getadaptersinfo, snmp method (query through Winsock) and UuidCreateSequential (this only support single NIC's). On the first two methods I have coded it to only pick up ethernet adapters (adapter type = 6)
These other methods seem to work fine, but I have come accross a situation when someone has VPN software installed on there P.C (not microsoft VPN) and the methods that I have added are picking this virtual adapter MAC address (which is different from any of the network cards installed on the P.C).
Therefore I'm not sure if the 3rd party VPN software has defined thier virtual adapter incorrectly as a ethernet adpater(6), when they should have defined their adapter as a PPP adapter or anything other then a ethernet adapter. OR if there is a method to exclude VPN adapters so that I can return only valid MAC addresses from the physical network cards installed on the local server or local P.C
Apoligize for the long winded message.
Thanks for your suggestion,
Thanks in advance
Gilc137
|
|
|
|
|
Eventhough that they have VPN installed, they should not have been able to change the MAC address unless they have physically changed the NIC or they have more than one NIC installed.
One way to make sure you could get the MAC address you want is (ancient way)
Make a copy of WORKING MAC address into a text file or what so ever when the your program was initially installed into the system. When they have somehow did funny thing to make the MAC detection doesn't work . At least you have a backup MAC address. Of course this sound not too flexible but it can act as a backup plan to your solution.
Hope this helps
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi,
is there any way, how to do automatic code comments in C++? Microsoft added this feature only to C# in .NET 2003.
Pavel Celba
|
|
|
|
|
i think there are some free comment tools in the tools section of the codeproject.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
how do you get your program to communicate across a LAN?
til
|
|
|
|
|
By using Winsock. Search this site and you'll find a dozen of articles about network programming!
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
I guess ur problem is related to proxy servers... you need to know about the type of proxy server you have.. mostly it is HTTP 1.1
This space is empty.
|
|
|
|
|
Hi,
I wrote a test application that trapped WM_DEVICECHANGE. It worked fine so I tried the same thing in a service but I can't seem to catch events in services. Am quite a newbie to Visual C++ so would appreciate all the help i can get.
Can I trap such events in services?
Mark
|
|
|
|
|
Create a hidden window in the service and in then message proc you can then listen to the messages.
Interviewer (me) : "Did you install Linux all my yourself?"
Candidate : "Yes i installed Linux all my yourself."
|
|
|
|
|
Currently, I have this code in my on paint event in a view.
<br />
CPaintDC dc(this);<br />
<br />
CPoint originalSize = matrix.GetSize();<br />
int y, x;<br />
<br />
for (y = 0; y < size.y; y++)<br />
{<br />
for (x = 0; x < size.x; x++)<br />
{<br />
dc.SetPixelV(CPoint(x,y), obj.GetColorRef(CPoint(x, y)));<br />
}<br />
}<br />
<br />
As you can understand, this is pretty slow with soewhat bigger pictures where for example, tje size is over 1000 x 1000 pixels. A solution, as far as I know, is to use a memory DC. However, I am doing something wrong.
I want to create the memory DC with the following
<br />
CPaintDC dc(this);<br />
CDC pdc;<br />
dc.CreateCompatibleDC(&pdc);<br />
<br />
CPoint originalSize = matrix.GetSize();<br />
int y, x;<br />
<br />
for (y = 0; y < size.y; y++)<br />
{<br />
for (x = 0; x < size.x; x++)<br />
{<br />
pdc.SetPixelV(CPoint(x,y), obj.GetColorRef(CPoint(x, y)));<br />
}<br />
}<br />
<br />
dc.BitBlt(0, 0, size.x, size.y, ...) <br />
<br />
However, the first time only a black block was drawn then, when resizing things go wrong (the app crashes), where a colored block should be drawn. What am I doing wrong, and if I am doing it wrong, how should I do it?
LPCTSTR Dutch = TEXT("Double Dutch ");
|
|
|
|
|
You need to allocate a bitmap (ideally a DIBSection) of the appropriate size and select it into the device context. The default bitmap in a freshly created DC is 1x1. If you use a DIBSection, you can get direct access to the bitmap's pixel data. This can dramatically speed up pixel manipulation.
|
|
|
|
|
The effective way of createing a memory dc.
HDC memDC = CreateCompatibleDC ( hDC );
HBITMAP memBM = CreateCompatibleBitmap ( hDC );
SelectObject ( memDC, memBM );
Interviewer (me) : "Did you install Linux all my yourself?"
Candidate : "Yes i installed Linux all my yourself."
|
|
|
|
|
Go look in the "Bitmaps & Pallettes" section of codeproject; both CDibSectionLite and CDibData provide ways of accessing pixels directly without having to select them into a DC first.
Note: Accessing pixel data through any DC is very slow.
INTP
|
|
|
|
|
As was suggested before you need to create a compatible bitmap. You also need to pass the dc from the paint DC to the CreateCompatibleDC function, not the other way around.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
hi, i made a program in MFC C++ 6 and want to put music in the background. is there an easy way to do this?
thanks,
til
|
|
|
|
|
|
hi all,
iv been programming in MFC (visual c++ 6) for a few months and i am confused at the difference between public, and protected code. Whats the point of putting public at the top of a section, or private. Please help
many thanks
til
|
|
|
|
|
Protected indictates that only member functions, friends, and derived classes can access the members of that class. Public indicates that the members of that class are accessible by all. Private indicates that only member functions and friends can access the members of that class.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
private keeps things from being utilized by other classes on accident, or maybe even another user if you plan to let someone else use your classes down the line.
Protected only allows access by derived classes, so it's private to itself and any of its children that are derived from it.
public is letting everyone have access, so that if you have a CEdit control object declared as public, another dialog or screen can access it.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Cheers guys, i appreciate it alot
til
|
|
|
|
|
I am using MFC, how would I go about finding and displaying all of the CD/DVD drives of the users computer? I have been looking around for articles, and have not found anything yet. Any help is appreciated.
-Dev578
|
|
|
|
|
Take a look at _getdrives() and GetDriveType() in MSDN.
There is also an example.
|
|
|
|