Results 1 to 10 of 10

Thread: HELP --> with understanding

  1. #1

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519

    Question 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".

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    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 */
    }

  3. #3

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    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".

  4. #4
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    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.

  5. #5
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    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

  6. #6

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    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".

  7. #7

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    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".

  8. #8
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    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.

  9. #9

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    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".

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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:
    1. Private Const Ndis802_11FH = 0
    2. Private Const Ndis802_11DS = 1
    3. Private Const Ndis802_11NetworkTypeMax = 2
    4.  
    5. ' int WINAPI BMWL_SiteSurveyGet(PNDIS_802_11_BSSID_LIST bssidList, PULING listSize);
    6. Private Declare Function BMWLSiteSurveyGet Lib "whatever.dll" Alias "BMWL_SiteSurveyGet" _
    7. (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
  •  



Click Here to Expand Forum to Full Width