|
see answer to kuphryn...
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
I found the answer on Intel's site:
CPU Counting Utility[^]
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
I need 2 structures that have references to eachother. In this situation I need to do some forward declaring. I know how to do this when using a reference (pointer) to the other structure, but I don't want to use pointers so I don't have to create the structure with new and destroying them with delete when I don't need them anymore.
So what my question basically comes down to, is it possible to have circular references without using pointers? e.g. something like:
<br />
typedef std::list<struct TParamValue> TParamValues;<br />
typedef std::list<struct TParamField> TParamFields;<br />
<br />
typedef struct TParamValue<br />
{<br />
CString value;
CString description;
TParamFields fields;
} TParamValue;<br />
<br />
typedef struct TParamField<br />
{<br />
unsigned long index;
unsigned long bits;
CString description;
CString currentValue;
TParamValues values;
} TParamField;<br />
|
|
|
|
|
Brian van der Beek wrote:
So what my question basically comes down to, is it possible to have circular references without using pointers?
No. To fully specify a structure, the compiler has to know the size of every member, which means they have to be fully specified. If you have a circular reference, neither of the structures are fully specified, so neither can be compiled because they rely on the other one.
It's a never-ending loop which the compiler can not sort out. The only way to solve this problem is using pointers or references.
However, your situation may work (I'm not sure what the compiler might complain about). std::list internally uses pointers, so the compiler might accept it. You can try, but don't be surprised if it doesn't work.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
It's a never-ending loop which the compiler can not sort out. The only way to solve this problem is using pointers or references.
I was afraid of that.
Ryan Binns wrote:
However, your situation may work (I'm not sure what the compiler might complain about). std::list internally uses pointers, so the compiler might accept it. You can try, but don't be surprised if it doesn't work.
I doesn't work. I do have a question about your remark though. Does std::list use pointers? I always though it just stored the specified type, i.e. <T> instead of <T*> .
|
|
|
|
|
Brian van der Beek wrote:
I do have a question about your remark though. Does std::list use pointers? I always though it just stored the specified type, i.e. <t> instead of <t*>.
I was wrong It stores the object as a member of a private structure - which it stores pointers of. I forgot about that . So no, your situation won't work.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I've searched on how to remove the scrollbars on a CWebbrowser2 component, and the only thing I've found was to modify the HTML file itself by adding scroll=no to the <BODY> tag.
Is there another way that I missed ?
Thanks.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
I am working now on my own shell wich substitutes explorer.exe. Why do I need ths? - For security reasons
I am having problems with language switching in WinXP. When I press Ctrl+Shift, the keyborad language supposed to change, but It does not.
In Win9x/2000 there is no such problems since keyboard indicator is placed automatically into systray, But this does not work in WinXP!
Where can I get info about how to write own keyboard indicator or (even better) find the source code of working sample?
Thanks.
|
|
|
|
|
Hi,
I want to use OnCtlColor message to change the backgroung color of a Dialog. I use it like this :
CBrush m_Brush;<br />
<br />
m_Brush.CreateSolidBrush(RGB(212,212,226));<br />
<br />
HBRUSH MyClass::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
return m_brush;<br />
}
It work, BUT THE BACKGROUNG COLOR OF ALL MY EDIT CONTROL ON THIS DIALOG are paint also by the bush.
Is There any way to keep the back color of an edit control to white by default ?
Thanks in advance
|
|
|
|
|
pWnd points to the control being coloured. Use this to determine whether you want to do the colouring or not.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
check the nCtlColor param.....
|
|
|
|
|
Hi, is there any effective way to know a process is dead?
Qin An
|
|
|
|
|
An easy way is to call GetExitCodeProcess() on the handle of the process you want ot check. If it is still running, the code will be STILL_ACTIVE, otherwise it will be the exit code of the process.
Phil
|
|
|
|
|
I am attempting to send e-mails using SMTP out of an MFC application. I am able to connect to a server just fine, and I receive the opening "greeting" from the server-- 220..... I am using the CSocket class to make my connection to the mail servers, and CArchive classes to pass the information to and from the server. For some reason, after I send the "HELO <server>" message, I am not receiving anything back from the server...which obviously leads me to believe that either I need to send my messages as something different than the CStrings that I am using now, or that I may need to use something other than CArchives to pass my messages. If anybody has had experience using SMTP out of an MFC application and knows what I'm doing wrong, I'd love some help.
Here is the function I am using to pass my HELO greeting to the e-mail servers. arOut and arIn are CArchive objects, and are both pointers that get created when a connection is made to the server. The application is currently waiting forever on the arIn->ReadString( InString ) line, as the server isn't responding to my attempt to pass a string to it.
BOOL SMTP::HELO( )
{
if ( arOut )
{
arOut->WriteString( "HELO SIR" );
arOut->Flush();
if ( arIn )
{
CString InString;
arIn->ReadString( InString );
return TRUE;
}
}
return FALSE;
}
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
DougwW48 wrote:
the server isn't responding to my attempt to pass a string to it.
Absolutely. With the SMTP protocol, every line must be terminated with a carriage return and line feed. You need to send "HELO SIR\r\n" before it will respond.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Don't use CArchive classes to communicate with standard TCP/IP applications. They work properly only when the other end uses CArchive as well. You should use straight WinSock functions to communicate with a SMTP server.
|
|
|
|
|
Using CArchive::WriteString() and CArchive::ReadString() is fine. The other CArchive member functions (except Read() and Write() ) won't work, as you said.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
|
Try to add a "\r\n" (carriage return and line feed, is this order) after your SMTP commands...
Ex:
arOut->WriteString( "HELO SIR\r\n" );
arOut->Flush();
?
|
|
|
|
|
How does one go about drawing line numbers to an MFC application? Would I simply use a pen in my derived CView OnDraw function and draw the current lines or is there a different way? Thanks.
|
|
|
|
|
mcguile257 wrote:
Would I simply use a pen in my derived CView OnDraw function and draw the current lines
Yes.
mcguile257 wrote:
is there a different way?
No.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I'm trying to come up with an algorithm which will generate a readable hash index for use in a project.
The string I can play with is "ABCDE".
The aim is to generate the smallest number of characters to represent each unique display of those characters. Like this
"A"
"B"
"C"
"D"
"E"
"AA"
...
"AE"
"BA"
..
"BE"
..
"EE"
"AAA"
...
"EEE"
etc.
I just can't seem to get it.. Any clues or the name of this particular programming challenge appreciated.
|
|
|
|
|
Kinda cheesy but here's one way:
CStringArray arr;
CString str;
for (char l1 = 'A'; l1 <= 'E'; l1++)
{
str = l1;
arr.Add(str);
}
for (l1 = 'A'; l1 <= 'E'; l1++)
{
for (char l2 = 'A'; l2 <= 'E'; l2++)
{
str = l1 + l2;
arr.Add(str);
}
}
for (l1 = 'A'; l1 <= 'E'; l1++)
{
for (char l2 = 'A'; l2 <= 'E'; l2++)
{
for (char l3 = 'A'; l3 <= 'E'; l3++)
{
str = l1 + l2 + l3;
arr.Add(str);
}
}
}
for (l1 = 'A'; l1 <= 'E'; l1++)
{
for (char l2 = 'A'; l2 <= 'E'; l2++)
{
for (char l3 = 'A'; l3 <= 'E'; l3++)
{
for (char l4 = 'A'; l4 <= 'E'; l4++)
{
str = l1 + l2 + l3 + l4;
arr.Add(str);
}
}
}
}
for (l1 = 'A'; l1 <= 'E'; l1++)
{
for (char l2 = 'A'; l2 <= 'E'; l2++)
{
for (char l3 = 'A'; l3 <= 'E'; l3++)
{
for (char l4 = 'A'; l4 <= 'E'; l4++)
{
for (char l5 = 'A'; l5 <= 'E'; l5++)
{
str = l1 + l2 + l3 + l4 + l5;
arr.Add(str);
}
}
}
}
}
I believe that yields 3,905 (51 + 52 + 53 + 54 + 55) combinations.
|
|
|
|
|
may you describe it a bit more?
but... if you create a "normal" hashkey which
is suitable for the hashspace, and then transform it to ASCII?
LOWELL = 76 79 87 69 76 76
-> S = 7679 + 8769 + 7676 = 24124
your hashspace is 19937 (should be prime)
24124 % 19937 = 4187
and now put it to ASCII 41 and 87

|
|
|
|
|
I have a 2D array (1024x1024) of intensity values of an image in my VC++ code(which is not stored on disk as a bmp or jpeg), and I have a dialogbox which contains an image within a frame of 400x400 pixels already. I want to compress my 1024x1024 array of pixels and set a transperent mask of this on top of the existing image in my dialog box. I am trying to find the best way to do it. Any suggestions would be appreciated.
|
|
|
|