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???
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
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.
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.
Currently, I have this code in my on paint event in a view.
CPaintDC dc(this);<br />
CPoint originalSize = matrix.GetSize();<br />
int y, x;<br />
for (y = 0; y < size.y; y++)<br />
for (x = 0; x < size.x; x++)<br />
dc.SetPixelV(CPoint(x,y), obj.GetColorRef(CPoint(x, y)));<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.
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?
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.
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
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)
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.