http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(no subject)



Good afternoon, 

I'm a long time programmer, new to windows and Graphics programming.

Any help on this type of error?  It looks like something simple, like 
changing a type, but I can't figure it out.

Platform Visual C++ 6.0, with approrpiate files added to project compile 
options.




Compiling...
dirdraw.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\Chap9\dirdraw.cpp(86) : 
error C2440: '=' : cannot convert from 'long (__stdcall *)(void *,unsigned 
int,unsigned int,long)' to 'long (__stdcall *)(struct HWND__ *,unsigned 
int,unsigned int,long)'
        This conversion requires a reinterpret_cast, a C-style cast or 
function-style cast
C:\Program Files\Microsoft Visual Studio\MyProjects\Chap9\dirdraw.cpp(89) : 
error C2440: '=' : cannot convert from 'void *' to 'struct HINSTANCE__ *'
        Conversion from 'void*' to pointer to non-'void' requires an explicit 
cast
C:\Program Files\Microsoft Visual Studio\MyProjects\Chap9\dirdraw.cpp(90) : 
error C2664: 'LoadIconA' : cannot convert parameter 1 from 'void *' to 
'struct HINSTANCE__ *'
        Conversion from 'void*' to pointer to non-'void' requires an explicit 
cast
C:\Program Files\Microsoft Visual Studio\MyProjects\Chap9\dirdraw.cpp(114) : 
error C2664: 'CreateWindowExA' : cannot convert parameter 11 from 'void *' to 
'struct HINSTANCE__ *'
        Conversion from 'void*' to pointer to non-'void' requires an explicit 
cast
C:\Program Files\Microsoft Visual Studio\MyProjects\Chap9\dirdraw.cpp(132) : 
error C2664: 'CreateWindowExA' : cannot convert parameter 11 from 'void *' to 
'struct HINSTANCE__ *'
        Conversion from 'void*' to pointer to non-'void' requires an explicit 
cast
Error executing cl.exe.

smallprog.exe - 5 error(s), 0 warning(s)


The offending code in my dirdraw.cpp:

HWND DIRECT_DRAW_MANAGER:: CreateMainWindow (const int w, const int h, 
            const char* ClassName, 
            void* MessageLoop, 
            void* hInst,
            const bool FullScreen)
{
    if (NotInitializedFlag == false) return NULL;// already initialized
    WNDCLASS    wc;
    FullScreenFlag = FullScreen;// store this value

    wc.style=           CS_HREDRAW | CS_VREDRAW;
    <FIRST ERROR HERE>  wc.lpfnWndProc =    (long (__stdcall *)(void 
*,unsigned int,unsigned int,long)) MessageLoop;
    wc.cbClsExtra =     0;
    wc.cbWndExtra =     0;
    wc.hInstance =      hInst;
    wc.hIcon =          LoadIcon (hInst, IDI_APPLICATION);
    wc.hCursor =        LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground =  NULL;
    wc.lpszMenuName =   ClassName;//NULL;
    wc.lpszClassName =  ClassName;


Below is messageloop:
LRESULT CALLBACK MessageLoop (HWND hwnd, UINT message, WPARAM wParam, LPARAM 
lParam)
{
    int mousex, mousey;
    static DragMouse;

    switch(message)
    {
        case WM_ACTIVATEAPP:
           ActiveApp = wParam;
        break;

        case WM_CREATE:
        break;


etc..

This is a direct copy of the program as is by Mickey Kawick in the book Game 
Programming using MS DirectX 6.0


Can I tell my compilker not to check types so strickly?

If you respond, please reply to 
Eldemar@AOL.COM

I know you are busy, so don't feel too bad about replying with "Don't have 
the time" 

;)

Thanks 
=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html