Click to See Complete Forum and Search --> : C++ --> VB


slcotten
October 11th, 2001, 08:31 AM
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.

slcotten
October 11th, 2001, 08:34 AM
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)

DSJ
October 11th, 2001, 11:14 AM
haven't tried it, but that looks right...

John G Duffy
October 11th, 2001, 12:51 PM
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

slcotten
October 11th, 2001, 02:56 PM
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!

slcotten
October 11th, 2001, 04:23 PM
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

John G Duffy
October 11th, 2001, 06:39 PM
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