|
Does anybody know how to used the CRecentFileList::GetDisplayName. I have seen it in MSDN, but I am uncertain about its parameters and how to programatically insert it into my code. Can anyone provide any source code for this member function?
|
|
|
|
|
void CMnuApp::MyFun(CString str[] )
{
//AfxMessageBox("In My Fun");
ASSERT_VALID(this);
if (m_pRecentFileList == NULL) // no MRU files
return;
//else
//m_pRecentFileList->UpdateMenu(pCmdUI);
int size = this->m_pRecentFileList->GetSize();
m_pRecentFileList->GetDisplayName( str[0],0 , "D:\\vc-pgms\\TstCtrl", strlen("D:\\vc-pgms\\TstCtrl"), 1) ;
m_pRecentFileList->GetDisplayName( str[1],1 , "D:\\vc-pgms\\TstCtrl", strlen("D:\\vc-pgms\\TstCtrl"), 1) ;
}
|
|
|
|
|
I am trying to something that should be very simple. I am filling a CStatic with text until the GetTextExtentPoint32 function returns a width close to the width of the CStatic.
The end result is that the CStatic has much more room than what GetTextExtentPoint32 is saying the string width will be.
Is there something else I need to do?
The loop ends when it determines that the newSize.cx will be greater than the nWidth (determined by GetWindowRect()). The string returned is much smaller than the width of the window (nWidth). (nMargin = 2).
(Sorry about the tabs, I thought the code button might deal with it)
Thank you!!
SIZE newSize;<br />
::GetTextExtentPoint32(hDC,szNew,szNew.GetLength(),&newSize);<br />
if (newSize.cx < (nWidth + nMargin)){<br />
int nIns = 1;<br />
while (!bFound && (nIns <= szMid.GetLength())){<br />
CString szInsert = szMid.Right(nIns++);<br />
szNew.Format("%s\\...%s\\%s",szDir,szInsert,szFile);<br />
::GetTextExtentPoint32(hDC,szNew,szNew.GetLength(),&newSize);<br />
if (newSize.cx >= (nWidth + nMargin)){<br />
bFound = TRUE;<br />
szRet = szNew;<br />
}<br />
}<br />
}
|
|
|
|
|
Your code looks ok to me, is hDC the right DC?
Hmmm, are you changing the font between this and when you set the text in the static?
Dave_ wrote:
(Sorry about the tabs, I thought the code button might deal with it)
Naaa, it's the pre tag... Like:
if (whatever)
{
something();
}
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I think you had the right idea. I assumed that the CStatic's font had been selected prior to my call. I added the SelectObject() call before calling my function, and things improved greatly.
Thank you very much for your help.
|
|
|
|
|
I would guess that you don't select the correct font into the DC (hDC) before you are calling GetTextExtentPoint32. Get the font from the static control using GetFont(), then select it into the DC before you call GetTextExtentPoint32. Also, don't forget to select the old font back into the DC when you are done.
Chris Richardson
C/C++ Include Finder[^]
|
|
|
|
|
That was it. Thank you very much.
When I read the documentation for GetTextExtent32, it mentioned that the current font would be used to determine the extent, but I guess I was assuming (incorrectly) that the font was selected at the time I called it.
Thank you!
|
|
|
|
|
Hello,
I am a C++ programmer trying to write my own email client, and I have come across some parsing problems in the MIME emails I am receiving via POP3 .
1) I get the characters "=20" (amongst others) appearing at the end of some lines of HTML code, as follows:
Hi=20
Mum
<span=20
class=3d918052115-03022003>
Glad=20
the various problems were solved:
<span=20
class=3d918052115-03022003>Windscreen: You were lucky, I had to =
part with=20
=A3110 recently when my rear window motor really did burn out. I =
think I=20
told you I got this fitted for =A310 (back street handyman) rather than =
the =A340=20
quoted by Peugeot dealer
2) I also received the following code in an email:
=3Chtml=3E
=3Chead=3E
=3Ctitle=3ESexual Meeting=2E=2E=3C=2Ftitle=3E
=3Cmeta http-equiv=3D=22Content-Type=22 content=3D=22text=2Fhtml=3B charset=3D=22=3E
=3C=2Fhead=3E
=3Cstyle type=3D^text=2Fcss^=3E
a {font-weight=3A bold=3B color=3A #FFFFFF=3B text-decoration=3A none}
a=3Ahover { color=3A #FF0000=3B text-decoration=3A underline}
body=09{
=09=09background-color=3A #000000=3B
=09=09color=3A #000000=3B
=09=09margin-left=3A 0px=3B
=09=09margin-top=3A 0px=3B
=09=09font-family=3A Trebuchet MS=2C arial=2C verdana=2C helvetica=3B
=09=09font-size=3A 20px=3B
=09}
Barring the actual nature of the second spam email, I am confused by the =09, =3C etc. etc.
Is this code some thing to do with MIME character sets??? What do I convert them to, or is this an encoding problem such as Base64??
I would be very grateful for some explanation of the above emails.
Thanks,
Paul Trimming
|
|
|
|
|
It's encoded with QuotedPrintable
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi,
Could any of you knowledgable types tell me how to turn a static text control into a hyperlink ? my current system of buttons is somewhat crude.
Any help appreciated
|
|
|
|
|
Check David Calabro's CButtonST [^].
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have a problem . When I want to create .INI file with some SECTIONs and I want to insert SPACE among them . Ex. :
[Section1]
data1 = ...
data2 = ...
<= there I want to create the SPACE
[Section2]
Best regards.
Tomas
|
|
|
|
|
?? huh? Does:
outfile << "data2 = " << data2 << "\n\n" << "[Section2]\n";
not work??
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
this can be right, but I adding rows to the ini file by WritPrivateProfileString and I can`t make the SPACE !!! I tryied many ways to make the SPACE but I don`t be successful .
thank you
Tomas
|
|
|
|
|
I think you would need to flush the file after doing your WritePrivateProfileStrings(), and then go back and open it using something like a CStdioFile to write the blank lines. You could also do it with a binary file, I don't know which would be easier.
The point is that WritePrivateProfileString does not have an option to do this as far as I know. I have been using this function for a long time, and have never seen a way to do this wihtout manually writing to the file. I could be wrong. It's happened many times before.
Good luck.
|
|
|
|
|
Can someone help me with the RS422 programing? I have a device that can be controlled via RS232 or RS422. I can write a program to control this device in RS232 mode. My question is, does this program still work if I switch the device to RS422 mode? What do I need to do to make this program work in RS422 mode? Do I need a RS232 - RS422 converter?
thanks,peter.
|
|
|
|
|
Yes, you would need a RS232-RS422 converter. Other than that, you won't have to change your software. Except...
I can never remember if it is the RS422 or the RS485 converter that might use a control signal to know when it send or receive data. Your flow control settings should hand this without problem (CTS/RTS or DSR/DTR). However, this is usually important only for multi-drop system.
If you want your RS232 application to support RS422 and RS485, just make sure you support both your hardware flow control settings. In 8 years of process control with our product, we have never run into a RS422 or RS485 issue.
FYI: For distance applications or high noise, RS422 is much better. You will find it commonly used in any type of hostile environment.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I have tons and tons of experience in C++. Infact I spend my day as in 24/7 mostly. Just programming applications and such. By writing usualy all of my code alone. I have for like 4-5 years all I do is make Win32 apps and win32 direct x games all day. I even learned C++ fully on my own. Even though when I took one college class I barely really paied attention yet I finished the class with a 97% all assignments and tests I did were A's. I have already written small versions of compilers that convert my designed language into assembly. I've also made win apps that process file types as a scripting language. Still I find that I won't be making very much money on a job considering I never have had one. As well as I only learned most everything on my own through trial and error. Even the teacher at my college suggested I get a PhD in computer science she thought I was extremely capable of doing it. I took that class when I was 14 and now im 17 and I know about 9x more then based on my own practice of programming constantly at home.
- LiquidKnight
|
|
|
|
|
What is your problem!?
This is a Lounge/Soapbox message!
Please, don't post such messages here in future!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
|
Relax!
New in these forums? 23 messages so I made a guess!
I'll contact you... now...
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
BTW!
LiquidKnight wrote:
I have already written small versions of compilers that convert my designed language into assembly.
Could you show me some example in how you do this!?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Sure. You can contact me on email It wont be for awhile but if you can send me an email to killereaglesoftware@yahoo.com I will get it to you because currently my computer that I was programming on crashed because my motherboard died. Or you can even contact me on AIM if you have it my name is AIM: LiquidIceKnight or AIM: vethax0r or AIM: ally0urba5e feel free to contact me I really have nothing else to do right now. Or even my MSN: spartacushaxor@hotmail.com
I really would enjoy explaing it to you
- LiquidKnight
|
|
|
|
|
Rickard Andersson wrote:
Could you show me some example in how you do this!?
Try here[^]. Look towards the bottom for a series of links labelled "Scripting Language Tutorial Series". Very useful.
J
"We cross our bridges when we come to them and burn them behind us, with nothing to show for our progress except a memory of the smell of smoke, and a presumption that once our eyes watered." - Tom Stoppard - Rosencrantz and Guildenstern are Dead.
|
|
|
|
|
Cool!
Thank you very much!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|