Can't set RECT values?
I have RECT* srcRectBg; declared in the private scope of a class.
In the constructor's implementation, I have srcRectBg->left = 0; and it gives me an access violation. What the crap?
The member itself is nothing but a pointer, are you sure it's been allocated properly (i.e. is pointing to valid data)?
Hmm, I added srcRectBg = new Rectangle(0,0,0,640,480) above srcRectBg->left = 0;
Now I'm getting 100+ errors on the next piece of code in the exact same place?! This stuff compiled just fine before adding in the allocation.
Now I'm getting 100+ errors on the next piece of code in the exact same place?! This stuff compiled just fine before adding in the allocation.
That does sound strange (your second post). Post some of your code. si it just that you wrote Rectungle instead of RECT?
One thing I would avoid is unnecessary use of memory allocation. Im almost 100% sure that you do NOT need to in your case.
Functions such as SetRect are misleading someitmes. They take a RECT* as a parameter, but that should not persuede you to declare your RECTS as pointers then allocate their memeory. Do this:
RECT rec;
SetRect( &rec,....);
One thing I would avoid is unnecessary use of memory allocation. Im almost 100% sure that you do NOT need to in your case.
Functions such as SetRect are misleading someitmes. They take a RECT* as a parameter, but that should not persuede you to declare your RECTS as pointers then allocate their memeory. Do this:
RECT rec;
SetRect( &rec,....);
Rectangle? According to MSDN there's a Rectangle function at least but I can't find any matching type, especially not any inheriting from RECT.
If it really needs be allocated dynamically then shouldn't you allocate a RECT instead, and what's the fifth parameter supposed to do?
If it really needs be allocated dynamically then shouldn't you allocate a RECT instead, and what's the fifth parameter supposed to do?
Quote:Original post by doynax
Rectangle? According to MSDN there's a Rectangle function at least but I can't find any matching type, especially not any inheriting from RECT.
If it really needs be allocated dynamically then shouldn't you allocate a RECT instead, and what's the fifth parameter supposed to do?
Damn it, i tried rating you up to 1337, but barely missed....
sorry if im mistaken, but this is what your preceding posts tell about your code:
isnt it supposed to be "srcRectBg = new RECT(...)" or sumthing like that?
int myfunc{ RECT* srcRectBg; srcRectBg = new Rectangle(0,0,0,640,480);}
isnt it supposed to be "srcRectBg = new RECT(...)" or sumthing like that?
I don't think it's really necessary to dynamically allocated this structure. And, heh, I was calling Rectangle(HDC,left,...). It's not even related to what I'm doing. ;) I'm just gonna declare a RECT variable and not a pointer.
And I get this error when doing srcRectBg = new RECT(0,0,640,480);
error C2661: 'tagRECT::tagRECT' : no overloaded function takes 4 parameters
error C2661: 'tagRECT::tagRECT' : no overloaded function takes 4 parameters
Quote:Original post by POLSKASHThe RECT structure doesn't have any constructor. Try simply allocating it instead.
And I get this error when doing srcRectBg = new RECT(0,0,640,480);
srcRectBg = new RECT;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement