|
Thanks I thought that is what I had todo, but I figured their would have been a helper function or a member of CString todo that since it sounds like something a lot of people would do. Oh well time to write a small search and replace function
|
|
|
|
|
There normaly is but you did not say what class you is providing the read method.
CArchive provides ReadString() (reads one line at a time), although I think it removeS the CRLF and replaces it with a '\0'.
If using stdio (C) then you would use fgets() replaces the CRLF with '\n''\0'.
So you may, or may not, already have a method that will help you.
INTP
|
|
|
|
|
scontapay wrote:
I figured their would have been a helper function or a member of CString
strTextWithCarriageReturns::Remove(_T('\r'));
Shog9
Give me a Leonard Cohen afterworld
So I can sigh enternally...
|
|
|
|
|
Thanks I see where my problem is. It is the fact that I kept misreading everyones advice I thought everyone was trying to tell me to insert it into the buffer I was creating, and didn't think anyone knew I was reading it in.
My fault... See what 6-8 months away does to a C++ programmer when programminging VB!
|
|
|
|
|
Make sure the control has the ES_MULTILINE style.
|
|
|
|
|
Its set to true. Btw I am using Visual Studio.Net the first release, and I can't believe that it does not have a single service pack or update for it.
|
|
|
|
|
Then the following code snippet should work:
m_edit.SetWindowText("This is on line 1\r\nThis is on line 2\r\nThis is on line 3");
|
|
|
|
|
DavidCrow yes that would work thank you. But the enformation I am getting is placed inside a buffer which is a CString, and it is that CString I am putting into the edit box, for example:
SetDlgItemText(IDC_EDIT, strBuffer);
Where strBuffer is a CString, and the information from that is read from a file. Once placed inside the CEdit box it is displaying those weird 'squares' instead of doing a CRLF.
|
|
|
|
|
It matters not that SetWindowText()'s parameter is a CString, or a string literal. The characters \r\n must be used. If you are only receiving one of them, a quick search and replace is all that's needed. For example:
CString str = "This is on line 1\rThis is on line 2\rThis is on line 3";<br />
str.Replace("\r", "\r\n");<br />
m_edit.SetWindowText(str);
|
|
|
|
|
I wanted to thank you for your help. Here is a copy of a post made above so you know what happened:
Thanks I see where my problem is. It is the fact that I kept misreading everyones advice I thought everyone was trying to tell me to insert it into the buffer I was creating, and didn't think anyone knew I was reading it in.
My fault... See what 6-8 months away does to a C++ programmer when programminging VB!
|
|
|
|
|
Hi,
Whe I used my CListBox on a dialog and wanted to scroll it programatically, I used:
<br />
list_box.SetAnchorIndex (pivot+18);
list_box.SetSel (pivot-1);<br />
But when I used CListBox as a view inside a CFrameWnd it does not work anymore, it always shows the selected line at the top.
???????????/
Shay
|
|
|
|
|
hi all
does ne1 know how to detect memory leaks, i think my application
has them
thanks
si
|
|
|
|
|
There are articles at codeproject on how to detect memory leaks.
You could also download a trail copy of "BoundsChecker" or some other testing software.
INTP
|
|
|
|
|
Try Numega BoundsChecker.
Or using MFC CMemoryState to see the memory usage at each stage but I think this way is kinda troublesome. I would prefer Boundschecker with nice UI.
|
|
|
|
|
Hi all,
I didn't find anything about changing the priority of windows processes.
eg : I would like to have an hidden process which would set a low priority to processes like eMule, Crazy Browser, Internet Explorer, Visual Age, ...
I have to do it whith the task manager, I have many processes to modify, it's not that exciting !
I don't know if it possible, please if you have any clue, help.
Thanks all.
Nd
.
|
|
|
|
|
Find the handle of the process and use the Windows API function(s) SetPriorityClass and SetThreadPriority .
BOOL SetPriorityClass(
HANDLE hProcess,
DWORD dwPriorityClass
);
BOOL SetThreadPriority(
HANDLE hThread,
int nPriority
); For the parameters, see MSDN.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
I'll try it, but it doesn't seem as hard as I thought.
I hope administrator rights are not needed.
Thanks for your help.
Nd
.
|
|
|
|
|
nitropit wrote:
I hope administrator rights are not needed.
As documented, you need PROCESS_SET_INFORMATION access right. Thankfully no one but Administrators have this right by default - though one could consider it a flaw in the Win32 API to not let a process lower its own priority without it.
|
|
|
|
|
Is there any way that the main window of SDI is always maximised?
Currently, I have to click the maximize button to make it full size.
|
|
|
|
|
When you create it,
Use WS_MAXIMIZE on the flags
|
|
|
|
|
can u provide me with exact syntax?
I tried to create it but it didn't work
|
|
|
|
|
Go to the OnCreate function of your main window, and at the end of the function add this line:
code>ShowWindow (SW_MAXIMIZE);<
|
|
|
|
|
Sans the HTML tags, of course!
|
|
|
|
|
doooooooooouuuuuuuhhhhhhhh !!!!!
But you got the main point
|
|
|
|
|
What's the use of typedefing basic types ?
I'm reviewing some old C code, and there's a lot of typedef like
typedef float *FloatPtr;<br />
typedef float **FloatPtr2D;<br />
typedef float ***FloatPtr3D;<br />
typedef float ****FloatPtr4D;<br />
<br />
typedef unsigned int UInt;<br />
typedef unsigned int *UIntPtr;<br />
<br />
typedef int *IntPtr;<br />
typedef int **IntPtr2D;<br />
typedef int ***IntPtr3D;
and some other variants of the same things; and it's all mixed up in the code, sometimes, declaration use a typedef, but the definition use the full type.
If I need to typedef some basic types to be used all around the application to follow a code guideline, is there a standard way of doing this, in C++ preferable ?
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." (from /.)
|
|
|
|