Click here to Skip to main content
15,914,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalquickcam project Pin
mark18231-Jan-05 14:33
mark18231-Jan-05 14:33 
GeneralRe: quickcam project Pin
mcsherry31-Jan-05 21:48
mcsherry31-Jan-05 21:48 
QuestionWho can help me about hooks using hot-key? Pin
TTT8131-Jan-05 14:02
TTT8131-Jan-05 14:02 
AnswerRe: Who can help me about hooks using hot-key? Pin
RicoH1-Feb-05 0:39
RicoH1-Feb-05 0:39 
GeneralIgnore Windows key + M Pin
Mike Hell31-Jan-05 12:36
Mike Hell31-Jan-05 12:36 
GeneralWM_PAINT seems not working Pin
int01hh31-Jan-05 12:28
int01hh31-Jan-05 12:28 
GeneralRe: WM_PAINT seems not working Pin
beerboy_2231-Jan-05 13:31
beerboy_2231-Jan-05 13:31 
GeneralRe: WM_PAINT seems not working Pin
JohnCz31-Jan-05 14:12
JohnCz31-Jan-05 14:12 
You should never send WM_PAINT message. This should be invoked by using Invalidate or InvalidateRect.

Use timer and make change of a drawing bitmap here. After that call Invalidate.
For example:
Bitmaps and index value are declared in header file:

CBitmap m_Bitmap[2];<br />
UINT m_uiIndx;<br />


In OnInitDialog bitmaps (array of 2) are loaded and timer set up.

BOOL CSomeDlg::OnInitDialog() <br />
{<br />
	CDialog::OnInitDialog();<br />
	<br />
	m_Bitmap[0].LoadBitmap(IDB_BITMAP1);<br />
	m_Bitmap[1].LoadBitmap(IDB_BITMAP2);<br />
<br />
	SetTimer(23, 600, NULL);<br />
	<br />
	return TRUE;  // return TRUE unless you set the focus to a control<br />
	              // EXCEPTION: OCX Property Pages should return FALSE<br />
}<br />


Timer sets index of a bitmap and calls Invalidate.

void CSomeDlg::OnTimer(UINT nIDEvent) <br />
{<br />
	if(++m_uiIndx > 1) //change bitmap index<br />
	{<br />
		m_uiIndx = 0;<br />
	}<br />
	Invalidate();<br />
<br />
	CDialog::OnTimer(nIDEvent);<br />
}<br />

In OnPaint proper bitmap is displayed

void CSomeDlg::OnPaint() <br />
{<br />
	CPaintDC dc(this); // device context for painting<br />
	<br />
	CDC memDC;<br />
	memDC.CreateCompatibleDC(&dc);<br />
<br />
	BITMAP bm;<br />
	m_Bitmap[m_uiIndx].GetBitmap(&bm);<br />
<br />
	CBitmap *pOld = memDC.SelectObject(&m_Bitmap[m_uiIndx]);<br />
	dc.BitBlt(15, 15, bm.bmWidth, bm.bmHeight, &memDC, 0, 0, SRCCOPY);<br />
<br />
	memDC.SelectObject(pOld);<br />
	<br />
}<br />




JohnCz
GeneralRe: WM_PAINT seems not working Pin
int01hh3-Feb-05 9:02
int01hh3-Feb-05 9:02 
GeneralList Control displays no Text Pin
RobertW10031-Jan-05 8:16
RobertW10031-Jan-05 8:16 
GeneralAnother user interface Thread Question Pin
Tom Wright31-Jan-05 7:39
Tom Wright31-Jan-05 7:39 
Generalpluggab;e protocol handler in MFC Pin
Wim Jans31-Jan-05 7:35
Wim Jans31-Jan-05 7:35 
GeneralSerbian letters problem Pin
User 91483331-Jan-05 7:29
User 91483331-Jan-05 7:29 
GeneralRe: Serbian letters problem Pin
John R. Shaw31-Jan-05 7:54
John R. Shaw31-Jan-05 7:54 
GeneralString bugs out Pin
Gadjuka31-Jan-05 7:23
Gadjuka31-Jan-05 7:23 
GeneralRe: String bugs out Pin
Wes Aday31-Jan-05 9:21
professionalWes Aday31-Jan-05 9:21 
GeneralRe: String bugs out Pin
Gadjuka31-Jan-05 10:47
Gadjuka31-Jan-05 10:47 
GeneralRe: String bugs out Pin
Gadjuka2-Feb-05 12:06
Gadjuka2-Feb-05 12:06 
GeneralMute the volume in Windows XP Pin
Aneurysm0031-Jan-05 7:10
Aneurysm0031-Jan-05 7:10 
GeneralRe: Mute the volume in Windows XP Pin
David Crow31-Jan-05 9:18
David Crow31-Jan-05 9:18 
GeneralRe: Mute the volume in Windows XP Pin
Aneurysm001-Feb-05 3:10
Aneurysm001-Feb-05 3:10 
GeneralRe: Mute the volume in Windows XP Pin
David Crow1-Feb-05 3:51
David Crow1-Feb-05 3:51 
GeneralRe: Mute the volume in Windows XP Pin
Aneurysm001-Feb-05 5:58
Aneurysm001-Feb-05 5:58 
Questionhow to read hexadecimal input in an editbox Pin
cbaykal31-Jan-05 7:03
cbaykal31-Jan-05 7:03 
AnswerRe: how to read hexadecimal input in an editbox Pin
John R. Shaw31-Jan-05 7:39
John R. Shaw31-Jan-05 7:39 

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.