WIN32 general query

Discussion in 'Win32' started by sas1992, Oct 3, 2008.

  1. sas1992

    sas1992 New Member

    Joined:
    Jul 8, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    HINSTANCE hinst
    HWND hWnd,
    UINT wMsgFilterMin
    UINT wMsgFilterMax
    UINT wRemoveMsg
    DWORD dw
    Can these be regarded as variables as we regard (int x) x as a variable???





    Any help will be appreciated.
     
  2. Cosmic_egg

    Cosmic_egg New Member

    Joined:
    Jul 21, 2008
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    0
    HINSTANCE hinst
    HWND hWnd,
    UINT wMsgFilterMin
    UINT wMsgFilterMax
    UINT wRemoveMsg
    DWORD dw
    Yes all are variables,
    only thing is HWND and HINSTACE is defined as unsigned 32-bit quantities in windows.h but should not be modified by the programmer.
    UINT is unsigned integer and DWORD is 32 bit usigned integer. These can be used a normal variable
    see link for more clarity and details
    http://en.wikibooks.org/wiki/Windows_Programming/Handles_and_Data_Types#HANDLE
     
  3. sas1992

    sas1992 New Member

    Joined:
    Jul 8, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Why doesnt Windows use int, char, unsigned int datatypes??????
     
  4. Cosmic_egg

    Cosmic_egg New Member

    Joined:
    Jul 21, 2008
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    0
    "so that when you are reading the code, you know exactly what type of variable it is. "
    see Hungarian Notation in the link that I sent in the first reply.

    This is mainly for good readabilty of code and easier programming for complex codes.
    eg 1) DWORD is always 32 bytes int can be 16 , 32, 64 depending on machine.
    2) when I say HWND variable name, I know that the variable represent an handle to window which would not be known if i use int, also HWND is encapsulated and user need not worry about underlying datatype.
    3) when using int , int is taken as unsigned int in some machine and signed in some machine,
    which causing bugs in the code. for different os.
    i think the list goes on, just have to think about it.
     
  5. oogabooga

    oogabooga New Member

    Joined:
    Jan 9, 2008
    Messages:
    115
    Likes Received:
    11
    Trophy Points:
    0
    You're thinking of "char" which is signed on some machines and unsigned on others.
    In C/C++, "int" is always signed.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice