Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Not able to draw a line on the Bitmap loaded using win32 apis

6 views
Skip to first unread message

ajai

unread,
Mar 30, 2012, 11:07:19 AM3/30/12
to
Hello,
i am trying to draw a line on a bitmap loaded into memory. but that line
drawing
function fails if i am trying to draw aline using the DC to which that bitmap
image is loaded.

Code is as follows:

HGDIOBJ hPrevObj = 0;
HGDIOBJ hPrevObj1 = 0;
hDC = GetDC( g_hWnd );
hDCMem = ::CreateCompatibleDC( hDC );
dwError = ::GetLastError();
hBitmap = ::LoadBitmap( g_hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ));
dwError = ::GetLastError();
hPrevObj = ::SelectObject( hDC, hBitmap );
dwError = ::GetLastError();
hPrevObj1 = ::SelectObject( hDC, g_hPen );
dwError = ::GetLastError();
BOOL bStat = MoveToEx( hDC, g_X, g_Y,&g_Point );
dwError = ::GetLastError();
bStat = ::LineTo( hDC, g_X, g_Y+1 );
dwError = ::GetLastError();
bStat = ::BitBlt( hDC, 0,0, 240,82,hDCMem, 0,0, SRCCOPY );
::SelectObject( hDCMem, hPrevObj1);
dwError = ::GetLastError();
::SelectObject( hDCMem, hPrevObj);
dwError = ::GetLastError();


can anyone please help
0 new messages