|
I want to use a CDockablePane derived control and i want to limit the size of CDockablePane Derived control.For this, I tried to catch WM_GETMINMAXINFO in my derived class, but i am not able to get this message in my class. Can Somebody help me how would i get this message in my class?
|
|
|
|
|
I made a list of points:
class CPuntoList : public CObject
{
public:
CPunto* raiz;
CPuntoList();
void Inserta(CPunto* nodo);
virtual ~CPuntoList();
virtual void Serialize(CArchive &ar);
long getSize();
}
The serialize function of the List looks like this:
void CPuntoList::Serialize(CArchive &ar)
{
CObject::Serialize(ar);
long i;
if(ar.IsStoring())
{
ar<<raiz;
}
else
{
ar>>raiz;
}
}
the Punto Class looks like this:
class CPunto : public CObject
{
public:
CPunto();
CPunto(double _x, double _y, double _z, double _zTn);
CPunto *m_pSigPunto;
CGLColor *m_pColor;
void Inicializa();
virtual ~CPunto();
virtual void Serialize(CArchive& ar);
public:
double x, y, z, zTn;
private:
DECLARE_SERIAL(CPunto)
};
Serialize functino looks like this:
void CPunto::Serialize(CArchive &ar)
{
CString str;
if(ar.IsStoring())
{
ar<<x;
ar<<y;
ar<<z;
ar<<zTn;
ar<<m_pColor;
ar<<m_pSigPunto;
}
else
{
ar>>x;
ar>>y;
ar>>z;
ar>>zTn;
ar>>m_pColor;
ar>>m_pSigPunto;
}
}
Now the question is:
When I load about 200 points to the list or even 5,000 points and I save the data to a file using the serialize functions everything works fine, both the storing and the loading.
But when I try to save about 12,000 points, there is an error in both storing and loading, it says "Stack overflow."
I think because from one function (the serialize function) I call the a serialize function over and over so the Stack overflows...
Is that the problem? or what could be the issue? anyways, more importantly, how can I solve it??
Please help!!!!
|
|
|
|
|
you are right calling so often the stack is a problem. Somehow is it possible to enhance the stack. But it is bad style. (if you call a lot more you run in the same trouble)
You better Serialize the points one ofter the other. The linked list stays otuside the serialization.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
sounds like your loading ar with to much info to write at once, try writing chunks when ar reachs a set size then clear ar repeat, until all data is written
|
|
|
|
|
Can someone plz explain me this I just want to clarify that am I understanding this correctly or not....
typedef struct
{
unsigned int SizeInBytes;
unsigned char data[MAXBYTES];
} Message;
typedef struct
{
unsigned char MSB;
} PACKET_HEADER;
typedef struct
{
PACKET_HEADER PktHdr;
unsigned char data2[MAX_BYTES];
} PACKET;
const PACKET * const PacketPtr = (PACKET *)&MessagePtr -> data;
(MessagePtr is defined in function parameter
bool function(const Message * const MessagePtr)
THANKS!!!!!
|
|
|
|
|
so whats wrong? whats happening that shouldnt?
i can take a wild guess that
<br />
const PACKET * const PacketPtr = (PACKET *)&MessagePtr -> data; <br />
doesnt work well maybe something like
<br />
const PACKET * const PacketPtr->data2 = (PACKET *)&MessagePtr -> data; <br />
|
|
|
|
|
I've implemented an Active Document Server using Visual Studio 2008. The project is an out-of-process C++ MFC Mini-server.
I am able to define a menu that is merged in the Container. I can see the menu and handle the click event when the program is running.
My question is:
Is it possible to modify the menu at runtime: Add/remove menu items, enable/disable specific menu items, and change the text of the menu items?
John M.
|
|
|
|
|
Yes, you can. I am doing that.
|
|
|
|
|
Could you point me to some documentation or an example that shows how to do this?
Thanks!
|
|
|
|
|
Hi,
I am upgrading a very old project to VS 2005. After thousands of errors correction, I finally get it compiled.
But there is another problem. My cursor will show on menubar and toolbar. But it despairs (not shown) in the CView area or Client area.
What kind of reason will cause this?
Best regards,
|
|
|
|
|
For no cursor.... See if the CMyScrollView::PreCreate.... class sets its window class to have NULL as a cursor, and look at the OnSetCursor method.
Alternatively, does it try to load a cursor resource that doesn't exist anymore, fail poorly, and do (equiv) SetCursor (NULL)?
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hi Iain
I did not do anything related to cursor in the "CMyScrollView::PreCreateWindow"
I have no "OnSetCursor" method.
When I moved my cursor into View client area, cursor just despair.
Thanks,
|
|
|
|
|
Do you do something with OnNcHitTest? Maybe you're returning something odd...
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
No, I have not defined "OnNcHitTest" method yet.
Thanks,
|
|
|
|
|
Hello,
I am not a programmer but I need a simple program (assembled C++ code) for the following
Start ProcessX
Set TokenVirtualizationEnabled using SetTokenInformation for processX
Ideally the name of process X (or exact location directory) should be passed over through a parameter. like
this_is_what_I_need.exe /C:\Windows\Programs\Example\processX.exe
or
this_is_what_I_need.exe ProcessX.exe
Thanks in advance
|
|
|
|
|
I have data coming in and I store the one byte header in the struct
struct {
unsigned char flags;
unsigned char Checksum;
unsigned short int Sequence;
} PAcket Header
Now I need to read individually First, second, third & fourth bit and than need to read remaining 4 bits from the "flag" byte.
How do I do this. plz help....
THANKS!
|
|
|
|
|
This article[^] should help you getting the basics with bit masking.
|
|
|
|
|
That article Cedric pointed you at is great, but doesn't cover bit fields, which is what I'd use in your place.
Not by a compiler, so take this with healthy doubt over the exact syntax, but you can read a book, right?
struct {
union
{
unsigned char Byte;
struct {
unsigned char Flag1 : 1;
unsigned char Option1 : 2;
unsigned char Flag2 : 1;
unsigned char Flag3 : 1;
unsigned char Flag4 : 1;
unsigned char Flag5 : 1;
unsigned char Flag6 : 1;
} Bits;
} Flags;
unsigned char Checksum;
unsigned short int Sequence;
} PacketHeader
You can use it like:
PacketHeader packet;
ReadPacketSomehow (packet);
if (packet.Flags.Bits.Flag3)
{
....
}
if (packet.Flags.Bits.Option3 == 3)
{
....
}
Hope that helps you,
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
@ Cedric Moonen - Thanks for the link will look into that...
@ Iain Clarke -- Thats what exactly how I coded and it was working fine.... but than coding standard dosent allow bit fields... so now I have to redo .... and I have very short time to get this thing converted.... (they recommended to use shift and mask... )
Sorry forgot to mention earlier that I cant use bit fields.... Please can someone help me with this....
THANKS!!!!
|
|
|
|
|
If you can't use bitfields, then the article Cedric pointed you at will tell you all you ever wanted to know about >>, and &.
Certainly more than I'll type as an answer.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hey man, you haven't a Option3 in your union .
BTW: welcome back!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I did say I wasn't by a compiler, and the reader should take my answer with a large dose of doubt. Lucky, eh...
I already had to edit it, because I had too many bits (9) to start with...
I've been lurking a while, but the questions were either already ably answered, or I couldn't think of anything polite to reply with. "You couldn't find your arse with elbows, Go get another career" isn't the most helpful answer, and a hint that I should avoid an answer. Don't want to be another Outlaw!
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
struct PacketHeader ph;
unsigned char firstbit = (ph.flags & 1);
unsigned char secondbit = ((ph.flags >> 1) & 1);
unsigned char thirdbit = ((ph.flags >> 2) & 1);
unsigned char fourthbit = ((ph.flags >> 3) & 1);
unsigned char remaining = (ph.flags >> 4);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
what happens with if condition in following code?
int function(int i)
{
printf("inside function");
return 0;
}
int main()
{
if(function)
printf("hi");
else
printf("bye");
}
and output is only
hi
why compiler doesn't complaints about wrong function call?
modified on Thursday, July 23, 2009 12:08 PM
|
|
|
|
|
What is fun in your code? Is that suposed ot be:
if (function) ...
?
If so, then the answer is simple, in your if the address of the function will be checked against zero, and since it is not zero, it will come out as TRUE thus, you get "hi".
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|