Re: Build Errors
- From: "Ross" <Ross@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 14 Oct 2005 14:07:07 -0700
Hi Victor!
The problem was, as you stipulated, the 2 functions had to be moved to the
top of WINMAIN. However this is the first time in all my examples that I had
to do this. Furthermore, the example in book was coded as I showed it.
Concerning the DPtoLP(hdc,(LPPOINT) &rect,2); line, I am curious to see
where the
LPRECT type is defined. I will try to look in Windows.h later. Let me know
if it is elsewhere!
Later! :)
"Victor Bazarov" wrote:
> Ross wrote:
> > Please view the following code fragment. Build errors are generated at build
> > time such as:
> >
> > c:\DATASOURCE_EXTRA\Programming\VC++CodeTesting_WINDOWS\CPZ_P192\WHATSIZE.C(12): error C2065: 'WndProc' : undeclared identifier
> >
> > c:\DATASOURCE_EXTRA\Programming\VC++CodeTesting_WINDOWS\CPZ_P192\WHATSIZE.C(64):
> > error C2365: 'WndProc' : redefinition; previous definition was a 'data
> > variable'
> >
> > c:\DATASOURCE_EXTRA\Programming\VC++CodeTesting_WINDOWS\CPZ_P192\WHATSIZE.C(12): warning C4047: '=' : 'WNDPROC' differs in levels of indirection from 'int'
>
> See below.
>
> >
> > c:\DATASOURCE_EXTRA\Programming\VC++CodeTesting_WINDOWS\CPZ_P192\WHATSIZE.C(42):
> > warning C4244: 'return' : conversion from 'WPARAM' to 'int', possible loss of
> > data
>
> Cast it (if you care to remove this warning).
>
> > Don't seem to see the typo's. Here is the code:
> >
> > #include <windows.h>
> >
> > int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInnstance,
> > PSTR szCmdLine, int iCmdShow)
> > {
> [...]
> > }
>
> Move the following two functions _above_ the "WinMain".
>
> >
> > void Show (HWND hwnd, HDC hdc, int xText, int yText, int iMapMode,
> > TCHAR * szMapMode)
> > {
> [...]
> > }
> >
> > LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
> > lParam)
> > {
> [...]
> > }
>
> >
> > Also the 2nd parameter of the following line:
> >
> > DPtoLP(hdc,(LPPOINT) &rect,2);
> >
> > requests a long pointer to a point structure, why include the (LPPOINT) part
> > of it.
>
> Because &rect is of type LPRECT, not LPPOINT. You need to cast to tell
> the compiler how to interpret the address.
>
> V
>
.
- Follow-Ups:
- Re: Build Errors
- From: David Wilkinson
- Re: Build Errors
- References:
- Build Errors
- From: Ross
- Re: Build Errors
- From: Victor Bazarov
- Build Errors
- Prev by Date: Re: Fastest way to write in a file
- Next by Date: Re: Build Errors
- Previous by thread: Re: Build Errors
- Next by thread: Re: Build Errors
- Index(es):
Relevant Pages
|