home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!think.com!spool.mu.edu!torn!nott!emr1!jagrant
- From: jagrant@emr1.emr.ca (John Grant)
- Subject: Re: Does anybody know this bug?
- Message-ID: <1993Jan27.022815.9125@emr1.emr.ca>
- Organization: Energy, Mines, and Resources, Ottawa
- References: <1993Jan23.150923.12794@ousrvr.oulu.fi> <C1Gp35.9Ez@sunlab1.bath.ac.uk>
- Date: Wed, 27 Jan 1993 02:28:15 GMT
- Lines: 49
-
- In article <C1Gp35.9Ez@sunlab1.bath.ac.uk> mssshb@sunlab1.bath.ac.uk (S H Bowman) writes:
- >artoinas@phoenix.oulu.fi (Arto Oinas) writes:
- >
- [...stuff about some bug deleted...]
-
- >This is a pretty general problem so try this general answer:
- >
- >Check your hdc and hwnd parameters in functions like EndPaint.
- >
- >I have mixed these up on numerous occasions and it has given exactly
- >the type of fault you describe, sometimes taking hours to sort out!
- >I can't understand why the STRICT compilation doesn't spot this.
-
- This is obvious, but it's worth a check - does your
- #define STRICT appear *before* #include <windows.h>???
-
- Well EndPaint doesn't have an HDC, but ReleaseDC has both
- HWND & HDC. I just stuck the following in my code somewhere:
- {HWND hwnd;
- HDC hdc;
- ReleaseDC(hdc,hwnd); //this is WRONG
- }
-
- and BC++ 3.1 gives me two "suspicious pointer conversion"
- errors (also the obvious warning that hdc & hwnd are used
- before being defined). If I switch it around:
- ReleaseDC(hwnd,hdc); //this is RIGHT
- then I don't get those 2 pointer warnings.
-
- It looks like STRICT is working for me, but then again I
- have *every* single warning message turned on and I don't
- go any further until they have all been fixed. I can't
- stress this enough for all of you programmers out there.
- My app is 22k lines of code and I don't get a single warning
- message when I do a full build (with all warnings turned on).
-
- I only used #pragma argsused in a couple of places where I
- have some unused function parameters in place (for future
- expansion). Everything is fully prototyped and as bugtight
- as I could make it, and I *still* get the odd bug or two
- (as expected).
-
- John A. Grant jagrant@emr1.emr.ca
- Airborne Geophysics
- Geological Survey of Canada, Ottawa
- --
- John A. Grant jagrant@emr1.emr.ca
- Airborne Geophysics
- Geological Survey of Canada, Ottawa
-