|
have you searched the web before asking ?
is CIni[^] of any help ?
|
|
|
|
|
toxcct wrote: is CIni[^] of any help ?
Doesn't this class require a file to operate on?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Can I set an application to run each time with a certain priority without chainging from Windows task manager?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Any reason you can't just call
<br />
BOOL WINAPI SetThreadPriority(<br />
HANDLE hThread,<br />
int nPriority<br />
);
on your main thread on startup?
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thank you!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
<br />
#define NORMAL_PRIORITY_CLASS 0x00000020<br />
#define IDLE_PRIORITY_CLASS 0x00000040<br />
#define HIGH_PRIORITY_CLASS 0x00000080<br />
#define REALTIME_PRIORITY_CLASS 0x00000100<br />
<br />
SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS);<br />
Note that setting the priority too hugh can cause other processes/threads of lower priority to become starved.
Best Wishes,
-Randor (David Delaune)
|
|
|
|
|
Thank you!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
I need to analyze crash dump (sent by client) in the Windbg.
The problem is that I don't have original .PDB file for my .exe, I only have original project and sources. But when I compile it again, WinDBG does not load new symbols althought I'm 100% sure the sources are correct. Maybe it is by different time stamp.
I'm getting these errors:
*** WARNING: Unable to verify checksum for app.exe
*** ERROR: Module load completed but symbols could not be loaded for app.exe
I'm using correct symbol&exe path and there is no checksum in exe (it's set to 0).
.reload /i does not help
I'm using VC6.0 to compile.
Any ideas how to make it working?
Thank you!
rrrado
|
|
|
|
|
Please help! I am a VB/C# developer and just cannot get the following code to work. It is a checksum routine written in C++ and I am recreating it in VB.NET.
I have pretty much everything in place but there is something not right (ie, it isn't working!);
unsigned long check_sum( int file_ptr )
{
unsigned long check_ul = 0L;
unsigned char temp = '0';
CRC_INIT( check_ul );
while( read( file_ptr, &temp, 1 ) > 0 )
{
if( (temp == '\r') || (temp == '\n') || (temp >= '0' && temp <= '9') )
CRC_DATA( check_ul, temp );
}
CRC_STOP( check_ul );
return( check_ul );
}
/*
* NOTE:
* c is unsigned long
* d is unsigned char or char
*/
#define CRC_INIT( c ) c = 0xffffffffL
#define CRC_DATA( c, d ) c = crc_32_tab[ ( int )(((unsigned char)c^(unsigned char)(d)) & 0xff) ] ^ ( c >> 8 )
#define CRC_STOP( c ) c = c ^ 0xffffffffL
unsigned long crc_32_tab[] =
{ 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,.. ETC, ETC. (256 items)
The line I think I am struggling on is this one;
#define CRC_DATA( c, d ) c = crc_32_tab[ ( int )(((unsigned char)c^(unsigned char)(d)) & 0xff) ] ^ ( c >> 8 )
This is how I am approaching in VB;
Private Function CRC_DATA(ByVal inChar As Char) As Long
'First extract least significant byte from mCheckSum
Dim b As Byte = mCheckSum And &HFF
'Get the numeric value out of the char passed
Dim c As Byte = Val(inChar)
'Exclusive or the above two
Dim d As Byte = b Xor c
'AND the result with FF
Dim e As Byte = d And &HFF
'e is your indexer. Get the byte from lookup table
Dim f As Long = ChecksumBytes(e)
'Finally, XOR the retireved byte with c shifted 8 bits right
'Dim g As Long = f Xor (mCheckSum >> 8)
Dim g As Long = f Xor (mCheckSum >> 8)
Return g
End Function
Any help would be great
Thanks in advance
Richard
|
|
|
|
|
i'm not going to explain all this method, so, what exactly don't you understand ?
(what part, of what lines ?)
|
|
|
|
|
Hi. Sorry, the C++ code is taken from a text file and I think the answer will be for me to actually get it running in VS2005 so I can step through it.
Then it can be analysed properly.
Just gotta find a walkthrough somewhere, not sure exactly where I should paste the code into a C++ project (or how to get the file_ptr)
Thanks for your help
Rich
|
|
|
|
|
Your first mistake is to write it in VB.Net
Seriously,
at first sight it seems ok. Could you check whether the VB.Net '>>' is equal to the c/c++ '>>'.
Because the c/c++ '>>' behaves differently used on a signed variable then on a unsigned variable.
Shift right with 8 is equal to divide by 256 if i'm not mistaking. So you could replace
mCheckSum >> 8 by mCheckSum / 256
Hope that his helps
codito ergo sum
|
|
|
|
|
Hi Thanks for this. I do get a different result with /256 and >>8 but neither are right. It's very difficult to debug because I have nothing to check at any part of the process!
I'm thinking if I put the C++ into a project and got it working in VS2005, then I could step through it, and that would surely get me to the answer, because i could watch it step by step.
Sadly, I have never used C++ before so I wouldn't know how to get it running in a project (even). How sad for us VB developers, been shielded for too long from the real problems of prgramming!!
Thanks for your help, there must be a walkthrough I can find to get the check_sum routine running. See - I wouldn't know how to pass in the file_ptr, even though I have the files that this solution intends to use!!
|
|
|
|
|
Hi,
I'm sorry i didn't think thought of this in my previous reply.
But I think i have found a problem in your code.
The c code uses an unsigned integer (32 bit) wich ranges from 0 - 4294967295.
The vb code uses for the same data a long value (32 bit) but this is a signed value, hence the range is from -2,147,483,648 to 2,147,483,647.
This could lead to some unpredictable results when shifting or dividing.
Maybe you could use a Double instead of a Long to hold the checksum, but im not sure about it. I will try to test this.
codito ergo sum
|
|
|
|
|
Hey BadKarma. I really appreciate your efforts but this didn't help.
I set about trying to get the C++ code working in VS.NET, and I'm tearing my hair out with it!! I got so close, and it was building okay, then I had to read in from a text file. I thought this would be easy, particularly as Microsoft provided a very useful walkthrough. But no matter where I put this line of code;
StreamReader *objReader = new StreamReader("c:\\test.txt");
I get this error;
C3699: '*' cannot use this indirection on type 'System::IO::StreamReader'
I am 'using' System::IO and System::Collections in the header file but this error means I cannot compuile and therefore go any further. I got so close too!
It must be something relatively simple but I am totally unfamiliar with managed C++ (or any C++).
If you can help me to read up from my text file, I will be able to watch the original C++ code in action which will enable me to work out whats going on.
Yours gratefully
Richard
|
|
|
|
|
I'm not familiar with Managed C++, but i think that when using managed types like the StreamReader you can't use pointers (*), you should use a handle/reference/managed pionter (^) or wathever they call it.
The following should work
StreamReader ^objReader = new StreamReader("c:\\test.txt");
or
StreamReader ^objReader = gcnew StreamReader("c:\\test.txt");
-- modified at 13:56 Friday 9th November, 2007
codito ergo sum
|
|
|
|
|
Try to debug and go step by step if everything does what you are expecting them to do. Isolate where the problem is, and if you don't know why... ask more specifically. You will have a faster/better answer
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Yes, you're right. I received the C++ code in a text file and I hope to get it running in VS2005 somehow. Thanks very much, I'm off to find a walkthrough!
Rich
|
|
|
|
|
<br />
_ConnectionPtr* CEGraphApp::GetConn()<br />
{<br />
return &m_pConn;
}<br />
error info:
Compiling...
EGraph.cpp
C:\EGraph\EGraph.cpp(154) : error C2440: 'return' : cannot convert from 'struct _Connection ** ' to 'class _com_ptr_t<class _com_iiid<struct="" _connection,&struct="" __s_guid="" _guid_00000550_0000_0010_8000_00aa006d2ea4=""> > *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
amazing...
I think it should be right anyhow.
-- modified at 9:18 Tuesday 6th November, 2007
|
|
|
|
|
if m_pConn is declared with _ConnectionPtr *m_pConn
then your return statement should be : return m_pConn; without the & operator
|
|
|
|
|
Sorry, a typing error
m_pConn is declared as _ConnectionPtr m_pConn
|
|
|
|
|
and what is _ConnectionPtr defined like ?
|
|
|
|
|
It's a type in ADO.
What's in msado15.tlh:
<br />
_COM_SMARTPTR_TYPEDEF(_Connection, __uuidof(_Connection));<br />
I think it's not for reading.
|
|
|
|
|
It is smart pointer, I think you should define function like this:
_ConnectionPtr CEGraphApp::GetConn()
{
return m_pConn;
}
don't use pointers to smart pointers
rrrado
|
|
|
|
|
It is ok. I suppose returning a pointer is more efficient.
|
|
|
|