I need help with this translation... Not sure what I missed. I'm hoping for a sharp C/C++ eye that can spot it.
Thanks, much appreciated in advance!
Regards,
Jules
C/C++ code...
PB code...
Thanks, much appreciated in advance!
Regards,
Jules
C/C++ code...
Code:
void CInPlaceEdit::PrepareBackground( CRect pos ) { CClientDC thisDC( this ); CClientDC parentDC( GetParent() ); CDC thisMem; INT OldParentMapMode = parentDC.SetMapMode( MM_LOENGLISH ); CBitmap* pOldThisBmp; thisMem.CreateCompatibleDC( &thisDC ); INT OldThisMapMode = thisMem.SetMapMode( MM_LOENGLISH ); CSize sz = pos.Size(); m_Background.DeleteObject(); m_Background.CreateCompatibleBitmap( &thisDC, sz.cx, -sz.cy ); pOldThisBmp = thisMem.SelectObject( &m_Background ); thisMem.BitBlt( 0, 0, sz.cx, sz.cy, &parentDC, pos.left, pos.top, SRCCOPY ); thisMem.SetMapMode( OldThisMapMode ); thisMem.SelectObject( pOldThisBmp ); parentDC.SetMapMode( OldParentMapMode ); m_Brush.DeleteObject(); m_Brush.CreatePatternBrush( &m_Background ); if ( m_Brush.m_hObject != NULL ) m_Brush.UnrealizeObject(); }
Code:
'------------------------------------------------------------------------------ ' Get area of bitmap located under control and ' returns handle to a pattern brush ' don't forget to destroy brush when finished with it. ' ' %wm_ctlcoloredit ' hBrush = SelectObject(wParam,hObject) ' SetBrushOrg( wParam, 0, 0, BYVAL %NULL ) ' Call SetBkMode(wParam,%TRANSPARENT) ' FUNCTION = hBrush :EXIT FUNCTION '------------------------------------------------------------------------------ FUNCTION PrepareBackground( BYVAL hCtl AS DWORD,BYVAL rc AS RECT ) AS DWORD LOCAL ClientDC AS DWORD LOCAL parentDC AS DWORD LOCAL memDC AS DWORD LOCAL hBrush AS DWORD LOCAL lResult AS LONG LOCAL OldParentMapMode AS DWORD LOCAL OldThisMapMode AS DWORD LOCAL OldThisBmp AS DWORD LOCAL hBkgrndBitmap AS DWORD LOCAL pt AS POINTAPI clientDC = GetDC(hCtl) parentDC = GetDC(GetParent(hCtl)) OldParentMapMode = SetMapMode( parentDC,%MM_LOENGLISH ) memDC = CreateCompatibleDC( clientDC ) OldThisMapMode = SetMapMode( memDC, %MM_LOENGLISH ) pt.x = rc.nRight - rc.nLeft 'width pt.y = rc.nBottom - rc.nTop 'height Call DeleteObject(hBkgrndBitmap) hBkgrndBitmap = CreateCompatibleBitmap( memDC, pt.x, -pt.y ) OldThisBmp = SelectObject(memDC, hBkgrndBitmap ) lResult = BitBlt(memDC,0,0, pt.x, pt.y, parentDC, rc.nleft,rc.ntop, %SRCCOPY ) lResult = SetMapMode(memDC, OldThisMapMode ) lResult = SelectObject(memDC, OldThisBmp ) lResult = SetMapMode(parentDC, OldParentMapMode ) lResult = DeleteObject(hBrush) lResult = DeleteDC( memDC ) lResult = ReleaseDC( hCtl, clientDC) lResult = ReleaseDC( GetParent(hCtl), parentDC) hBrush = CreatePatternBrush( hBkgrndBitmap ) IF ( hBrush = %NULL ) THEN lResult = UnrealizeObject(hBrush) END IF Call DeleteObject(hBkgrndBitmap) FUNCTION = hBrush END FUNCTION 'call to function... 'GetWindowRect GetDlgItem(hWnd,%IDC_EDIT_1), rc 'hBrush = PrepareBackground(GetDlgItem(hWnd,%IDC_EDIT_1),rc)
Comment