|
If you want do this manipulation then better derive one class(your own edit class derived from CEdit).
and handle some events & functions like OnKeyDown
void CMyEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (nChar == VK_DELETE) {
if (!(GetStyle() & ES_READONLY)) {
processDelete();
}
} else
CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
}
handle in that functions get sel, set sel,
you have get at, setat functions for CString.
etc.
bla bla bla.
.....
you can do like this.
Nice talking to you.
If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
I think,....Then you can go for service programming. some thing like that.Or you can create a plugin for a editor or you have to create a windows service, if that service is running then you can restrict like this. Search for this kind of programs(this comes under com etc...). Sorry. I dont know the writeing services programming.
Nice talking to you.
If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Kalyani Gupta wrote: i need to calculate the width of characters before using SetCaretPos to move the caret, i dont know how to do this.
Hi Kalyani,
Is GetCharWidth is of any help!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I want a code that is uused to split a window that already splitted by CreateStatic(...) fn and here i want tosplit when i done an event like RightButtonDown..etc.
so send me a code cleary it is urgent.....
|
|
|
|
|
See you can't ask for a whole code ....
Start doing something and wherever you stuck to the problem then you can ask for the problems....
Cheers
"Peace of mind through Technology"
|
|
|
|
|
|
Hi all,
I have an application that executes several command line tools in the background (i.e no command line window is openend).
I still like to get the output from the tools and I've got no problem capturing output from printf and all fprintf's to stdout, stderr.
The problem is that I can't find a way to capture outputs made with cprintf.
I do not have access to the source of all tools (some are very old) so there's no way that I can change the tools to use printf.
I'm quite sure that someone must have done this, doing custom command line windows etc.
Are there any source available for a one of thoose?
Any hints are welcome..
eq
|
|
|
|
|
if you want a command line solution, here is how you can do it.
myprogram 2> error.log
the 2> directs the error stream to the file error.log
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-- modified at 5:16 Tuesday 30th May, 2006
|
|
|
|
|
toxcct wrote: myprogram >> error.log
As far as i remember, it's like this:
> creates a new file/stream
>> appends to an existing file or creates a new file/stream.
> and >> redirects stdout
2> and 2>> redirects stderr
(And < redirects a stream to stdin).
|
|
|
|
|
|
Thanks you guys, but it still doesn't solve any of my problems.
I'm NOT trying to redirect output to a file, I'd like to capture the output from my Win32 program that executes the command line tools (without showing any command line window).
The redirections doesn't redirect the cprintf outputs anyway.
Consider the following test application:
<br />
#include <conio.h><br />
#include <stdio.h><br />
<br />
void<br />
main(void)<br />
{<br />
printf("This line is printed using printf(...)\n");<br />
cprintf("This line is printed using cprintf(...)\n");<br />
fprintf(stdout, "This line is printed using fprintf(stdout, ...)\n");<br />
fprintf(stderr, "This line is printed using fprintf(stderr, ...)\n");<br />
}<br />
Running this with some redirections give:
<br />
T:\>test.exe<br />
This line is printed using printf(...)<br />
This line is printed using cprintf(...)<br />
This line is printed using fprintf(stdout, ...)<br />
This line is printed using fprintf(stderr, ...)<br />
<br />
T:\>test.exe > temp.log<br />
This line is printed using cprintf(...)<br />
This line is printed using fprintf(stderr, ...)<br />
<br />
T:\>test.exe 2> temp.log<br />
This line is printed using printf(...)<br />
This line is printed using cprintf(...)<br />
This line is printed using fprintf(stdout, ...)<br />
As you see it's impossible to capture ALL output.
(Btw is there a way to capture both stdout and stderr to the same file and preserve the order?)
From my Win32 program I can capture all cases except the cprintf one.
So I'll ask again if anyone have some hints on how to do it since I'm quite sure it's doable, cmd replacements like 4NT seems to handle that.
eq
-- modified at 14:17 Tuesday 30th May, 2006
|
|
|
|
|
Hi Friends,
I have one window on which I want to display SSN. SSN is one of the option in list and it value display infront of it in edit box. Can you pls help me to display these scenario. I am new to windows programming.
Thanks
|
|
|
|
|
Iterate through the items of the list box using the GetCount().
Create an array of the edit box's in front of the boxes.
Dpeneding on the count of the list go on setting the corresponding values of the list box into the edit boxes.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thank you for help. I am looking for exactly same answer. Do i really need to travese all the list? Since we know when list show SSN,set the value in edit box.Is it possible to reach directly to index of SSN in the list and same for edit box?
Thanks
|
|
|
|
|
I didn't get what you need to do exactly?
May be you want to have a look at the LBN_SELCHANGE event of the list box.
Also list box is shown at the time of initdialog and so you can put some of your code over there.
Does this solve your problem?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
what do you need?
show value from ListBox or show value in editbox
for show text in editbox use m_Edit1.SetWindowText("text");
for read from listbox use m_List1.GetText(m_List1.GetCurSel(),str)
whitesky
|
|
|
|
|
Pls be more specific. the last sentences are not clear.
u can SetWindowText to set a window text.
either u may have to create control varibles (string variable) for the controls u put in the the window or use GetDlgItem to get window handle.
check MSDN for more info
SaRath
"D on't blindly follow rules you read somewhere without verifying that it makes sense for your situation!"
|
|
|
|
|
U can make use of the function GetCurSel() to get the current selected item index. Now you can use GetText(index,string) to get the selected item text into the string. Set the retrieved string into the Edit box using SeWindowText().
|
|
|
|
|
my code
const int sz=100;
char buf[sz];
CString LString;
m_AListCtrl.ResetContent();
CString Filename = "C:\\Documents and Settings\\Owner\\list.txt";
ifstream ListFile( Filename );
while( ListFile.get ( buf,sz ) )
{
ListFile.get();
LString = (LPCSTR)buf;
m_AListCtrl.AddString(LString);
}
the problem is it doesnt read my last Line in the Text
(my Text's Form)
xxxx
yyyyy
zz
iiii
...
|
|
|
|
|
I took your snippet as is and ran it against a notepad file with 4 lines of text.
It populated the ListBox with all 4 lines even if I removed the last newline. Not sure what might be different on yours. Was your list.txt file created manually with notepad?
|
|
|
|
|
no a previous function create it/Edit it
if (file.Open(sFilePath,CFile::modeReadWrite|CFile::modeNoTruncate|CFile::modeCreate))
{
CString str = "\n"+Filetitle+".mp3";
file.SeekToEnd();
file.WriteString(str);
file.Close();
}
|
|
|
|
|
call these two functions like so (adjust the filepath)... (This appears to work)
PerformTask();
PerformTask2();
void CTestfileDlg::PerformTask()
{
CString sFilePath="c:\\temp\\list.txt";
CStdioFile file;
CString sOutput="0000000000111111111122222222223333333333444444444455";
int nCount=sOutput.GetLength();
try {
if (file.Open(sFilePath,CFile::modeReadWrite|CFile::modeCreate)) {
for (int i=0;i<nCount;i+=10) {
file.WriteString(sOutput.Mid(i,10)+"\r\n"); // Append text
}
file.Close();
}
}
catch (CException * e) {
e->ReportError(); // Popup description of exception
e->Delete(); // Clean up.
}
catch (...) { // Catch any other exceptions
AfxMessageBox("Failed to open file!");
}
}
void CTestfileDlg::PerformTask2()
{
const int sz=100;
char buf[sz];
CString LString;
m_AListCtrl.ResetContent();
CString Filename = "C:\\temp\\list.txt";
ifstream ListFile( Filename );
while( ListFile.get ( buf,sz ) )
{
ListFile.get();
LString = (LPCSTR)buf;
m_AListCtrl.AddString(LString);
}
}
-- modified at 1:41 Tuesday 30th May, 2006
|
|
|
|
|
|
i got 1 function OnButton();
(1) Upload file
(2) Download list
(3) write file list (update with new filename)
(4) Upload updated list
and while i can see (with my eyes) that list got one more line my reader cant see that
|
|
|
|
|
We are using the XListCtrl from code project and would like to have multiple lines in a column for tool tips. I have tried \r\n and I have looked at some other information in code project and else where. When a particular row/column has the mouse over it to have a tool tip appear but possible have multiple lines. the lines could be 80+ characters if we could. Could someone point me to a simple and quick solution?
thank you
|
|
|
|