|
|
Yes.
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]
|
|
|
|
|
Thanks CPallini,
Question answered.
regards,
George
|
|
|
|
|
When I view my application exe in the task manager, the value below the "Mem Usage" under process tab keeps on increasing at the rate of 40 k to 60 k each time. for eg initially When i run my application exe, it showed 3096 k and gradually increased to 26136 k after 40 minutes. Anyone tell me, Whats the cause for this problem and how can i avoid this?
Anu
|
|
|
|
|
Possibly memory leak. I.e you might have allocated some memory using the functions such as new or malloc , but didn't free it using the delete or free(). . Review your code..
|
|
|
|
|
Probably you'll not be releasing the memories allocated. which may cause memory leaks. You can profile your application with tools bounds checker to detect the memory leak.
other handy tools like Leak Diag[^] and Visual Leak detector[^] can be used as well.
Before applying any tools, you've to cross check your source with memory allocation and correspondnig de allocation. Also have to check for dangling and orphan memory allocations(assigning new memory location to a pointer without releasing the existing one).
YOu can also seek help from Crt Debug libraries to get information about memory leak. Please check this post.[^]
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Well, you know, the Universe is expanding...
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]
|
|
|
|
|
You better suggest him to find his memory leaks.
Laughing over somebodies bugs isnt so funny.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: You better suggest him to find his memory leaks.
Some people already did (very well indeed).
KarstenK wrote: Laughing over somebodies bugs isnt so funny.
I didn't intend to mock the OP, IMHO a bit of humour helps, sometimes.
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]
|
|
|
|
|
It seems you have a little problem with KarstenK.
|
|
|
|
|
Nope. He kindly expressed his opinion and so did I.
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]
|
|
|
|
|
Memory leak:maybe your problem is of pointers or graphic handles(can you more explain about your program).
|
|
|
|
|
Hey
I'm writing a small global hooking app that will intercept all the WM_COPY messages.
So, I read and found an article about "using hooks" in MSDN:
http://msdn.microsoft.com/en-us/library/ms644960(VS.85).aspx[^] (pretty good article!)
It says in the article:
"You must place a global hook procedure in a DLL separate from the application installing the hook procedure."
That is, in SetWindowsHookEx() I must pass the DLL I loaded and the address of the function.
And I don't really understand why is that.
Why can't I just give a pointer to a function in my application?
I guess that it is because threads from other processes cannot access my application, but they can access a DLL I loaded to the memory from my application.
Can someone take a few minutes to explain the newbie ???
Thanks a lot in advance!
|
|
|
|
|
Green Fuze wrote: but they can access a DLL I loaded to the memory from my application
This is not true. All applications which is affected by the hook also loads this dll.
If you want you can verify this using the process explorer.
|
|
|
|
|
|
I have an string which contains the following data
str = "FFDA0890DA"
"FFDA0890DA" is actually an hexadecimal for of data , i need to convert this to an BYTE array
*bArray = {'F','F','D','A','0','8','9','0','D','A'}
|
|
|
|
|
you can access individual characters using
str[i] // where i is the index of that char you want to access.
There is no need to convert..
I hope it makes sense.
Regards,
Sandip.
|
|
|
|
|
kapardhi wrote: str = "FFDA0890DA"
"FFDA0890DA" is actually an hexadecimal for of data , i need to convert this to an BYTE array
*bArray = {'F','F','D','A','0','8','9','0','D','A'}
Will be something like this, take care of empty string issues.
std::vector<BYTE> ToBytes( const CString& str )
{
const int ByteLength = ( str.GetLength() * sizeof( TCHAR )) + 1;
std::vector<BYTE> Bytes(ByteLength);
memcpy_s( &Bytes[0], ByteLength, static_cast<lpctstr>( str ), ByteLength );
return Bytes;
}</lpctstr>
std::vector<BYTE> Bytes = ToBytes( CString( _T( "Nibu in bytes :P" )));
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
modified on Friday, August 22, 2008 4:15 AM
|
|
|
|
|
Usually hex string are converted to BYTE arrays two characters at time. For instance
str = "FFDA0890DA"; becomes BYTE a[]={0xFF, 0xDA, 0x08, 0x90, 0xDA};
Are sure about the conversion required?
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]
|
|
|
|
|
yes i need some what in similiar manner!
|
|
|
|
|
Please, be precise.
Given str = "FFDA0890DA"
do you need
BYTE b[] = {'F','F','D','A','0','8','9','0','D','A'}; or
-
BYTE b[] = { 0xFF, 0xDA, 0x08, 0x90, 0xDA };<br />
?
(no need to say they're quite different... )
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]
|
|
|
|
|
sorry i have shown in a wrong way previously i actually need in following manner
BYTE b[] = { 0xFF, 0xDA, 0x08, 0x90, 0xDA };
|
|
|
|
|
kapardhi wrote: sorry i have shown in a wrong way previously i actually need in following manner
BYTE b[] = { 0xFF, 0xDA, 0x08, 0x90, 0xDA };
This function does this, do test well, you also need to handle empty string cases...
std::vector<BYTE> CStringBytes_To_RealBytes( const CString& str )
{
const LPCTSTR pBuff = static_cast<lpctstr>( str );
const int ByteLength = str.GetLength();
std::vector<BYTE> Bytes;
Bytes.reserve( ByteLength );
for( int Index = 0; Index < ByteLength; Index+=2 )
{
TCHAR Temp[3] = { 0 };
_tcsncpy_s( Temp, 3, &pBuff[Index], 2 );
Bytes.push_back( static_cast<BYTE>( _tcstol( Temp, NULL, 16 )));
}
return Bytes;
}</lpctstr>
std::vector<BYTE> Bytes = CStringBytes_To_RealBytes( CString( _T( "FFDA0890DA" )));
This function assumes that two characters in the above string equals one byte.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Well, for instance, using plain C (working on even-lenght hex strings, error checking omitted)
void main()
{
char * str = "FFDA0890DA";
int i, size;
int k;
BYTE * b;
size = strlen(str) / 2;
b = (BYTE*) malloc(size * sizeof(BYTE));
for (i=0; i<size;> {
sscanf(str+2*i, "%2x", &k);
b[i]= (BYTE) k;
}
for (i=0; i<size;> {
printf("b[%d] = 0x%02X\n",i, b[i]);
}
free( b);
}
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]
|
|
|
|
|
Please Guide Connect Sqlserver with VC++6.0.
application is win32 consoleApplication
thanks very much
|
|
|
|
|