Hi, thats very weird..if I pass my RECT by reference notting wrong happens, bu if I pass by value, the numbers get crazy.
The correct values are:

    {top=159 bottom=480 left=400 right=640}

What I get passing by value is:

{top=0 bottom=1 left=1964816 right=1058984360}

This happens at the first moment it enters the function( NO MODIFICATIONS ARE MADE ON THE RECT )..

Is this a 64 bit issue? Im on a x64 project..

Recommended Answers

All 5 Replies

>>Is this a 64 bit issue? Im on a x64 project..

Not if you are compiling with a 32-bit compiler. It's the compiler, not the os, that determines 32 or 64-bit programs. But I doubt that is the case. Post some code that demonstrates the problem.

//the function prototype:
//(IN, OUT, OUT, OUT, IN, OUT )
HRESULT SetupDirectX11( HWND hWnd_p,
ID3D11Device *&pDevice_p, ID3D11DeviceContext *&pDIContext_p, IDXGISwapChain *&pSC_p,
						RECT wndrect_p,
						ID3D11RenderTargetView *&pRTV_p );

...
//Heres where I call the function( at WinMain, just after create my window) here the value of the rect passed is OK
	if( SetupDirectX11( g_hmainwnd, g_pDevice, g_pDIContext, g_pSwapChain, g_wndrect, g_pRTV ) != S_OK ) return -1;
...


...

//This function receives the rect, I just need its values:
HRESULT SetupDirectX11( HWND hWnd_p,
ID3D11Device *&pDevice_p, ID3D11DeviceContext *&pDIContext_p, IDXGISwapChain *&pSC_p,
						RECT wndrect_p,
						ID3D11RenderTargetView *&pRTV_p ){
//at the first moment the function is called(HERE), the values are alredy weird
...
}

After the function returns, the value of the rect is still ok...It just at the function it changes for crazy numbers. And if I pass by reference the values keep OK..Its so weird, I cant figure out whats happening.

Im using VS 2008 pro, solution platform x64.

Yes that is weird, I have never encountered such problem. Are you sure you are using the RECT right (ie . instead of ->)? And besides, why do you want to pass it by value instead of reference?

Yes that is weird, I have never encountered such problem. Are you sure you are using the RECT right (ie . instead of ->)? And besides, why do you want to pass it by value instead of reference?

Yes Im sure, is not "using it" that I see the problem, the compiler watch variables show the values...well I dont havve a reason, is just the logical thing since I dont need to change it..until I figure out whats going on Im passing by reference, I just want know the problem..


Ah! Im such an idiot...is just the watch values that are weird! Is this a bug? Looks like...I created a LONG x variable and assignt the rec values to it, the numbers are ok.

The weird is the watched variable value for the LONG x is ok, just the RECT watched values get weird....and..o.o just when pass by value....Thats so nonsense, can anyone test that?
I just added this at the begin of the function:
LONG x = wndrect_p.bottom;
x = wndrect_p.left;
x = wndrect_p.right;
x = wndrect_p.top;
The values of x are right...that the most nonsense thing ever, the hexa values are also displayed all different for the rect...and just when passed by value...@.@

VC++ 2008 has some problems with viewing the values of variables, I think it gets confused sometimes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.