win32 32bit to x64 code problems

This is a discussion on win32 32bit to x64 code problems within the Game Programming forums, part of the General Programming Boards category; Im trying to convert a basic "game" engine from win32 (32bit) to x64 to fully support 64bit. This engine was ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    1

    win32 32bit to x64 code problems

    Im trying to convert a basic "game" engine from win32 (32bit) to x64 to fully support 64bit. This engine was made for learning c++ in my high college (to visualy create standard games). But the problem is when i compile this code in x64 it gives some errors that i cannot solve because i dont know that mutch of c++. (The code was created in visual studio 2010 ).
    I'm trying to recreate the engine so that it can be used for 32bit and 64bit applications

    The code can be found her (didnt know how to upload all the different files to this site:
    Fadaria.rar

    tnx for helping me out with this

    EDIT: some errors + code

    Error 5 error C2664: 'WriteFile' : cannot convert parameter 4 from 'DWORD_PTR *' to 'LPDWORD'

    Code:
    void Bitmap::Extract(WORD id, tstring sType, tstring fileName) const
    {
    	CreateDirectory(_T("temp\\"), NULL);
    
        HRSRC hrsrc = FindResource(NULL, MAKEINTRESOURCE(id), sType.c_str());
        HGLOBAL hLoaded = LoadResource( NULL, hrsrc);
        LPVOID lpLock =  LockResource(hLoaded);
        DWORD_PTR dwSize = SizeofResource(NULL, hrsrc);
        HANDLE hFile = CreateFile(fileName.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
        DWORD_PTR dwByteWritten;
        WriteFile(hFile, lpLock , dwSize , &dwByteWritten , NULL);
        CloseHandle(hFile);
        FreeResource(hLoaded);
    }
    EDIT: more errors

    Error 3 error C2440: '=' : cannot convert from 'LRESULT (__cdecl *)(HWND,UINT_PTR,WPARAM,LPARAM)' to 'WNDPROC'

    Code:
    bool GameEngine::ClassRegister(int iCmdShow)
    {
      WNDCLASSEX    wndclass;
    
      // Create the window class for the main window
      wndclass.cbSize         = sizeof(wndclass);
      wndclass.style          = CS_HREDRAW | CS_VREDRAW;
      wndclass.lpfnWndProc    = WndProc;
    And there are a few warnings like this:
    Warning 8 warning C4244: 'argument' : conversion from 'UINT_PTR' to 'UINT', possible loss of data

    The files where i get those errors are included in this post
    Attached Files Attached Files
    Last edited by Lonelobo; 05-10-2010 at 12:42 PM. Reason: more error examples

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    If you post some of the errors and corresponding code, we may be able to help.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    For the first one, if my Hungarian decoding skills are up-to-date, LPDWORD is a pointer to a DWORD. DWORD_PTR is presumably not quite the same as DWORD (IIRC it's a DWORD that is masquerading as a pointer itself). You want to create a DWORD variable.

    For the other two, UINT and UINT_PTR aren't going to be the same, so you'll need to be careful which one is which.

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    ...code in x64 it gives some errors that i cannot solve because i dont know that mutch of c++.
    Then you have no business porting the code to x64. Porting your code to x64 while not all that hard is probably not for someone who does not know C++ and Win32 (based on your post) quite well.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling x64 code in VC++ 6.0?
    By cpjust in forum Windows Programming
    Replies: 7
    Last Post: 07-29-2008, 10:36 AM
  2. Problems with code
    By Alastor in forum C Programming
    Replies: 9
    Last Post: 10-04-2005, 07:44 PM
  3. lcc win32 compiler download problems
    By GanglyLamb in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 08-01-2004, 08:39 PM
  4. Wierd Win32 Problems?
    By no-one in forum Windows Programming
    Replies: 2
    Last Post: 10-23-2001, 11:17 AM
  5. problems with output from code
    By simhap in forum C++ Programming
    Replies: 0
    Last Post: 10-08-2001, 01:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21