www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - CallWindowProc error

reply Dimitri Kaparis <dkaparis universalstudyhelper.com> writes:
Greetings,

What's up with CallWindowProc, the following code fragment causes error:

#include <windows.h>

void main()
{
WNDPROC proc;
HWND hwnd;
UINT msg;
WPARAM wparam;
LPARAM lparam;
::CallWindowProc(proc,hwnd,msg,wparam,lparam);
}


sc Test.cpp -p -mn -C -WA -S -3 -a8 -c -gf -Ic:\dm\stl -oTest.obj 
Error: D:\MYPROJECTS\TEST\Test.cpp(10): need explicit cast for function
parameter 1 to get
D:\MYPROJECTS\TEST\Test.cpp(10): from: long (*std func)(void *,unsigned
,unsigned ,long )
D:\MYPROJECTS\TEST\Test.cpp(10): to  : int (*__import std func)()
Lines Processed: 124472  Errors: 1  Warnings: 0
Build failed

Dimitri Kaparis,
Independent Developer
http://www.universalstudyhelper.com - software to help you study any subject.
May 17 2002
parent reply "Walter" <walter digitalmars.com> writes:
One returns a long, the other returns an int. The prototypes should
match. -Walter

"Dimitri Kaparis" <dkaparis universalstudyhelper.com> wrote in message
news:ac2cs6$siq$1 digitaldaemon.com...
 Greetings,

 What's up with CallWindowProc, the following code fragment causes error:

 #include <windows.h>

 void main()
 {
 WNDPROC proc;
 HWND hwnd;
 UINT msg;
 WPARAM wparam;
 LPARAM lparam;
 ::CallWindowProc(proc,hwnd,msg,wparam,lparam);
 }


 sc Test.cpp -p -mn -C -WA -S -3 -a8 -c -gf -Ic:\dm\stl -oTest.obj
 Error: D:\MYPROJECTS\TEST\Test.cpp(10): need explicit cast for function
 parameter 1 to get
 D:\MYPROJECTS\TEST\Test.cpp(10): from: long (*std func)(void *,unsigned
 ,unsigned ,long )
 D:\MYPROJECTS\TEST\Test.cpp(10): to  : int (*__import std func)()
 Lines Processed: 124472  Errors: 1  Warnings: 0
 Build failed

 Dimitri Kaparis,
 Independent Developer
 http://www.universalstudyhelper.com - software to help you study any
subject.
May 17 2002
parent reply Dimitri Kaparis <dkaparis universalstudyhelper.com> writes:
WNDPROC is the type of the first parameter of CallWindowProc and that is exactly
how it is declared in the headers. How come any difference?

PS: I just found out that compiling with STRICT defined solves this problem, but
this seems to be a bug.

In article <ac3708$1hu1$1 digitaldaemon.com>, Walter says...
One returns a long, the other returns an int. The prototypes should
match. -Walter

"Dimitri Kaparis" <dkaparis universalstudyhelper.com> wrote in message
news:ac2cs6$siq$1 digitaldaemon.com...
 Greetings,

 What's up with CallWindowProc, the following code fragment causes error:

 #include <windows.h>

 void main()
 {
 WNDPROC proc;
 HWND hwnd;
 UINT msg;
 WPARAM wparam;
 LPARAM lparam;
 ::CallWindowProc(proc,hwnd,msg,wparam,lparam);
 }


 sc Test.cpp -p -mn -C -WA -S -3 -a8 -c -gf -Ic:\dm\stl -oTest.obj
 Error: D:\MYPROJECTS\TEST\Test.cpp(10): need explicit cast for function
 parameter 1 to get
 D:\MYPROJECTS\TEST\Test.cpp(10): from: long (*std func)(void *,unsigned
 ,unsigned ,long )
 D:\MYPROJECTS\TEST\Test.cpp(10): to  : int (*__import std func)()
 Lines Processed: 124472  Errors: 1  Warnings: 0
 Build failed

 Dimitri Kaparis,
 Independent Developer
 http://www.universalstudyhelper.com - software to help you study any
subject.
Dimitri Kaparis, Independent Developer http://www.universalstudyhelper.com - software to help you study any subject.
May 17 2002
parent "Walter" <walter digitalmars.com> writes:
They're Microsoft header files. There are a number of inconsistencies in
them.

"Dimitri Kaparis" <dkaparis universalstudyhelper.com> wrote in message
news:ac3jhd$1t3r$1 digitaldaemon.com...
 WNDPROC is the type of the first parameter of CallWindowProc and that is
exactly
 how it is declared in the headers. How come any difference?

 PS: I just found out that compiling with STRICT defined solves this
problem, but
 this seems to be a bug.

 In article <ac3708$1hu1$1 digitaldaemon.com>, Walter says...
One returns a long, the other returns an int. The prototypes should
match. -Walter

"Dimitri Kaparis" <dkaparis universalstudyhelper.com> wrote in message
news:ac2cs6$siq$1 digitaldaemon.com...
 Greetings,

 What's up with CallWindowProc, the following code fragment causes
error:
 #include <windows.h>

 void main()
 {
 WNDPROC proc;
 HWND hwnd;
 UINT msg;
 WPARAM wparam;
 LPARAM lparam;
 ::CallWindowProc(proc,hwnd,msg,wparam,lparam);
 }


 sc Test.cpp -p -mn -C -WA -S -3 -a8 -c -gf -Ic:\dm\stl -oTest.obj
 Error: D:\MYPROJECTS\TEST\Test.cpp(10): need explicit cast for function
 parameter 1 to get
 D:\MYPROJECTS\TEST\Test.cpp(10): from: long (*std func)(void *,unsigned
 ,unsigned ,long )
 D:\MYPROJECTS\TEST\Test.cpp(10): to  : int (*__import std func)()
 Lines Processed: 124472  Errors: 1  Warnings: 0
 Build failed

 Dimitri Kaparis,
 Independent Developer
 http://www.universalstudyhelper.com - software to help you study any
subject.
Dimitri Kaparis, Independent Developer http://www.universalstudyhelper.com - software to help you study any
subject.
May 17 2002