|
|
|
it is "Sorry, cannot find the folder \"Test\"". :->
~RaGE();
|
|
|
|
|
Any ideas why this code crashes with 799 elements or more but it works with 699 or less? I haven't found yet the limit.
<code>#include <malloc.h>
#include <stdio.h>
int main()
{
int n = 699;
int* array = (int*) malloc(sizeof(char) * n);
if (!array)
{
printf("Out of memory");
return 1;
}
for (int i = 0; i < n; i++)
{
array[i] = i;
}
for (int i = 0; i < n; i++)
{
printf("%d, ", array[i]);
}
return 0;
}
</code>
-- modified at 2:51 Thursday 30th March, 2006
|
|
|
|
|
Hey when i tried it is working up to n=980.
anything more than 980 application is crashing.
|
|
|
|
|
What compiler? I'm using mingw on WinXP Home right now but I could try it later on VS2005 and GCC under Linux but I have to reboot.
This is a text book example. Well I've change it a little bit but it is basically the same.
|
|
|
|
|
Your array variable is a pointer to int's but you're only allocating enough memory for n char's. char's are smaller than int's so you're running past the end of the memory you've allocated.
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
damn't it sorry for the stupid question!
|
|
|
|
|
Damn't it Sorry for the stupid question! I'm ashamed!
|
|
|
|
|
Cristoff wrote: orry for the stupid question!
Hey, we've all done it. Just be grateful you did here instead of when iterating through thousands of bank account balances
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
Hi,
I'm using a CButton as a check box in my application.
The background of the window on which this button "sits" is white.
When the check box is created it has a grey background no its rect.
Do you know how to control the background color?
Thanks.
Snir
|
|
|
|
|
use :
afx_msg HBRUSH OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor );
|
|
|
|
|
RockyJames wrote: use :
afx_msg HBRUSH OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor );
This doesn't work with CButton .
Nibu thomas
Software Developer
|
|
|
|
|
No it doesn't. Thanks.
Do you have an alternative?
|
|
|
|
|
I'm using the the check box on a window and not a dialog. The window color is white. The default check box color is (dialog-like) grey.
|
|
|
|
|
O.k so i've got it.
I've used afx_msg HBRUSH OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor );
just like RockyJames suggested (cheers mate!:->)
and in the body just:
return (HBRUSH)GetStockObject(WHITE_BRUSH);
:->
|
|
|
|
|
Hi snir_ya,
I suggestion you can derived CButton and use WM_DRAWITEM
that you can change background color and other...
|
|
|
|
|
Thanks whiteSky - you've helped me before. It's a standrd checkbox. No special effects and stuff only it sits on a white window and it's defualt color is grey.
Anyway i've solved with the white brush:
HBRUSH OnCtlColor( CDC* pDC, CWnd* pWnd, UINT ctlColor )
{
return (HBRUSH)GetStockObject(WHITE_BRUSH);
}
|
|
|
|
|
|
Hi,
I have created a class for implementing a doubly linked list. The problem I having is when I'm inserting a new node into the list.
First off, in a function in my class, I create a temporary node and copy the data into it like so:
<br />
PNODE pTempNode;<br />
pTempNode = new NODE;<br />
pTempNode->pNext = NULL;<br />
pTempNode->pPrev = NULL;<br />
pTempNode->pData = new double[dataSize];<br />
<br />
<br />
pTempList->Insert(pTempNode);
The insert function then adds this node to the list like so:
<br />
if(pHead == NULL)
{<br />
pHead = pNew;<br />
pTail = pNew;<br />
return;<br />
}<br />
else<br />
{<br />
<br />
pPrev->pNext = pNew;<br />
pNew->pNext = pCurr;<br />
pNew->pPrev = pPrev;<br />
<br />
}<br />
Problem is though the head always changes to the new node I pass before I have passed it so the new node is not replacing the head.
Thanks for any help and I hope this makes sense!
Dave
|
|
|
|
|
sheepdonkey wrote: so the new node is not replacing the head.
You don't seem to be re-assigning your pHead pointer, so pHead will continue to point to the original head of the list (the first item you added)
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
Thanks,
Pointers are my downfall I don't understand them fully!
How would I re-assign a pointer?
|
|
|
|
|
|
Is is possible to create DLL to automate MSword?
I have done exe version and it works fine but when developing the dll,
if(!WdocApp.CreateDispatch(_T("Word.Application")))
{
AfxMessageBox(_T("Could Not Create The Application Object"));
return false;
}
it is unable to createdispatch and exited ... y???
thks
|
|
|
|
|
You can try to create the CON Addin for Microsoft Addin.
Cheers
"Peace of mind through Technology"
|
|
|
|