|
Henitz wrote: tried:
AppendLineToMultilineEditCtrl(m_Edit,LPCTSTR(line::GetData()));
It gave the error:
The problem is in the signature of AppendLineToMultilineEditCtrl() . See its signature below.
Henitz wrote: void AppendLineToMultilineEditCtrl(CEdit& edit, LPCTSTR pszText)
From name, i guess, you want to add multiple strings to edit control and you're calling the function with string array, but that function takes only a string as param. I think, you need the following one.
void AppendLineToMultilineEditCtrl(CEdit& edit, CStringArray& arrLines)
{
}
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
If did, I have to change all code of the function.
Do you how to do ?
|
|
|
|
|
I don't want to offend you, but the solution given is from basic level, if you dont know how to iterate an array... I strongly recommend you to start reading a basic manual and trying easy things at the beggining to go complicating them incrementally.
One hint:
for (intial condition; while condition; iteration)
{
//here the things that have to be repeated
}
Regards.
--------
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
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Stop trying to cast your problems away, it just makes things worse!
Steve
|
|
|
|
|
Henitz wrote: line::GetData()
Shouldn't this be line.GetData()?
Nibu 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
|
|
|
|
|
Hi, I am looking for some information on how to enumerate through the list of available drives on the local machine to be displayed to the user. I remember coming across something similar on CP sometime back, but I am unable to locate it now. If someone could point me in the right direction on where to find some sample code or demo progs., it would be greatly apperciated.
I am going to be doing this in VC++ (2003), MFC, on Windows.
Thanks
|
|
|
|
|
Have you tried GetLogicalDrives() or GetLogicalDriveStrings() ?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Try something like this:
#include "stdafx.h"
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
DWORD mask = GetLogicalDrives();
for (char letter='A'; mask!=0; mask=mask>>1, letter+=1)
{
if (mask & 1)
{
cout << letter << ":" << endl;
}
}
return 0;
}
Steve
|
|
|
|
|
|
|
I have a Rich Edit Control Box in my dialog based visual c++ 6 application. The Text Displayed in the REditctl is in myfont.ttf. I want to :->
1)Format Different Lines of the text in different point size.
2)The text of the REditctl should be saved alongwith formatting.
(.doc,.txt file extensions)
3)The multiline text should be printed as formatted with myfont.ttf.
I tried that so much available Printing code for dialog based application.
Can some body help and give me a simple but correct insertable code for the
above narrated 3 problems.
|
|
|
|
|
Why don't you get every different format as a different text? and in each of them say which font are you using, that will make easier to save/print datas. One suggestion (I don't even know if it is a good way to do it, but just an idea).
You can declare a class with a "header" where the font is saved and use different instances of that class according to how the text is formated
I mean... suppose a text of 10 lines, and you want to change font in lines 4 to 6, then brake your 10 lines text into 3lines (1-3), 3lines(4-6) and 4lines(7-10) text parts. So when you save the datas into a file you save the header at first place, then the content of that text part and then the next one. By printing you can use it as well, by getting the first part, looking the header and configurating the DC with that info, then send the text included to the printer and continue with the next part.
Other member will most probably have better options, but this at least is a possibility.
Regards.
--------
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
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi all
I try to display current time in static control but its not given me the time its show me something
unicode values although i have changed the setting but still i did get result
Thanks
|
|
|
|
|
So why are you not showing us the code you are using, or do we just guess as to what you are doing wrong?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
<br />
void CDigitalclockDlg::OnPaint()<br />
{<br />
if (IsIconic())<br />
{<br />
CPaintDC dc(this);
. ........<br />
............<br />
............<br />
<br />
}<br />
else<br />
{<br />
<br />
<br />
<br />
<br />
CDialog::OnPaint();<br />
<br />
GetLocalTime(&time);<br />
<br />
<br />
char str[256];<br />
sprintf_s(str,"02d%:02d%:02d%",time.wHour,time.wMinute,time.wSecond);<br />
int len;<br />
int slength = (int)str.length() + 1;<br />
len = MultiByteToWideChar(CP_ACP, 0, str.c_str(), slength, 0, 0);<br />
wchar_t* buf = new wchar_t[len];<br />
MultiByteToWideChar(CP_ACP, 0, str.c_str(), slength, buf, len);<br />
SetDlgItemText(IDC_STATIC,(LPCTSTR)str); <br />
<br />
}<br />
}<br />
|
|
|
|
|
amistry_petlad wrote: sprintf_s(str,"02d%:02d%:02d%",time.wHour,time.wMinute,time.wSecond);
This should not even compile (bad format string).
amistry_petlad wrote: int slength = (int)str.length() + 1;
This should not even compile (integral types have no methods).
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
When I had simply used sprintf complier generated warning for sprintf AND give suggestion fo sprintf_s
i am using MSVS2008 ON VISTA
I have change the code following way it compile succesful but rund time break the application
<br />
GetLocalTime(&time);<br />
char str[256]; <br />
<br />
<br />
sprintf_s(str,"02d%:02d%:02d%",time.wHour,time.wMinute,time.wSecond);<br />
<br />
std::string str1(str);<br />
int len;<br />
int slength = (int)str1.length() + 1;<br />
len = MultiByteToWideChar(CP_ACP, 0, str1.c_str(), slength, 0, 0);<br />
wchar_t* buf = new wchar_t[len];<br />
MultiByteToWideChar(CP_ACP, 0, str1.c_str(), slength, buf, len);<br />
SetDlgItemText(IDC_STATIC1,buf);<br />
|
|
|
|
|
amistry_petlad wrote: ...but rund time break the application
And rightfully so since you did not change sprintf_s() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
now its working when i used sprintf but in the dialog it should be print hh:mm:yy
I have debug the application i got the perfect string in all varibals but when display in the static control its only shows the hour nothing more. So here in US 1:40:40 so must be displayed but it show me 1 only ?
|
|
|
|
|
amistry_petlad wrote: ...now its working when i used sprintf but...
It makes no difference whether you use sprintf() or sprintf_s() . If you have a malformed format string, you can't expect correct results.
What is the value of buf prior to calling SetDlgItemText() ?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
buf has garbage value now In my debugging i have seen that if 15:22:34
Then in buf shows L(1) only show what is the reason?
so then this character display in the static control
|
|
|
|
|
amistry_petlad wrote: sprintf_s(str,"02d%:02d%:02d%",time.wHour,time.wMinute,time.wSecond);
The format string is "02d%:02d%:02d%" or "%02d:%02d:%02d" ? Need to brushup those old C lessons?
BTW, Why can't you use CString?
SYSTEMTIME time;
GetLocalTime(&time);
CString csTime;
csTime.Format( _T("%02d:%02d:%02d"), time.wHour,time.wMinute,time.wSecond );
SetDlgItemText(IDC_STATIC1,csTime);
I apoligize that since i don't have VS2008 installed, the above code snippet is compiled in VS6.0. So try it.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
sorry ,in hurry i had type that things but in my code it is ok but sorry for that.
and you are genius becoz you find that mistake anyways thanks for this code
|
|
|
|
|
amistry_petlad wrote: and you are genius
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
You guys dont like _strdate and _strtime functions, do you??
Regards,
Sandip.
|
|
|
|