|
I don't understand what you mean... If I pasted the lines you posted in a txt file and I open it with notepad, all columns are well aligned.
A file is just 'data' (binary or text) and it cannot contain font information (or the only way to do that is to have your own file format and your own program that will read the file).
|
|
|
|
|
please see my code below:
BYTE regdata[5][0x10][0x10];
BOOL CxxDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
BYTE h,i,j;
for (h=0x00;h<5;h++) {
for (i=0x00;i<0x10;i++) {
for (j=0x00;j<0x10;j++) {
regdata[h][i][j]=(BYTE)(i*0x10)+j;
}
}
}
return TRUE; // return TRUE unless you set the focus to a control
}
void CxxDlg::OnButtonSave()
{
// TODO: Add your control notification handler code here
CString buf;
CString buf1=" ";
BYTE h,i,j;
for (h=0x00;h<5;h++) {
buf1.Format("\r\n\r\nBank%x: \r\n-----",h);
buf +=buf1;
for (j=0x00;j<0x10;j++) {
buf1.Format("-%02X-",j);
buf +=buf1;
}
for (i=0x00;i<0x10;i++) {
buf1.Format("\r\n-%02X- ",i);
buf +=buf1;
for (j=0x00;j<0x10;j++) {
buf1.Format("%02X ",regdata[h][i][j]);
buf +=buf1;
}
}
}
CFileDialog fdlg(FALSE,"PJ",NULL,OFN_OVERWRITEPROMPT,
"text File(*.txt)|*.txt|map file(*.map)|*.map|All files(*.*)|*.*||",this);
fdlg.m_ofn.lpstrTitle="Data saving";
if (fdlg.DoModal()==IDOK)
{
m_strCurFile=fdlg.GetPathName();
CStdioFile csfile(m_strCurFile,CFile::modeCreate|CFile::modeReadWrite|CFile::typeText);
csfile.WriteString(buf);
csfile.Close();
}
}
I saved the values in *.txt or *.map file, but when it was opened by notepad with the defaut font, the columns becomed unaligned. So I want to know that is there any way to set the font view of the files? or they are only related with operating system?
As the code above, I saved the value of array regdata[5][0x10][0x10] as hex-string in the *.txt file. how can I read the value back to regdata[5][0x10][0x10] one-by-one?
|
|
|
|
|
Hi
Use CFile with binary mode
by
KK
|
|
|
|
|
If you want to display the lines with straight columns, then you have to use a monospaced font (where all characters has got the same width), such as "Courier New" or "System"
In a text file, you can't choose what font to use when the file is viewed.
If you need to do that, try a .rtf, .doc or a .pdf file.
|
|
|
|
|
|
I didn't really understood what you explained but it looks like a painting problem. Are you sure all the code for the painting is made in OnPaint ? (and nowhere else)
|
|
|
|
|
Cedric,
In another words,
map mode = MM_TEXT
View origin=0,0(top left)
first line drawn (10,10-------- 20,10)
I scroll view ..with scroll bars and bring the view to an doc area where first line is not visible.
second vertical line drawn .. say (15,200----15,210)
but for second line its taking coordinates as (15, 20----15,30)
its not adding origin + scroll range to the points
what can be the reason.
Leya
|
|
|
|
|
You didn't answer my question: is everything drawn in OnPaint ?
Post the code of your OnPaint handler (use the pre tags to format it properly).
|
|
|
|
|
rectLs = ls->GetBoundingRect();
pDC->DPtoLP(&rectLs);
rectLs.InflateRect(1, 1);
This is useless because it doesn't have any impact on the drawing (drawing is made in DrawLineString).
But, your didn't show your drawing code. Post the DrawLineString function (and everything that is related to the drawing of the line.
I suppose CLineString is one of your class ?
|
|
|
|
|
By rereading your previous post I think the problem is in fact not a drawing problem but how you save the point ! The problem is that in the point you get in the OnLButtonDown doesn't take in account the scroll positions (that's logical) but only the client coordinates !
Thus, you need to add the coordinates of your scroll bar to the point. I suppose your view class derives from CScrollView ?
Then, you can retrieve the position of the scrollbar by calling GetScrollPosition.
Then, you need to add the X an Y from the scroll position to the point received in OnLButtonDown.
|
|
|
|
|
Thanks Cedric,
Atlast you understood.
I wonder how I can improve my english communication?
thanks,
Leya
|
|
|
|
|
Maybe by practising more . It is like programming, it takes time to be fluent with.
Anyway, does that solve your problem ?
|
|
|
|
|
How do I change the menubar's background to show a tiled bitmap or to show in come color else?
I'd like to display a bitmap as the menubar( not menu item) background..
Can any 1 show me the way ?
Deeply appricate your help...
|
|
|
|
|
I must be missing something in the cleanup, but here is a cut version of the code that causes the leak.
<br />
CExcelRange usedCells = oSheet.get_UsedRange();<br />
<br />
<br />
COleSafeArray cellArray(usedCells.get_Value());<br />
<br />
<br />
usedCells.Clear();<br />
usedCells.ReleaseDispatch();<br />
VariantClear(cellArray);<br />
cellArray.Clear();<br />
cellArray.Detach();<br />
I have deliberately cut down my code for testing so it essentially does nothing but load the file. There is no code between "COleSafeArray cellArray(usedCells.get_Value());" and "usedCells.Clear();" to help narrow down the leak.
If I comment out the line "COleSafeArray cellArray(usedCells.get_Value());" (and oviously the associated cleanup so it will compile) I have no leak, but if it calls this line I get an immediate loss of ~4-5 times the file size which equates to about 30 meg per file. If I run this multiple times it continues to drop, so I don't think it is a windows caching problem. Anybody know what I'm missing?
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
OK I've worked it out. It seems you cannot set the data via the constructor or it will cause a leak, don't ask me why, it just does. Otherwise it works fine. The fix is to replace the faulty line with these two
COleSafeArray cellArray;
cellArray.Attach(usedCells.get_Value());
I have also noticed with this fussing today that if a value is assigned to any form of variant based objects in C++ it will leak unless you call Clear() after every assignment. One of the many reasons why I despise variants.
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
hi
1)I want to Verify Windows Firewall Settings in VC or VB(since API functions can be used in both).
2)Verify DCOM Privileges to run DCOM based applications
can anyone point to some links or atleast give an idea abt the kind of functions to look for?
thanx in advance
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
-- modified at 4:23 Thursday 4th May, 2006
|
|
|
|
|
I delete a class in the vc++ 6.0 by removing the .h and .cpp file from project and then deleting them from the disk folder .
But when I want to create a class with the same name as I deleted just now, an error message box pops up say something like "the class ... is in use, please specify another name...".
even restarting the visual c++ program does not make any help.
why dose this happen, and how to fix it?
Thank you very much!!!
-------------------
I am learning C++ and English
-- modified at 4:10 Thursday 4th May, 2006
|
|
|
|
|
Try deleting the .clw file and when you open classwizard again specify all files, should fix it.
Master.. Master.. where are the dreams that i've been after...
|
|
|
|
|
Hi,
I have newly created MFC 32 Application, can any one please tell how to add Help [F1] documents and images to project.
Regards,
Parichay.
|
|
|
|
|
Hi
Please use Accelerator in Resource
by
KK
|
|
|
|
|
Hi,
Thanks for the msg,
Can u please expand and tell what i have to do..
i am new to VC++.
|
|
|
|
|
hi,
Thank for the msg,
can u please expand and tell me what i have to do. i am new to VC++.
|
|
|
|
|
|
Hi,
Is there any way to get paths to special folders like "Program Files"
or "Common Files" but on remote machine ?
I need to get path to Program Files folder - I can use RegConnectRegistry and read out from there but it doesn't work i.e. on WinXP Home Ed.
-----------
Mila
|
|
|
|
|
Hi All,
Can anyone know how to find the audio level from the microphone? Basically I want to splitup the audio level from no audio(if the person is silent) to very high level... How can i get the frequency??
Thanks,
Poornima
|
|
|
|