none
visual studio 64 bit RRS feed

  • Question

  • Hi,

           please help me vs 64 bit complier GetObject function value is coming garbage value . . .GetObject(HGDIOBJ hdjobj,int buffer,LPVOID lpvobject)

    lpvobject ------> pointer to a buffer value is coming garbage value .  . .Please help me what is the problem in that function i am using Win32 application . .

    Thursday, June 21, 2012 3:46 AM

Answers

All replies

  • We cannot help if we cannot see the code.  Show some code.

    Jose R. MCP
    Code Samples

    Thursday, June 21, 2012 4:22 AM
  • I think the problem is with the declaration of int. A 64 bit compiler will make an int 64 bits.  C language convention is to push the last item in the parameter list first onto the stack.  So it may appear that lpvobject is correupt, it is actually buffer that is the cause of the problem.

    From : GetObject(HGDIOBJ hdjobj,int buffer,LPVOID lpvobject)

    To : GetObject(HGDIOBJ hdjobj,int32 buffer,LPVOID lpvobject)


    jdweng

    Thursday, June 21, 2012 5:59 AM
  • The size of int is 4 bytes in both 32 and 64-bit compilers.

    Jose R. MCP
    Code Samples

    Thursday, June 21, 2012 6:03 AM
  • Yes thanks . .

    Actually int size is same in 32bit and 64 bit visual studio compiler

    Thursday, June 21, 2012 6:44 AM
  • How to slove the problem . . . lpvobject i created one instance bm ,

    i am using like this  GetObject(hbitmap,sizeof(BITMAP),&bm);

    here bm having garbage value . . .bm should hold bitmap bits,x,y,pixel values . .but it is giving -85674589like this values in 64 bit . . .same thing in 32 bit it is working fine . . .

    Thursday, June 21, 2012 6:51 AM
  • Convert the correct number and wrong number from decimal to hex and compare the number.  the allignment of the bytes are off.  I'm not sure if the problem is a big endian/little endian problem.

    jdweng

    Thursday, June 21, 2012 6:59 AM
  • That GetObject call should return an error result, perhaps you need to call GetLastError() to find the error. If you're getting garbage back the most likely explanation is that the API is returning an error and you should check that before using the data.

    Phil Wilson

    Monday, June 25, 2012 7:28 PM