Results 1 to 6 of 6

Thread: Another stupid question by a VBer

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Location
    Canada
    Posts
    202

    Another stupid question by a VBer

    or maybe it should be Another question by a stupid VBer

    No really... What does this code mean particularly the (BYTE)?

    Code:
    bmp.bmBitsPixel = 
                (BYTE) GetDeviceCaps(hdcScreen, BITSPIXEL);
    Thanks a mil.

  2. #2
    It's a typecast; it converts what GetDeviceCaps returns into a BYTE.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Location
    Canada
    Posts
    202
    So In Vb could I write the following?

    VB Code:
    1. bmp.bmBitsPixel = CByte(GetDeviceCaps(hdcScreen, BITSPIXEL))

  4. #4
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Yes, but in vb the function returns long.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  5. #5
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    it is a typecast so it has be in the following format in C++:

    PHP Code:
    (TYPECAST)
    //So if you want to return a specific type of value then
    //for byte
    (BYTE)
    //for a handle
    (HWND)

    //and there are lots of others 
    Baaaaaaaaah

  6. #6
    jim mcnamara
    Guest
    Code in C++ uses a lot of casting and special datatypes - which all are really one of a few datatypes, just like in VB.

    ANY declaration that is in caps is one of these things
    LPCSTR
    BYTE x; <- dim x as Byte (signed ie, -127 - +127, with no negative numbers
    (BYTE) <- type cast

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