Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3046

Error 1425: Invalid device context (DC) handle

$
0
0
Hi,
if this is not the right place to post my question I would appreciate if someone could direct me to the proper forum.

I am using FORTRAN to build my code, but the win32 API is used by interfaces to C/C++ provided with the compiler. So my code may look a little awkward to you, but it is not so very different from C.

My prog evaluates some data by running in cycles with a new set of data for each cycle. The total number would be 8760 corresponding with the number of hours in one year. I have some output to screen, where I use win32 API to show some diagrams and textual data just for control. And I have output to disk for further use. It is a single thread application using about 14 MB of memory and uses less than 5 % of CPU time. I am using Visual Studio 2017 in a Windows 11 environment.

This prog does its job for about 1250 cycles and then the screen freezes while the app carries on. Upon checking the return value of BeginPaint() I receive 1425, which indicates an invalid device context handle.

Now I am at a loss how this can happen:

Code:

        hDC = BeginPaint (hWnd, tPS)
            if (hDC .eq. 0) then
                iRslt = GetLastError()
                print *,'DiagrammWndProc: Error in Begin Paint. Code: ',iRslt
            endif

I understand that BeginPaint failed but I could not find any clue as to why this happened and how to spot the root cause.

Anybody any idea?

Thanks in advance
Norbert

Viewing all articles
Browse latest Browse all 3046

Trending Articles