|
Say if you have an edit box in the first dialog then in the second dialog you can place a pointer to the parent class like
CMain* pParent=(CMain*)GetParent();
pParent->m_edit.GetWindowText() etc..//... to get the value from the other edit box
// Put it into the edit box in the second dialog using
m_editOnSecondDlg.SetWindowText()...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Whats application type?
if its dialog you can use
<br />
CMain* m_Main=(CMain*)GetParent();<br />
CString str;<br />
m_Main->m_Edit1.GetWindowText(str);<br />
in another dialog use
<br />
m_Edit2.SetWindowText(str);
|
|
|
|
|
What is the relationship between the two dialogs (i.e., parent/child, siblings)?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello everyone,
I always see the two words -- asynchronized I/O and I/O multiplexing. Are they the same thing -- like select/poll?
I noticed that in some situations, people say they are different and asynchronized I/O is better than I/O multiplexing.
Could anyone help to clarify the differences between the two words?
thanks in advance,
George
|
|
|
|
|
Multiplexed I/O queries multiple I/O channels, and returns if an communication occurs on one channel. The typical use is a Server process that has to respond to multiple connections. The call is blocking, so you can't do anything else (in this thread).
Asynchronous I/O is more versatile, but can be used in the same scenario.
You can request the I/O operation to start, then do your own things. At any time, you can query if the I/O operation has completed It's also possible to set an event or call a callback function when the operation completes.
|
|
|
|
|
Thank you very much peterchen!
Your reply makes senses.
peterchen wrote: Multiplexed I/O queries multiple I/O channels, and returns if an communication occurs on one channel. The typical use is a Server process that has to respond to multiple connections. The call is blocking, so you can't do anything else (in this thread).
I can not imagine why in the situation (server process handles multiple client connections) the call is blocking (other than asynchronous) -- I think the server can process other things even if no new data is received from client connection, which is an asynchronized mechanism other than a blocked mechanism. Could you show me more details please?
regards,
George
-- modified at 8:06 Tuesday 25th July, 2006
|
|
|
|
|
Hello comunity,
how to set an focus to button and select him when user enter a CEdit field, so when the user press enter on keyboard the additional funktion begins, example show an MessageBox with this text from
this CEdit field, and not like now to close my dialog???
Thanx in advance!
break;
|
|
|
|
|
setting the focus is one thing, and select him so that when user presses enter key in an edit box is an onther one.
to set focus :
(GetDlgItem(IDC_MY_BUTTON))->SetFocus();
to set as the default button :
this->SetDefID(IDC_MY_BUTTON);
where IDC_MY_BUTTON is the button you want to act on, and this, is the dialog box which the button is layed on...
|
|
|
|
|
Hi,
thanx a lot you solve my problem!
That what im looking for is
this->SetDefID(IDC_MY_BUTTON);
regards
break;
|
|
|
|
|
break; wrote
CEdit field, so when the user press enter on
Didn't get your question clearly. But I feel that you want to capture the enter key on the dialog so that when enter key is pressed you don't close the dialog.
Right?
If yes you can use PreTranslateMessage() and detect when Enter is pressed
Something like
if(pMsg->message == WM_KEYDOWN && (VK_ESCAPE == pMsg->wParam || VK_RETURN == pMsg->wParam))
pMsg->wParam=VK_SEPARATOR;
would do
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hello,
thanx for answer, i solve the problem like this:
SetDefID(IDC_ADD);
regards
break;
|
|
|
|
|
Hi all,
How do I detect that the mouse was double clicked on a text in any window. eg.(edit box, static text box,hyperlink,MS-Outlook etc).I need the text to be read and stored in the database(only single word on which the mouse is clicked).
Some link to articles that could help me build on this.
My initial ideas are that I can develop a system wide hook for mouse and check for its double click event.When ever it does a double click I would read the text(and I don't know this right now how this would be achieved-Reading the text).
Thanks in advancee
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
See if this helps.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I'm trying to make it clear this time. I have a function called Read that reads from the COM. Then i'm using it in the following piece of code to print the result to the screen and to write it in one file. The output to the screen it's ok (FFFF00000000028C) but the one to the file is : "ൃFFF " or smth like that. Note: all the output from my device that is connected to COM is preceded by a Line feed <lf-0x0a> and terminated by a Carriage return <cr-0x0d>
I use the following code:
DWORD dwBytesRead = 0;<br />
char szBuffer[101];<br />
FILE *out;<br />
serial.Read(szBuffer,sizeof(szBuffer)-1,&dwBytesRead);<br />
if (dwBytesRead > 0)<br />
{<br />
szBuffer[dwBytesRead] = '\0';<br />
out = fopen( "output.txt", "w" );<br />
fprintf( out, "%s", szBuffer ); <br />
printf("%s", szBuffer);<br />
fclose(out);<br />
<br />
if (strchr(szBuffer,EOF_Char))<br />
fContinue = false;<br />
<br />
}
|
|
|
|
|
If that code is inside a loop (I suppose that, because of the fContinue), then you will close and open the file each time (and of course erasing all its content). It is better top open the file it before and close it after the loop.
|
|
|
|
|
I've also tried that version, and I agree with you, but it still doesn't work.
|
|
|
|
|
I can't see a problem with your code.
As Cedric said, your code will overwrite anything that is already in the file. You can work round this by opening the file then moving to the end before writing, something like this:
DWORD dwBytesRead = 0, dwBytesWritten;
char szBuffer[101];
static HANDLE hFileHandle = INVALID_HANDLE_VALUE;
serial.Read(szBuffer,sizeof(szBuffer)-1,&dwBytesRead);
if (dwBytesRead > 0)
{
szBuffer[dwBytesRead] = '\0';
hFileHandle = CreateFile(szLogFileName, GENERIC_WRITE | GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH, NULL);
SetFilePointer( hFileHandle, 0, NULL, FILE_END);
WriteFile(hFileHandle, (LPCVOID) szBuffer, dwBytesRead+1, &dwBytesWritten, NULL);
printf("%s", szBuffer);
fclose(out);
if (strchr(szBuffer,EOF_Char))
fContinue = false;
}
|
|
|
|
|
yes, it finally works. Thank you. But what if i want all of the data that i receive do be written on the same line? How can i strip the string that i receive of it's newline and carriage return?
|
|
|
|
|
If you know that the every line you receive ends in CR/LF (or LF/CR), you could just replace the line:
szBuffer[dwBytesRead] = '\0'; with the following:
szBuffer[dwBytesRead-2] = '\0';
It is probably better to check, so I would do:
if (dwBytesRead > 0)
{
if (dwBytesRead > 1 &&
(szBuffer[dwBytesRead-2] == 0x0d || szBuffer[dwBytesRead-2] == 0x0a) &&
&& (szBuffer[dwBytesRead-1] == 0x0a || szBuffer[dwBytesRead-1] == 0x0d))
{
szBuffer[dwBytesRead-2] = '\0';
}
else
szBuffer[dwBytesRead] = '\0';
|
|
|
|
|
Hi,
Can any one show me how to hide a process in Task Manager
Thank!!!
|
|
|
|
|
|
|
InterProcess Communication (IPC) is it reliable enough for applications which require high security level.
If I allow piping between tow programs, can i ensure that no other program will be able to use this pip, or alternatively, create a new pipe in order to retrieve secured information.
Where can I read more regarding security issues related to IPC ?
Best regards.
|
|
|
|
|
TamirC wrote: Where can I read more regarding security issues related to IPC ?
anybody can access your pipe,if have the name of the pipe.. it would be better you encrypt the data from sending end and decrypt the data at receving end!
"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
|
|
|
|