Converting a DWORD to INT

This is a discussion on Converting a DWORD to INT within the C++ Programming forums, part of the General Programming Boards category; Hey, i'm trying to use GetLastError in a funcion to and return the result but i need the value to ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Location
    England, Norwich
    Posts
    38

    Question Converting a DWORD to INT

    Hey,

    i'm trying to use GetLastError in a funcion to and return the result but i need the value to be a int but i have no idea how to convert and DOWRD value to a INT value.

    i'll be Greatful for help.

    Thanks
    1 or 0, Alive Or Dead!
    -------------------------
    OS: Windows XP
    Complier: MinGW
    IDE: Dev-cpp

  2. #2
    #define WORLD "sad place" LinuxCoder's Avatar
    Join Date
    Mar 2006
    Location
    Portugal
    Posts
    89
    Code:
    (int)var;
    int(var);
    static_cast<int>(var);
    It should happen naturally i'd think. Afaik DWORD is only a typedef for an unsigned int.
    Last edited by LinuxCoder; 04-11-2006 at 12:05 PM.

  3. #3
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    unsigned long.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  4. #4
    #define WORLD "sad place" LinuxCoder's Avatar
    Join Date
    Mar 2006
    Location
    Portugal
    Posts
    89
    hmmm, what seems the difference between
    Code:
    unsigned int;
    and:
    Code:
    unsigned long;
    . I believe an int is a signed long no?
    Last edited by LinuxCoder; 04-11-2006 at 12:26 PM.

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,911
    Well, sizeof(long) >= sizeof(int)
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Registered User
    Join Date
    Jan 2006
    Location
    England, Norwich
    Posts
    38
    Thanks for you help it works perfect now

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. memory leak
    By aruna1 in forum C++ Programming
    Replies: 3
    Last Post: 08-17-2008, 10:28 PM
  2. Drawing Program
    By Max_Payne in forum C++ Programming
    Replies: 21
    Last Post: 12-21-2007, 04:34 PM
  3. Replies: 2
    Last Post: 03-24-2006, 07:36 PM
  4. getting a headache
    By sreetvert83 in forum C++ Programming
    Replies: 41
    Last Post: 09-30-2005, 05:20 AM
  5. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21