Click here to Skip to main content
15,905,782 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC Grid control 2.26 Pin
Hamid_RT16-May-08 1:24
Hamid_RT16-May-08 1:24 
GeneralRe: MFC Grid control 2.26 Pin
Hamid_RT16-May-08 3:09
Hamid_RT16-May-08 3:09 
GeneralRe: MFC Grid control 2.26 Pin
capint16-May-08 23:14
capint16-May-08 23:14 
GeneralRe: MFC Grid control 2.26 Pin
Hamid_RT16-May-08 23:35
Hamid_RT16-May-08 23:35 
QuestionCapturing CAPS key changes and updating UI Pin
Member 26088015-May-08 5:26
Member 26088015-May-08 5:26 
AnswerRe: Capturing CAPS key changes and updating UI Pin
led mike15-May-08 5:56
led mike15-May-08 5:56 
AnswerRe: Capturing CAPS key changes and updating UI Pin
David Crow15-May-08 6:59
David Crow15-May-08 6:59 
QuestionHow to displaybitmap on second monitor? Pin
Soumyadipta15-May-08 5:24
Soumyadipta15-May-08 5:24 
I have attached two monitors two my system. Now i want to display a bitmap image on my second monitor.I am able to display a solid fill blue rectangle and able to display a text on it.


How can send a bitmap image?
Is it possible to send the raw image data without using the BITMAP?

Below is the code:
int count = 0;
void CMonitorTestDlg::OnBnClickedButtonFlashAll()
{
	CMonitor monitor;
	CMonitors monitors;

	CString cstr[2];
	

	for ( int i = 0; i < monitors.GetCount(); i++ )
	{		
		count = i+1;
		monitor = monitors.GetMonitor( i );
		FlashMonitor( monitor);
		Sleep( 500 );
	}
}
void CMonitorTestDlg::FlashMonitor( CMonitor& monitor, bool WorkSpace)
{
	CRect rect;

	if ( WorkSpace )
		//get the work area rect of the monitor this window is on
		monitor.GetWorkAreaRect( &rect );
	else
		monitor.GetMonitorRect( &rect );

	CMonitorDC dc( &monitor );
	
	if(count ==1)
	{
		// create and select a solid blue brush
		CBrush brushBlue(RGB(0, 255, 0));
		CBrush* pOldBrush = dc.SelectObject(&brushBlue);
						
		rect.DeflateRect(200,200);
		dc.Rectangle(&rect);

		COLORREF clr1 = RGB(0,0,0);
		dc.SetTextColor(clr1);
		dc.DrawText("Primary Monitor",17,&rect,1);

		// put back the old objects
		dc.SelectObject(pOldBrush);		
	}
	else
	{

		// create and select a solid blue brush
		/*CBrush brushBlue(RGB(0, 0, 255));
		CBrush* pOldBrush = dc.SelectObject(&brushBlue);
						
		rect.DeflateRect(200,200);
		dc.Rectangle(&rect);

		COLORREF clr1 = RGB(0,0,0);
		dc.SetTextColor(clr1);
		dc.DrawText("Secondary Monitor",17,&rect,1);

		// put back the old objects
		dc.SelectObject(pOldBrush);*/

                /*How can i send a bitmap image or a image buffer to second
                monitor.I have tried to use Bltblt but create compatibleDc
                need a CDC object not the CMonitor dc.*/
	}

	Sleep( 2000 );

	::InvalidateRect( NULL, &rect, TRUE );
}

Code that i have tried to send a bitmap
// load IDB_BITMAP1 from our resources
CBitmap bmp;
if (bmp.LoadBitmap(IDB_BITMAP1))
{
                 // Get the size of the bitmap
                 BITMAP bmpInfo;
		  bmp.GetBitmap(&bmpInfo);		  

		  // Create an in-memory DC compatible with the
		  // display DC we're using to paint				  

		  CDC dcMemory;
		  //dcMemory.CreateCompatibleDC(dc);	// Cant do this CMonitorDC * to CDC *  

		  // Select the bitmap into the in-memory DC
		  CBitmap* pOldBitmap = dcMemory.SelectObject(&bmp);

		  // Find a centerpoint for the bitmap in the client area
		  CRect rect1;
		  GetClientRect(&rect1);
		  int nX = rect.left + (rect1.Width() - bmpInfo.bmWidth) / 2;
		  int nY = rect.top + (rect1.Height() - bmpInfo.bmHeight) / 2;

		  // Copy the bits from the in-memory DC into the on-
		  // screen DC to actually do the painting. Use the centerpoint
		  // we computed for the target offset.
		  dc.BitBlt(nX, nY, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory, 
			 0, 0, SRCCOPY);

		  dcMemory.SelectObject(pOldBitmap);
}


Thanks
Soumyadipta De
QuestionApply a Low Pass filter on data with irregular time stamp Pin
jeremie.delaitre15-May-08 5:14
jeremie.delaitre15-May-08 5:14 
AnswerRe: Apply a Low Pass filter on data with irregular time stamp Pin
Nelek15-May-08 6:04
protectorNelek15-May-08 6:04 
GeneralRe: Apply a Low Pass filter on data with irregular time stamp Pin
jeremie.delaitre15-May-08 21:10
jeremie.delaitre15-May-08 21:10 
GeneralRe: Apply a Low Pass filter on data with irregular time stamp Pin
Nelek16-May-08 1:19
protectorNelek16-May-08 1:19 
GeneralRe: Apply a Low Pass filter on data with irregular time stamp Pin
jeremie.delaitre16-May-08 1:59
jeremie.delaitre16-May-08 1:59 
QuestionDifference between similar calls Pin
ilgale15-May-08 5:01
ilgale15-May-08 5:01 
AnswerRe: Difference between similar calls Pin
Nelek15-May-08 5:57
protectorNelek15-May-08 5:57 
AnswerRe: Difference between similar calls Pin
Matthew Faithfull15-May-08 6:13
Matthew Faithfull15-May-08 6:13 
Questionproblem to use java class from vc++ Pin
intermediate15-May-08 4:13
intermediate15-May-08 4:13 
AnswerRe: problem to use java class from vc++ Pin
CPallini15-May-08 4:21
mveCPallini15-May-08 4:21 
QuestionRe: problem to use java class from vc++ Pin
Nelek15-May-08 5:52
protectorNelek15-May-08 5:52 
QuestionRe: problem to use java class from vc++ Pin
CPallini15-May-08 6:01
mveCPallini15-May-08 6:01 
AnswerRe: problem to use java class from vc++ Pin
intermediate15-May-08 18:13
intermediate15-May-08 18:13 
GeneralRe: problem to use java class from vc++ Pin
CPallini15-May-08 21:00
mveCPallini15-May-08 21:00 
QuestionHash table source code [modified] Pin
fawadnasim15-May-08 3:28
fawadnasim15-May-08 3:28 
QuestionCan a dll understand which program calls it. Pin
maxMESA15-May-08 3:04
maxMESA15-May-08 3:04 
AnswerRe: Can a dll understand which program calls it. Pin
Matthew Faithfull15-May-08 3:15
Matthew Faithfull15-May-08 3:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.