|
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.
|
|
|
|
|
Does anyone have a small C++ example on how to use the Image Mastering API (IMAPI) in Windows XP?
In what file does the type library appear in? There is an executable called imapi.exe in the System32 directory but it does not contain the type library.
Regards
Martin
|
|
|
|
|
I have been messing around with the start menu caption.. it's easy in WinXP as once you have EnumChildWindow'ed your way down to it, it's just a case of ::SetWindowText(). However, it's not so easy in W2K as the window text does not correspond to the text in the button... I see that is has the BS_BITMAP style so it's all a bitmap??
any suggestions?!
cheers
Ad.
My world tour
What I do now..
"I spent a lot of my money on booze, birds and fast cars. The rest I just squandered"
George Best.
"I suppose if it was a choice between bon jovi and the interior of a car, the car would win, even it didnt have a radio and I had to sit in silence" James Simpson on Light Metal.
|
|
|
|
|
adamUK wrote:
I see that is has the BS_BITMAP style so it's all a bitmap??
Yes that's correct. Windows explorer creates the bitmap at runtime from the text and the flag icon. You can do the same, if you want to
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"
|
|
|
|
|
adamUK wrote:
any suggestions?!
See http://www.winguides.com/registry/display.php/791/
|
|
|
|
|
|
Hi,
I am trying to create a Modeless Dialog Box with a RichEdit Control using Visual Studio.Net. I am not using MFC as my project is a Win32 project using just the Windows API, but the Rich Edit Control Does not get created when I pass the Dialog Template to CreateDialog(), when I change the resource to a normal Edit control everything works fine. I tried another option of Creating the control using CreateWindow("RICHEDIT"....), this does not seem to work too, I tried getting the Last Error and found that the "RICHEDIT" class is not registered, I tried "RichEdit20A" and that failed too, can someone let me know what I am missing here? Note that this is not an MFC application but plain Win32 API application.
-TIA
Sundar
|
|
|
|
|
Have you initialised it using BOOL AFXAPI AfxInitRichEdit() in the initinstance of your app? I can't remember if it is purely and MFC requirment or not...
My world tour
What I do now..
"I spent a lot of my money on booze, birds and fast cars. The rest I just squandered"
George Best.
"I suppose if it was a choice between bon jovi and the interior of a car, the car would win, even it didnt have a radio and I had to sit in silence" James Simpson on Light Metal.
|
|
|
|
|
You need to load the rich edit ctrl library before creating any rich edit controls. Load "riched20.dll" for rich edit version 2+, or "riched32.dll" for version 1.
--Mike--
"Big handwavy generalizations made from a position of deep ignorance is one of the biggest wastes of time on the net today.
-- Joel Spolsky
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Hello all,
My App needs to load a a list of configurations into a list view at load time. The list will then be user modifiable (add, delete, edit).
What would you all consider to be the best way to do this. An INI file storing each configuration and stored in a folder under the working folder, and loaded at runtime? Or, doing the same thing in the registry.
And, how would you keep track of the items so that the correct number are re-loaded back at runtime. For example:
At startup the list contains 4 items. Item0, Item1, Item2, and Item3. The user deletes Item2. Now there is no real index to keep track of, I can see there are 3 files, but loading them in any logical progression is no longer an option.
Thanks for any suggestions you may have.
Frank
"Keyboard Error - Press F1 to Continue"
|
|
|
|