|
-
Jul 16th, 2003, 09:16 AM
#1
Thread Starter
Frenzied Member
HELP --> with understanding
Can someone explain how this typedef works? I dont see any INT or CHAR or ULONG type of declarations..
Code:
typedef enum _NDIS_802_11_NETWORK_TYPE
{
Ndis802_11FH,
Ndis802_11DS,
Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
} NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Jul 16th, 2003, 09:50 AM
#2
Frenzied Member
enum or enumeration simply assigns an integer value
Code:
enum coins {
penny, nickel, dime, quarter, haldollar,dollar
};
coins money;
money=dime;
printf("%d\n",money);
The result of the code will be 2
enum starts with zero so:
penny = 0
nickel = 1
dime = 2
etc.
You can only assign these values or perofrm boolean checks
against variables decalred as "money"
Code:
if (money=dime){
/* do something */
}
-
Jul 16th, 2003, 09:52 AM
#3
Thread Starter
Frenzied Member
So would it be safe to say this..
Ndis802_11FH = 0
Ndis802_11DS = 1
Ndis802_11NetworkTypeMax = 2
Rudy
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Jul 16th, 2003, 02:14 PM
#4
Frenzied Member
No.
Code:
typedef enum _NDIS_802_11_NETWORK_TYPE
{
Ndis802_11FH,
Ndis802_11DS,
Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
} NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
this would be "legal"
switch (NDIS_802_11_NETWORK_TYPE){
case Ndis802_11FH:
-- do something;
break;
case Ndis802_11DS:
-- do something
break;
case Ndis802_11NetworkTypeMax:
-- throw an error
break;
default:
break;
}
You can only compare enums to the values they have preassigned, or assign one of those preassigned values to a variable declared as that type. In ANSI C anyway.
-
Jul 16th, 2003, 02:18 PM
#5
Frenzied Member
Here's why you do not assume they are always 0,1,2,3....
Code:
typedef enum _NDIS_802_11_NETWORK_TYPE
{
Ndis802_11FH=1099,
Ndis802_11DS,
Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
} NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
now they are 1099,1100,1101
-
Jul 16th, 2003, 02:30 PM
#6
Thread Starter
Frenzied Member
Kind of understand..
If I send you a headder file, do you think you could turn a function int it into a function in VB??
Example:
there is a function called:
int WINAPI BMWL_SiteSurveyGet(PNDIS_802_11_BSSID_LIST bssidList, PULING listSize);
I need to make this an available function in VB (as an API) but so far I can't get it to work..
If you are interested send me an email and I will email it to you. I am leary about posting it on the board... to "public"
Rudy
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Jul 16th, 2003, 02:43 PM
#7
Thread Starter
Frenzied Member
Le tme add their are some structurs and stuff that go with that in the header file..
I cna create the API function in VB just fine, it the types arrays I am having trouble with...
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Jul 16th, 2003, 04:59 PM
#8
Frenzied Member
BMWL_SiteSurveyGet is not in the NDIS section of the DDK.
It must either be part of an existing driver (.drv) or part of a proprietary dll. I can't give you much help.
-
Jul 17th, 2003, 08:16 AM
#9
Thread Starter
Frenzied Member
It is part of a proprietary DLL but I have the headder file needed to build the functions.
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Jul 18th, 2003, 02:10 AM
#10
When using it from VB you have no choice but read the values of the constants and use them in VB. They might change in the future, but there's nothing you can do about it (and it's improbable anyway).
VB Code:
Private Const Ndis802_11FH = 0
Private Const Ndis802_11DS = 1
Private Const Ndis802_11NetworkTypeMax = 2
' int WINAPI BMWL_SiteSurveyGet(PNDIS_802_11_BSSID_LIST bssidList, PULING listSize);
Private Declare Function BMWLSiteSurveyGet Lib "whatever.dll" Alias "BMWL_SiteSurveyGet" _
(ByVal bssidList As Long, ByRef listSize As Long) As Long
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|