CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: C++ --> VB

  1. #1
    Join Date
    Apr 2001
    Posts
    95

    C++ --> VB

    How would the following to lines of C++ code be translated to VB? Particularly the -> and &~ symbols?


    BitBlt(ps.hdc, prect->left, prect->top,
    (prect->right - prect->left),
    (prect->bottom - prect->top), hdcScreenCompat,
    prect->left + xCurrentScroll,
    prect->top + yCurrentScroll,
    SRCCOPY);



    bmp.bmWidthBytes = ((bmp.bmWidth + 15) &~15)/8;





    Thanks a mil.


  2. #2
    Join Date
    Apr 2001
    Posts
    95

    Re: C++ --> VB

    Would the first line be translated like this?


    Call BitBlt(ps.hdc, prect.Left, prect.Top, (prect.Right - prect.Left), (prect.Bottom - prect.Top), hdcScreenCompat, prect.Left + xCurrentScroll, prect.Top + yCurrentScroll, SRCCOPY)






  3. #3
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: C++ --> VB

    haven't tried it, but that looks right...


  4. #4
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: C++ --> VB

    Here is the VB API version of BitBlt

    Const SRCCOPY = &HCC0020 ' Copies image exactly
    Const SRCAND = &H8800C6 ' Used for mask
    Const SRCPAINT = &HEE0086 ' Used for Transparencies
    Const SRCINVERT = &H660046 ' XOR
    Const SRCERASE = &H440328 ' dest = source AND (NOT dest )
    private Declare Function BitBlt Lib "gdi32" _
    (byval hDestDC as Long, _
    byval X as Long, _
    byval Y as Long, _
    byval nWidth as Long, _
    byval nHeight as Long, _
    byval hSrcDC as Long, _
    byval xSrc as Long, _
    byval ySrc as Long, _
    byval dwRop as Long) as Long



    the constants are used for dwRop

    John G

  5. #5
    Join Date
    Apr 2001
    Posts
    95

    Re: C++ --> VB

    Ok... but what does the &~ in this code mean? I know that ~ is a unary operator but how would you port it to VB?

    bmp.bmWidthBytes = ((bmp.bmWidth + 15) &~15)/8;

    Thanks!


  6. #6
    Join Date
    Apr 2001
    Posts
    95

    Re: C++ --> VB

    Does anyone know if this would be a proper VB translation of the C++ code in the previous post?


    bmp.bmWidthBytes = ((bmp.bmWidth + 15) And Not (15)) / 8








  7. #7
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: C++ --> VB

    You will need a C++ expert to interpret that. THe definitions of & (ampersand) and ~ (tilde) in my C++ primer do not match what I see in your example.
    & (ampersand) meand AddressOF
    ~ ( Tilde) denotes the destructor method of a class

    John G

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

Featured