|
|
Could you post your BitmapButton.cpp here ? Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
CBitmapButton is a Visual studio class.
|
|
|
|
|
OK
Do you have the following in all used *.cpp ?
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
What output comes now after the exiting ?Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
yes i add this in all *.cpp
'Test.exe': Loaded 'C:\Windows\System32\ntdll.dll'
'Test.exe': Loaded 'C:\Windows\System32\kernel32.dll'
'Test.exe': Loaded 'C:\Windows\System32\user32.dll'
'Test.exe': Loaded 'C:\Windows\System32\gdi32.dll'
'Test.exe': Loaded 'C:\Windows\System32\advapi32.dll'
'Test.exe': Loaded 'C:\Windows\System32\rpcrt4.dll'
'Test.exe': Loaded 'C:\Windows\System32\msimg32.dll'
'Test.exe': Loaded 'C:\Windows\System32\comdlg32.dll'
'Test.exe': Loaded 'C:\Windows\System32\msvcrt.dll'
'Test.exe': Loaded 'C:\Windows\System32\shlwapi.dll'
'Test.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6002.18005_none_5cb72f96088b0de0\comctl32.dll'
'Test.exe': Loaded 'C:\Windows\System32\shell32.dll'
'Test.exe': Loaded 'C:\Windows\System32\winspool.drv'
'Test.exe': Loaded 'C:\Windows\System32\oledlg.dll'
'Test.exe': Loaded 'C:\Windows\System32\ole32.dll'
'Test.exe': Loaded 'C:\Windows\System32\oleaut32.dll'
'Test.exe': Loaded 'C:\Windows\System32\winmm.dll'
'Test.exe': Loaded 'C:\Windows\System32\oleacc.dll'
'Test.exe': Loaded 'C:\Windows\System32\imm32.dll'
'Test.exe': Loaded 'C:\Windows\System32\msctf.dll'
'Test.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.0.6002.18005_none_9e50b396ca17ae07\GdiPlus.dll'
'Test.exe': Loaded 'C:\Windows\System32\lpk.dll'
'Test.exe': Loaded 'C:\Windows\System32\usp10.dll'
'Test.exe': Loaded 'C:\Windows\System32\uxtheme.dll'
'Test.exe': Loaded 'C:\Windows\System32\dwmapi.dll'
'Test.exe': Unloaded 'C:\Windows\System32\dwmapi.dll'
Detected memory leaks!
Dumping objects ->
{235} normal block at 0x00286728, 145 bytes long.
Data: < % d > C0 25 C9 01 64 00 00 00 80 00 00 00 01 00 00 00
{227} normal block at 0x002866D8, 20 bytes long.
Data: < % > C0 25 C9 01 03 00 00 00 03 00 00 00 01 00 00 00
{226} normal block at 0x00286640, 85 bytes long.
Data: < % D D > C0 25 C9 01 44 00 00 00 44 00 00 00 01 00 00 00
{225} normal block at 0x00286598, 103 bytes long.
Data: < % V V > C0 25 C9 01 56 00 00 00 56 00 00 00 01 00 00 00
Object dump complete.
The program '[3536] Test.exe: Native' has exited with code 0 (0x0).
|
|
|
|
|
1) Try to create, select and delete your background pen outside the drawing loop.
2) Could you post your *.cpp here ? Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
Eugen Podsypalnikov wrote: Try to create, select and delete your background pen outside the drawing loop.
thanks its works
|
|
|
|
|
I have this code for allocating memory for 2-d int array.
int **p = (int **)malloc(MAXROW*sizeof(int *));
for(int i = 0; i < MAXROW; i++)
{
p[i] = (int *)malloc(MAXCOL*sizeof(int));
}
How can i optimize this code in one line?http://nnhamane.googlepages.com/
|
|
|
|
|
Nilesh Hamane wrote: How can i optimize this code in one line?
It is unclear to me what your are asking here. Do you mean by using just one dynamic memory allocation? What aspect of the situation are you trying to optimize - code size or speed; initial setup or use?
I am presuming that you are using C and not C++.
There are a variety of options that you can use. If this is really critical for your application, you will probably have to run some tests to see what is best in your situation.
A second possible approach is to do one allocation of col * row ints and explicitly calculate the offset into this array for each access.
A third approach is to keep your first allocation of row pointers to int, supplement it by a second allocation of col * row ints and set each row pointer to a subsequent group of col ints in the second block.Please do not read this signature.
|
|
|
|
|
as Avi told.. here is how it goes..
//FIRST approacc
int* p[MAXROW];
p[0] = (int*)malloc(MAXROW*MAXCOL*sizeof(int));
for(int i=1; i<MAXROW; ++i)
p[i] = p[i-1] + MAXCOL;
//SECOND approach
int **p = (int **)malloc(MAXROW*sizeof(int *));
p[0] = (int *)malloc(MAXCOL*MAXROW*sizeof(int));
for(int i = 1; i<MAXROW; i++)
p[i] = p[i-1] + MAXCOL;
both aproach seems better since all memory allocation is done at once..
|
|
|
|
|
what's wrong with
int * p = (int *) malloc(COLS * ROWS * sizeof(int));
?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]
|
|
|
|
|
Just make a function void Make2DInt(int**& ppToCreate, int iWidth, int iHeight)
and then call it at one line... Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
Remove all the white space and new lines?
L u n a t i c F r i n g e
|
|
|
|
|
Don't die, until you do.
|
|
|
|
|
Hi All
How to random numbers between 0 t0 1000000?Please help me
|
|
|
|
|
rand()[^]
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Thanks for reply
i use this way
int iSecret, iGuess;
srand ( time(NULL) );
for(int x=0;x<;5;x++)
{
iSecret = rand() % 10 + 1;
}
Then i am getting duplicate number.Sorry sir i want to generate random unique number.
Please help me
|
|
|
|
|
What do you mean you get "duplicate" values? The numbers generated are random. Take a look at another example[^]
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Duplicate values means generated random number repeated.
Now i see example given by you.But result is different.
int i, j, goAhead, timeSeed ;
timeSeed = (int) time(0) ;
printf("Setting seed to be: %d\n", timeSeed) ;
srand(timeSeed) ;
i = 0 ;
for (; i < 10 ; i++)
{
for (j = 0 ; j < 5 ; j++)
{
printf("%d ", rand() ) ;
break;
}
printf("\n") ;
}
Result show more than 10 times.
|
|
|
|
|
you can't generate random numbers between 0 and 1000000 because rand() returns integer less than RAND_MAX which is defined as 32767. So the values returned will be in between 0 and 32767. So the better way is to perform some bit shift operations on the returned random number to make it in the range of 0 to 1000000.
To avoid duplication, suppose if you want to generate 10 unique random numbers from 1 to 10..
int num[10];
for(int i=0; i<10; ++i)
num[i] = i+1;
srand ( time(NULL) );
for(int i=0; i<10; ++i)
{
int index = rand() % 10;
int temp = num[i];
num[i] = num[index];
num[index] = temp;
}
modified on Tuesday, March 9, 2010 7:39 AM
|
|
|
|
|
Thanks Cool_Dev
Problem solved.
|
|
|
|
|
You may read my tip about [^], I wrote about cards in a deck, but the logic is more general.
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]
|
|
|
|
|
Unique numbers in 'random' order:
void main( void )
{
const int num = 1000000;
int array[num] = {0};
for (int i = 0; i < num; i++)
array[i] = i;
random_shuffle(array, array + num);
} "One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi all,
I am getting the following error when i try to update the system registry using the following function in InitInstance():
UpdateRegistry(OAT_DOC_OBJECT_SERVER);
"Failed to update system registry.Please try using regedit"
How to resolve this issue. Could not give admin rights to the user.
Thanks,
|
|
|
|
|