Click here to Skip to main content
15,889,527 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can carry value of string from one ctrl to another ctrl? Pin
Le@rner1-May-08 18:22
Le@rner1-May-08 18:22 
GeneralRe: How can carry value of string from one ctrl to another ctrl? Pin
David Crow2-May-08 3:39
David Crow2-May-08 3:39 
QuestionRe: How can carry value of string from one ctrl to another ctrl? Pin
David Crow2-May-08 3:33
David Crow2-May-08 3:33 
QuestionHow to Embed MFC ActivexControl in C# Windows Application? Pin
spalanivel28-Apr-08 19:24
spalanivel28-Apr-08 19:24 
Questionhow to get white color on grey background color Pin
ias128-Apr-08 19:15
ias128-Apr-08 19:15 
AnswerRe: how to get white color on grey background color Pin
Rajkumar R28-Apr-08 19:37
Rajkumar R28-Apr-08 19:37 
AnswerRe: how to get white color on grey background color Pin
Hamid_RT29-Apr-08 21:41
Hamid_RT29-Apr-08 21:41 
GeneralProblem with Plink!!! Pin
Member 474468328-Apr-08 18:51
Member 474468328-Apr-08 18:51 
Hi All,
I am developing an application in which I need to connect to a server and send some commands and retrieve the response. For this, I am using a third party console client application called Plink. Plink requires a console window to start and it cannot be opened by double clicking it. The entire process of login and sending commands and receiving response is automated in my application. Also plink has to be started with a initial command "plink <protocol> <server ip="">".

Code flow:
------------
m_Stdout = GetStdHandle(STD_OUTPUT_HANDLE);
m_StdIn = GetStdHandle(STD_INPUT_HANDLE);

SecureZeroMemory(&m_ProcInfo,sizeof(PROCESS_INFORMATION));
SecureZeroMemory(&m_StartInfo,sizeof(STARTUPINFO));

// Set up members of the STARTUPINFO structure.
m_StartInfo.cb = sizeof(STARTUPINFO);
m_StartInfo.hStdError = m_Stdout;
m_StartInfo.hStdOutput = m_Stdout;
m_StartInfo.hStdInput = m_StdIn;
m_StartInfo.dwFlags = STARTF_USESTDHANDLES;

// Create the child process.
wcscpy(m_Cmdline,_T("plink -telnet <server ip="">")); // server IP is not typed here for security purpose
m_RetVal = CreateProcess(0,
m_Cmdline, // command line
NULL, // process security attributes
NULL, // primary thread security attributes
TRUE, // handles are inherited
0, // creation flags
NULL, // use parent's environment
NULL, // use parent's current directory
&m_StartInfo, // STARTUPINFO pointer
&m_ProcInfo); // receives PROCESS_INFORMATION

memset(m_UserName,0,BUFSIZE);
wcscpy(m_UserName,_T("pdt2"));
wcscat(m_UserName,_T("\r\n"));

m_BytesToWrite = wcslen(m_UserName);

m_RetVal = WriteConsole(m_Stdout,m_UserName,m_BytesToWrite,&dwWritten,NULL);

if(m_RetVal)
{
fprintf(m_FilePtr,"Write to console succeeded\n");
ReadFromConsole();
}
else
{
m_ErrorCode = WSAGetLastError();
ErrorExit("Write To Console failed",m_ErrorCode);
}
-------------
This is where it fails. After writing the username string to the console, I should get back the password prompt in the console window which doesnt happen.The WriteConsole API succeeds and returns 1 but the application doesnt get back the password prompt as should be the case.In WriteConsole API I pass the standard output handle m_Stdout.

Can anyone say whats going wrong?

Thanks in advance for any kind of help.

Jyoti
GeneralRe: Problem with Plink!!! Pin
Saurabh.Garg28-Apr-08 19:25
Saurabh.Garg28-Apr-08 19:25 
GeneralRe: Problem with Plink!!! Pin
Member 474468328-Apr-08 19:31
Member 474468328-Apr-08 19:31 
QuestionRe: Problem with Plink!!! Pin
David Crow29-Apr-08 3:16
David Crow29-Apr-08 3:16 
QuestionRe: How execute Oracle stored procedure in Vc++ Pin
yklim28-Apr-08 17:49
yklim28-Apr-08 17:49 
GeneralRe: How execute Oracle stored procedure in Vc++ Pin
Sarath C28-Apr-08 22:26
Sarath C28-Apr-08 22:26 
GeneralRe: How execute Oracle stored procedure in Vc++ Pin
ShilpiP29-Apr-08 2:44
ShilpiP29-Apr-08 2:44 
GeneralRe: How execute Oracle stored procedure in Vc++ Pin
Hamid_RT29-Apr-08 4:13
Hamid_RT29-Apr-08 4:13 
GeneralSystem Tray Application Pin
john563228-Apr-08 17:44
john563228-Apr-08 17:44 
GeneralRe: System Tray Application Pin
Saurabh.Garg28-Apr-08 18:15
Saurabh.Garg28-Apr-08 18:15 
GeneralRe: System Tray Application Pin
john563228-Apr-08 19:13
john563228-Apr-08 19:13 
GeneralRe: System Tray Application Pin
Stephen Hewitt28-Apr-08 19:27
Stephen Hewitt28-Apr-08 19:27 
GeneralRe: System Tray Application Pin
Saurabh.Garg28-Apr-08 19:27
Saurabh.Garg28-Apr-08 19:27 
GeneralRe: System Tray Application Pin
john563228-Apr-08 19:40
john563228-Apr-08 19:40 
GeneralRe: System Tray Application Pin
Stephen Hewitt28-Apr-08 20:23
Stephen Hewitt28-Apr-08 20:23 
QuestionRe: System Tray Application Pin
David Crow29-Apr-08 3:27
David Crow29-Apr-08 3:27 
GeneralRe: System Tray Application Pin
Hamid_RT29-Apr-08 4:12
Hamid_RT29-Apr-08 4:12 
QuestionHow to emit alarm sound on computer without soundcard Pin
GameProfessor28-Apr-08 16:19
GameProfessor28-Apr-08 16:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.