Discussion:
Win32 GDI problem with drawing lines on loaded Bitmap
(too old to reply)
ajai
2012-03-30 15:07:02 UTC
Permalink
Hello
i have loaded a bit map into my DC. and i am drawing a line on that loaded bi
map. Drawing on the loaded bitmap fails

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

In this code LineTo function fails..
can anyone help me pleas

regards
Ajai
Barry Schwarz
2012-04-14 18:03:06 UTC
Permalink
On Fri, 30 Mar 2012 10:07:02 -0500, ajai
Hello,
i have loaded a bit map into my DC. and i am drawing a line on that loaded bit
map. Drawing on the loaded bitmap fails.
hDC = GetDC( g_hWnd );
hDCMem = ::CreateCompatibleDC( hDC );
dwError = ::GetLastError();
hBitmap = ::LoadBitmap( g_hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ));
dwError = ::GetLastError();
hPrevObj = ::SelectObject( hDCMem, hBitmap );
dwError = ::GetLastError();
hPrevObj1 = ::SelectObject( hDCMem, g_hPen );
dwError = ::GetLastError();
BOOL bStat = MoveToEx( hDCMem, g_X, g_Y,&g_Point );
bStat = ::LineTo( hDCMem, g_X, g_Y+1 );
dwError = ::GetLastError();
bStat = ::BitBlt( hDC, 0,0, 240,82,hDCMem, 0,0, SRCCOPY );
::SelectObject( hDCMem, hPrevObj1);
In this code LineTo function fails...
can anyone help me please
This newsgroup is pretty inactive. You may have better luck asking on
the Microsoft forums.
--
Remove del for email
Loading...