Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Going the speed of light is bad for your age.


devel / comp.os.ms-windows.programmer.win32 / GDIPlus WM_PAINT problem when another window moves over it

SubjectAuthor
* GDIPlus WM_PAINT problem when another window moves over itR.Wieser
`* Re: GDIPlus WM_PAINT problem when another window moves over itChristian Astor
 +- Re: GDIPlus WM_PAINT problem when another window moves over itChristian Astor
 `* Re: GDIPlus WM_PAINT problem when another window moves over itR.Wieser
  `* Re: GDIPlus WM_PAINT problem when another window moves over itChristian Astor
   `- Re: GDIPlus WM_PAINT problem when another window moves over itR.Wieser

1
GDIPlus WM_PAINT problem when another window moves over it

<sse36g$1ms4$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=342&group=comp.os.ms-windows.programmer.win32#342

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!BHGTVyTGRwF2ntnqLVfpDg.user.46.165.242.75.POSTED!not-for-mail
From: address@not.available (R.Wieser)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: GDIPlus WM_PAINT problem when another window moves over it
Date: Fri, 21 Jan 2022 11:50:43 +0100
Organization: Aioe.org NNTP Server
Lines: 20
Message-ID: <sse36g$1ms4$1@gioia.aioe.org>
Injection-Info: gioia.aioe.org; logging-data="56196"; posting-host="BHGTVyTGRwF2ntnqLVfpDg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
X-RFC2646: Format=Flowed; Original
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
 by: R.Wieser - Fri, 21 Jan 2022 10:50 UTC

Hello all,

I'm using GDIPlus to display an image in a controls WM_PAINT event
(BeginPaint, GdipCreateFromHDC, GdipDraw, GdipDeleteGraphics, EndPaint).
This works.

The problem occurs when I move another window over the control : I get a
mish-mash of the origional image interleaved with gray areas following
moved-over window.

Although I've found some ham-fisted solution by calling 'InvalidateRect'
just before 'BeginPaint' (causing a second paint event which covers op the
gray areas) I would like to know what correct way is to handle the problem.

Remark: I'm using the "flat api" set of GDI+ functions - on XPsp3.

Regards,
Rudy Wieser

Re: GDIPlus WM_PAINT problem when another window moves over it

<st5n90$ekr$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=356&group=comp.os.ms-windows.programmer.win32#356

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!GEzXZqSwasXbyeGVT1Gydg.user.46.165.242.91.POSTED!not-for-mail
From: castorix@club-internet.fr (Christian Astor)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: GDIPlus WM_PAINT problem when another window moves over it
Date: Sun, 30 Jan 2022 10:54:41 +0100
Organization: Aioe.org NNTP Server
Message-ID: <st5n90$ekr$1@gioia.aioe.org>
References: <sse36g$1ms4$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="15003"; posting-host="GEzXZqSwasXbyeGVT1Gydg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299
X-Notice: Filtered by postfilter v. 0.9.2
 by: Christian Astor - Sun, 30 Jan 2022 09:54 UTC

R.Wieser a écrit :
> Hello all,
>
> I'm using GDIPlus to display an image in a controls WM_PAINT event
> (BeginPaint, GdipCreateFromHDC, GdipDraw, GdipDeleteGraphics, EndPaint).
> This works.
>
> The problem occurs when I move another window over the control : I get a
> mish-mash of the origional image interleaved with gray areas following
> moved-over window.
>
> Although I've found some ham-fisted solution by calling 'InvalidateRect'
> just before 'BeginPaint' (causing a second paint event which covers op the
> gray areas) I would like to know what correct way is to handle the problem.
>
> Remark: I'm using the "flat api" set of GDI+ functions - on XPsp3.

It works fine for me (Windows 10) :

https://i.ibb.co/tKNzgJV/GDi-Plus-Flat.gif

Global variable :

GpImage* img;

Main window :

//...
static hWndStatic = NULL;
//...

case WM_CREATE:
{
hWndStatic = CreateWindowEx(0, TEXT("Static"), TEXT(""), WS_CHILD |
WS_VISIBLE | SS_BITMAP, 10, 10, 500, 500, hWnd, (HMENU)IDC_STATIC,
hInst, NULL);
//hWndButton = CreateWindowEx(0, L"Button", L"Click", WS_CHILD |
WS_VISIBLE | BS_PUSHLIKE, 100, 60, 60, 32, hWnd, (HMENU)IDC_BUTTON,
hInst, NULL);

GpStatus nStatus = GdipLoadImageFromFile(L"E:\\Hulk.png", &img);
BOOL bRet = SetWindowSubclass(hWndStatic, StaticSubclassProc, 0, 0);
return 0;
}
break;

Subclass proc for Static to display image :

LRESULT CALLBACK StaticSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam,
LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{ switch (uMsg)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hDC = BeginPaint(hWnd, &ps);
GpGraphics *g;
GdipCreateFromHDC(hDC, &g);
GdipDrawImage(g, img, 0, 0);
GdipDeleteGraphics(g);
EndPaint(hWnd, &ps);
}
break;
}
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}

Re: GDIPlus WM_PAINT problem when another window moves over it

<st5nl0$jq2$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=357&group=comp.os.ms-windows.programmer.win32#357

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!rocksolid2!i2pn.org!aioe.org!GEzXZqSwasXbyeGVT1Gydg.user.46.165.242.91.POSTED!not-for-mail
From: castorix@club-internet.fr (Christian Astor)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: GDIPlus WM_PAINT problem when another window moves over it
Date: Sun, 30 Jan 2022 11:01:05 +0100
Organization: Aioe.org NNTP Server
Message-ID: <st5nl0$jq2$1@gioia.aioe.org>
References: <sse36g$1ms4$1@gioia.aioe.org> <st5n90$ekr$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="20290"; posting-host="GEzXZqSwasXbyeGVT1Gydg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299
X-Notice: Filtered by postfilter v. 0.9.2
 by: Christian Astor - Sun, 30 Jan 2022 10:01 UTC

Christian Astor a écrit :

> Main window :
>
> //...
> static hWndStatic = NULL;

It is (in LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM
wParam, LPARAM lParam)):

static HWND hWndStatic = NULL;

and at beginning :

#define IDC_STATIC 10

Re: GDIPlus WM_PAINT problem when another window moves over it

<st5seu$jgq$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=358&group=comp.os.ms-windows.programmer.win32#358

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!BHGTVyTGRwF2ntnqLVfpDg.user.46.165.242.75.POSTED!not-for-mail
From: address@not.available (R.Wieser)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: GDIPlus WM_PAINT problem when another window moves over it
Date: Sun, 30 Jan 2022 12:22:55 +0100
Organization: Aioe.org NNTP Server
Lines: 29
Message-ID: <st5seu$jgq$1@gioia.aioe.org>
References: <sse36g$1ms4$1@gioia.aioe.org> <st5n90$ekr$1@gioia.aioe.org>
Injection-Info: gioia.aioe.org; logging-data="19994"; posting-host="BHGTVyTGRwF2ntnqLVfpDg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-Priority: 3
X-Notice: Filtered by postfilter v. 0.9.2
X-MSMail-Priority: Normal
 by: R.Wieser - Sun, 30 Jan 2022 11:22 UTC

Christian,

> HDC hDC = BeginPaint(hWnd, &ps);
> GpGraphics *g;
> GdipCreateFromHDC(hDC, &g); GdipDrawImage(g, img, 0, 0);
> GdipDeleteGraphics(g);
> EndPaint(hWnd, &ps);

Thats pretty-much the code I'm using. I've got no idea why your code
doesn't get the artifacts though.

Extra info: The image I'm drawing is big and scaled back to fit the control,
causing it to take a few tenths of a second to appear - which also causes a
lot of flickering when the control is resized. (solved that by disabeling
the WM_ERASEBKGND event and after the image is drawn fill out the remainder
of the control using a few rectangles).

I've got the feeling that the delay in the paint events image drawing causes
my problem. I've still got no idea how to handle that though ...

Just thought of something: Could you add a Sleep (of 50... 100 ms) just
before calling GdipDrawImage and see if that changes anything for you ?
Its not anything that will lead to a solution, but it would hammer down the
cause.

Regards,
Rudy Wieser

Re: GDIPlus WM_PAINT problem when another window moves over it

<st8agd$ju5$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=359&group=comp.os.ms-windows.programmer.win32#359

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!GEzXZqSwasXbyeGVT1Gydg.user.46.165.242.91.POSTED!not-for-mail
From: castorix@club-internet.fr (Christian Astor)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: GDIPlus WM_PAINT problem when another window moves over it
Date: Mon, 31 Jan 2022 10:35:09 +0100
Organization: Aioe.org NNTP Server
Message-ID: <st8agd$ju5$1@gioia.aioe.org>
References: <sse36g$1ms4$1@gioia.aioe.org> <st5n90$ekr$1@gioia.aioe.org>
<st5seu$jgq$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="20421"; posting-host="GEzXZqSwasXbyeGVT1Gydg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299
X-Notice: Filtered by postfilter v. 0.9.2
 by: Christian Astor - Mon, 31 Jan 2022 09:35 UTC

R.Wieser a écrit :

> Just thought of something: Could you add a Sleep (of 50... 100 ms) just
> before calling GdipDrawImage and see if that changes anything for you ?
> Its not anything that will lead to a solution, but it would hammer down the
> cause.
>

Adding
Sleep(100);
doesn't change anything (just noticeable when the control is partially
out of the screen)

Re: GDIPlus WM_PAINT problem when another window moves over it

<st8drl$ai0$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=360&group=comp.os.ms-windows.programmer.win32#360

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!BHGTVyTGRwF2ntnqLVfpDg.user.46.165.242.75.POSTED!not-for-mail
From: address@not.available (R.Wieser)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: GDIPlus WM_PAINT problem when another window moves over it
Date: Mon, 31 Jan 2022 11:32:15 +0100
Organization: Aioe.org NNTP Server
Lines: 15
Message-ID: <st8drl$ai0$1@gioia.aioe.org>
References: <sse36g$1ms4$1@gioia.aioe.org> <st5n90$ekr$1@gioia.aioe.org> <st5seu$jgq$1@gioia.aioe.org> <st8agd$ju5$1@gioia.aioe.org>
Injection-Info: gioia.aioe.org; logging-data="10816"; posting-host="BHGTVyTGRwF2ntnqLVfpDg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-MSMail-Priority: Normal
X-Priority: 3
X-Notice: Filtered by postfilter v. 0.9.2
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Response
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
 by: R.Wieser - Mon, 31 Jan 2022 10:32 UTC

Christian,

>> Just thought of something: Could you add a Sleep (of 50... 100 ms) just
>> before calling GdipDrawImage and see if that changes anything for you ?

> Adding Sleep(100);
> doesn't change anything (just noticeable when the control is partially out
> of the screen)

Alas. Thanks for trying though.

Regards,
Rudy Wieser

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor