Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to add full path #include ? Pin
k505412-Dec-23 5:31
mvek505412-Dec-23 5:31 
GeneralRe: how to add full path #include ? Pin
jschell12-Dec-23 11:10
jschell12-Dec-23 11:10 
GeneralRe: how to add full path #include ? Pin
Dave Kreskowiak12-Dec-23 11:19
mveDave Kreskowiak12-Dec-23 11:19 
GeneralRe: how to add full path #include ? Pin
k505412-Dec-23 5:30
mvek505412-Dec-23 5:30 
GeneralRe: how to add full path #include ? Pin
jschell12-Dec-23 11:06
jschell12-Dec-23 11:06 
AnswerRe: how to add full path #include ? Pin
Mircea Neacsu10-Dec-23 8:11
Mircea Neacsu10-Dec-23 8:11 
AnswerRe: how to add full path #include ? Pin
Richard MacCutchan10-Dec-23 21:48
mveRichard MacCutchan10-Dec-23 21:48 
Question[edit: most problems fixed, one problem remaining] Invalidate rectangle follow up, flickering and no movement Pin
Calin Negru9-Dec-23 23:10
Calin Negru9-Dec-23 23:10 
[edit] I solved the background flickering problem by changing the last argument in the InvalidateRect() function to false. I also got the test rectangle moving. The only problem left is that the white moving rectangle is still flickering.
[/edit]

I wrote some code, for some reason the rectangle that should work as background is flickering and I can`t get a test rectangle to move.
I`m pasting the source bellow, please help me get my code in proper configuration.

while (WM_QUIT != msg.message)
{
	if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	else
	{
		UpdateGame();
	}
}

//...
switch (msg)
{
case WM_PAINT:
	hdc = BeginPaint(hwnd, &ps);
	draw(hdc);
    movingR = movingR + 0.1;
	RECT ARectangle;
	ARectangle.left = 0;
	ARectangle.top = 0;
	ARectangle.right = 600;
	ARectangle.bottom = 600;
	
	InvalidateRect(hwnd, &ARectangle, false);
	UpdateWindow(hwnd);
	
	EndPaint(hwnd, &ps);
	return 0;
//...

void draw(HDC hdc)
{
	Gdiplus::Graphics gf(hdc);
	Gdiplus::Pen pen(Gdiplus::Color(255, 255, 0, 0));
	Gdiplus::SolidBrush brush(Gdiplus::Color(255, 0, 255, 0));
	Gdiplus::SolidBrush brush2(Gdiplus::Color(255, 255, 255, 255));

	gf.FillRectangle(&brush, 0, 0, 600, 600);
	gf.FillRectangle(&brush2,(int)movingR, 200, 100, 100);

}
//...

void UpdateGame()
{
	//movingR = movingR + 1;
}


modified 10-Dec-23 7:50am.

AnswerRe: [edit: most problems fixed, one problem remaining] Invalidate rectangle follow up, flickering and no movement Pin
Mircea Neacsu10-Dec-23 2:03
Mircea Neacsu10-Dec-23 2:03 
AnswerRe: [edit: most problems fixed, one problem remaining] Invalidate rectangle follow up, flickering and no movement Pin
Richard MacCutchan10-Dec-23 2:20
mveRichard MacCutchan10-Dec-23 2:20 
GeneralRe: [edit: most problems fixed, one problem remaining] Invalidate rectangle follow up, flickering and no movement Pin
Calin Negru10-Dec-23 4:48
Calin Negru10-Dec-23 4:48 
Questiondownload a web page Pin
mike74116-Dec-23 4:30
mike74116-Dec-23 4:30 
AnswerRe: download a web page Pin
Mircea Neacsu6-Dec-23 5:00
Mircea Neacsu6-Dec-23 5:00 
GeneralRe: download a web page Pin
mike74116-Dec-23 13:28
mike74116-Dec-23 13:28 
GeneralRe: download a web page Pin
Mircea Neacsu6-Dec-23 14:18
Mircea Neacsu6-Dec-23 14:18 
AnswerRe: download a web page Pin
jschell6-Dec-23 6:52
jschell6-Dec-23 6:52 
AnswerRe: download a web page Pin
Gerry Schmitz6-Dec-23 7:28
mveGerry Schmitz6-Dec-23 7:28 
Questioncopying a file in C++17 Pin
mike74115-Dec-23 21:36
mike74115-Dec-23 21:36 
AnswerRe: copying a file in C++17 Pin
Richard MacCutchan5-Dec-23 22:07
mveRichard MacCutchan5-Dec-23 22:07 
AnswerRe: copying a file in C++17 Pin
jschell6-Dec-23 7:04
jschell6-Dec-23 7:04 
Questionprintf without stdio.h Pin
mike74115-Dec-23 5:21
mike74115-Dec-23 5:21 
AnswerRe: printf without stdio.h Pin
Mircea Neacsu5-Dec-23 5:31
Mircea Neacsu5-Dec-23 5:31 
GeneralRe: printf without stdio.h Pin
mike74115-Dec-23 16:23
mike74115-Dec-23 16:23 
GeneralRe: printf without stdio.h Pin
Mircea Neacsu5-Dec-23 16:42
Mircea Neacsu5-Dec-23 16:42 
AnswerRe: printf without stdio.h Pin
Victor Nijegorodov5-Dec-23 5:32
Victor Nijegorodov5-Dec-23 5:32 

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.