Click here to Skip to main content
15,921,542 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Maximizing Pin
Paul M Watt23-Nov-02 6:51
mentorPaul M Watt23-Nov-02 6:51 
GeneralRe: Maximizing Pin
S O S23-Nov-02 7:31
S O S23-Nov-02 7:31 
GeneralRe: Maximizing Pin
Paul M Watt23-Nov-02 7:41
mentorPaul M Watt23-Nov-02 7:41 
GeneralRe: Maximizing Pin
S O S23-Nov-02 21:31
S O S23-Nov-02 21:31 
GeneralGetting the active view Pin
S O S22-Nov-02 22:53
S O S22-Nov-02 22:53 
GeneralRe: Getting the active view Pin
Gero Gerber22-Nov-02 23:12
Gero Gerber22-Nov-02 23:12 
GeneralRe: Getting the active view Pin
S O S22-Nov-02 23:45
S O S22-Nov-02 23:45 
GeneralWriting an nice OSDesktop! Pin
Behzad Ebrahimi22-Nov-02 22:47
Behzad Ebrahimi22-Nov-02 22:47 
Need Nice OSDesktop!

I wrote the follwing code to write a sample text everywhere of desktop so on clock. But I can not delete it by my program!!!
You can test this in a simple DialogBase program.
Please guid meEek! | :eek:

void CMyProgDlg::OnShowResolution() <br />
{<br />
	CString sTempMsg;<br />
<br />
	hWnd = GetDesktopWindow()->GetSafeHwnd();<br />
	hdc = ::GetWindowDC( hWnd );<br />
	nSDC = SaveDC( hdc );<br />
<br />
	DEVMODE dd;<br />
	ZeroMemory(&dd, sizeof(dd));<br />
	dd.dmSize = sizeof(dd);<br />
	EnumDisplaySettings( NULL, ENUM_CURRENT_SETTINGS, &dd);<br />
<br />
	CFont oldFont,newFont;<br />
    LOGFONT lfA;<br />
    ZeroMemory( &lfA, sizeof( LOGFONT ) );<br />
    lstrcpy( lfA.lfFaceName, "Comics Sans MS" ); // Modern<br />
	int nSize = 10;<br />
	<br />
	lfA.lfWeight = FW_DEMIBOLD;<br />
	lfA.lfHeight = 2 * nSize;<br />
	lfA.lfWidth  = 1 * nSize;<br />
	newFont.CreateFontIndirect( &lfA );<br />
<br />
	//oldFont.Attach( SelectObject( hdc, newFont ) );<br />
	SelectObject( hdc, newFont );<br />
	<br />
	<br />
	SetBkMode(hdc, TRANSPARENT); //OPAQUE );<br />
	SetBkColor( hdc, NULL ); //RGB(255,255,0) );<br />
	COLORREF oldColor = SetTextColor(hdc, RGB(170,255,50) );//RGB(0,255,0) );<br />
	SetTextAlign( hdc, TA_RIGHT);<br />
<br />
	TEXTMETRIC tm;<br />
	GetTextMetrics( hdc, &tm );<br />
<br />
	int x = dd.dmPelsWidth-5 , y=35;<br />
	int FarNextLine = tm.tmHeight;<br />
	<br />
	sTempMsg.Format( "My Display Setting..." );<br />
	TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
<br />
	//::DeleteDC( hdc );<br />
	//::ReleaseDC( hWnd, hdc );<br />
<br />
	// SetBkMode(hdc, TRANSPARENT); //OPAQUE );<br />
	// sTempMsg.Format( "_______________________" );<br />
	// TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
// <br />
	// sTempMsg.Format( "_______________________" );<br />
	// TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
<br />
	y += 2*FarNextLine;<br />
	sTempMsg.Format("Resolution : [%4d , %4d]",<br />
					dd.dmPelsWidth, dd.dmPelsHeight );<br />
	TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
<br />
	y += FarNextLine;<br />
	sTempMsg.Format("Color=%2dBits", dd.dmBitsPerPel );<br />
	TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
<br />
	y += FarNextLine;<br />
	sTempMsg.Format("RefreshRate=%3d Hz", dd.dmDisplayFrequency );<br />
	TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
<br />
	SetTextColor(hdc, oldColor );<br />
	<br />
}<br />

GeneralRe: Writing an nice OSDesktop! Pin
Gary R. Wheeler23-Nov-02 2:39
Gary R. Wheeler23-Nov-02 2:39 
GeneralDll entry point error Pin
suresh_sathya22-Nov-02 22:06
suresh_sathya22-Nov-02 22:06 
QuestionHow upgrade my program automatically? Pin
Behzad Ebrahimi22-Nov-02 21:49
Behzad Ebrahimi22-Nov-02 21:49 
AnswerRe: How upgrade my program automatically? Pin
Anders Molin23-Nov-02 5:39
professionalAnders Molin23-Nov-02 5:39 
GeneralRe: How upgrade my program automatically? Pin
25-Nov-02 19:33
suss25-Nov-02 19:33 
GeneralBtmap editor Pin
codexxxxx22-Nov-02 20:06
codexxxxx22-Nov-02 20:06 
GeneralLoadBitmap(UINT) results in null dBits Pin
MJ522-Nov-02 19:45
MJ522-Nov-02 19:45 
GeneralMFC Questions Pin
tanuki2222-Nov-02 19:25
tanuki2222-Nov-02 19:25 
GeneralRe: MFC Questions Pin
Pavel Klocek22-Nov-02 21:33
Pavel Klocek22-Nov-02 21:33 
Generalmanually highlight a node in a tree control. Pin
trustno122-Nov-02 18:05
trustno122-Nov-02 18:05 
GeneralRe: manually highlight a node in a tree control. Pin
Michael Dunn22-Nov-02 19:25
sitebuilderMichael Dunn22-Nov-02 19:25 
QuestionHow to add new folder button Pin
sansingh22-Nov-02 17:58
sansingh22-Nov-02 17:58 
AnswerRe: How to add new folder button Pin
Atlantys22-Nov-02 18:13
Atlantys22-Nov-02 18:13 
GeneralBitmaps Pin
Steven M Hunt22-Nov-02 17:14
Steven M Hunt22-Nov-02 17:14 
GeneralRe: Bitmaps Pin
Christian Graus22-Nov-02 17:26
protectorChristian Graus22-Nov-02 17:26 
GeneralThe Art of Writing Comments :: Software Engineering Pin
valikac22-Nov-02 17:11
valikac22-Nov-02 17:11 
GeneralRe: The Art of Writing Comments :: Software Engineering Pin
Matt Gullett22-Nov-02 18:03
Matt Gullett22-Nov-02 18:03 

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.