|
Have you looked at the console API?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I tried two options today and I think I found the solution.
First of all what I wanted was:
Depending on the parameters from the command line, I wanted to launch a console window or a GUI. So I wanted console/GUI support from the one and the same MFC application.
So what I did was to use CCommandLineInfo derived class to determine the parameters. So if I found /mode: command in then:
1. I used (as suggested by one of you) used the console functions to determine the standard input handle and do a ReadConsole from it to get the character typed.
i.e.,
AllocConsole();//to show the console
HANDLE hIn = GetStdHandle();
ReadFile(hIn,...)
But I had one problem with this. If this application is launched from cmd.exe, then two console windows were visible: One from where I call Start test.exe, one created in the test.exe using AllocConsole.
2. I found another solution. I used the #pragma directive:
#pragma comment(linker, "/subsystem:console")
This brought a console window as expected. When launched from cmd.exe this did not launch a new console.
I think the second solution more cleaner and simple.
Thanks for the help from all of you. If you have any suggestions regardig the above, please let me know.
Bye and c ya!
|
|
|
|
|
I tried two options today and I think I found the solution.
First of all what I wanted was:
Depending on the parameters from the command line, I wanted to launch a console window or a GUI. So I wanted console/GUI support from the one and the same MFC application.
So what I did was to use CCommandLineInfo derived class to determine the parameters. So if I found /mode: command in then:
1. I used (as suggested by you) used the console functions to determine the standard input handle and do a ReadConsole from it to get the character typed.
i.e.,
AllocConsole();//to show the console
HANDLE hIn = GetStdHandle();
ReadFile(hIn,...)
But I had one problem with this. If this application is launched from cmd.exe, then two console windows were visible: One from where I call Start test.exe, one created in the test.exe using AllocConsole.
2. I found another solution. I used the #pragma directive:
#pragma comment(linker, "/subsystem:console")
This brought a console window as expected. When launched from cmd.exe this did not launch a new console.
I think the second solution more cleaner and simple.
Thanks for the help from all of you. If you have any suggestions regardig the above, please let me know.
Bye and c ya!
|
|
|
|
|
Just like that:
From MSDN:
CWinApp::m_lpCmdLine See Also
CWinApp Overview | Class Members | Hierarchy ChartCorresponds to the lpCmdLine parameter passed by Windows to WinMain.
LPTSTR m_lpCmdLine;
Remarks
Points to a null-terminated string that specifies the command line for the application. Use m_lpCmdLine to access any command-line arguments the user entered when the application was started. m_lpCmdLine is a public variable of type LPTSTR.
Example
BOOL CMyApp::InitInstance()
{
// ...
if (m_lpCmdLine[0] == _T('\0'))
{
// Create a new (empty) document.
OnFileNew();
}
else
{
// Open a file passed as the first command line parameter.
OpenDocumentFile(m_lpCmdLine);
}
// ...
}
|
|
|
|
|
Does the application used for launching the two different applications dependent of those application?
What I mean is. . .is the command line application included or attached to the two different applictions?
If not you can query the system by the title of the two different application, and execute them depending on your logic.
Aaron.
|
|
|
|
|
Hi,
I have had to use the OnNcPaint() handler to draw a border around my CWnd derived class. However at the base of the handler it says:
// Do not call CWnd::OnNcPaint() for painting messages
But without this it doesn't draw the windows scrollbar.
For now I have added CWnd::OnNcPaint(); at the top of the handler and it is working fine; the only thing is I don't know if this is a good idea. Could someone please advise me of why it shouldn't be called?
Many thanks,
Lea
|
|
|
|
|
It should be fine - you can't/shouldn't be calling BeginPaint() /EndPaint() for WM_NCPAINT , so i don't know what the problem would be.
|
|
|
|
|
Hi,
Thanks for your reply, it is much appreciated!
I am using CWindowDC, I'm guessing that will work okay.
Thanks again!
Lea
|
|
|
|
|
Hello everybody I need to know urgent one thing
Im using this IpAdress control in MVisual C++ 6,
the control si working good, I created a member in this case
m_ip , and I put the IPAdress control in the Dialog
but when the Dialog starts, the Ip Adress control show me
just blank spaces
just , . . . .
does somebody knows how can I initialize that control,
I need that the control everytime I star the Dialog also the control starts with that adress 192.168.0.1
does somebody knows can I do that,where can I initialize the control with that value.
?????????
well thanx so much for you attention, my english is pretty bad I did my best
well,, thanx again
my email is
rubencia@yahoo.com
GOD BLESS YOU
SHALOM
|
|
|
|
|
REU wrote:
does somebody knows how can I initialize that control,
Why not use the SetAddress() method?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
i prepare to develop a COM on HTML page, now I want to know if the COM - which is on HTML page - can open and save files (such as settings) to visit's PC?
as I know, java applet can not do that, how about COM?
includeh10
|
|
|
|
|
I've tried that with ActiveX controls and it's possible.
|
|
|
|
|
i have a freeware which can download a large file by breaking it into pieces.
eg. for a 100M file, the software breaks it into 10 pieces and downloads them togather, then combines them into one.
I am interested about tech used by the software - i need to develop an auto-download software for a company now - i want to use the same tech for downloading.
any links or comments?
thanks
includeh10
|
|
|
|
|
there is a grid control in one window. i am trying to read the contents of that grid . using getclassname() function i have got the name of that controls class as 'ApexGrid.19'. now i am having a handle to that control. and class name. next i want to make use of this information to read that controls data. is there any way how to do it. how to get the various interfaces provided by that class. and how to include and use that class in our vc applications. please tell me.
|
|
|
|
|
I want to get the HTTP visit in my computer, which OS is windows 2000 and has IIS.
I create a program that uses socket to listen 80 port every second, but nothing captured.
Should I close the IIS or listen HTML format?
How to get it?
Thanks!
|
|
|
|
|
Can you please explain a little bit more what do you mean by "visit"?! In case you're trying to create a server-type application that listens for the 80 port (which by the way is HTTP) then you should disable IIS or re-direct IIS on a different port than 80 because the two would be attempting to do the same task. Then you should have your application always listen to port 80 (every second doesn't seem like a good ideea -- it's a two seldom)
I'd advise you to check out some documentation on writing TCP/IP client/server applications.. there are a ton of examples out there and just do a bit of readion on how a server works before you decide what to do with your app!
|
|
|
|
|
I want to create an unmanaged VC7.1 dll and use it with VC6? Is this possible? Although my app is MFC the dll does not require any MFC at all. The reason for my question is I would like to use some boost code that does not compile with vc6 in an application that would take too much effort to port to vc7. I know I would have to keep the boost code internal to the dll but that is ok for my application.
John
|
|
|
|
|
Answering my own question...
Well that works. I created a w32 dll in VC7 and linked and executed it from a VC6 application without any problems at all. I did not add boost to the vc7 dll but I'm sure that would work too.
John
|
|
|
|
|
Hi ALL,
I have created a Win32 Simple DLL project in VC++ 6. But although it is producing the .DLL file it is not producing the .LIB file. I don't know what is the problem. Please help me out.
Regds.
Somenath Mukhopadhyay
|
|
|
|
|
|
Hi,
I'm using DrawText(...) fn to draw multiline text.
Can I increase the default line spacing with out changing the text size?
I can't replace the DrawText to TextOut because I need DT_WORDBREAK and DT_CALCRECT.
- NS -
|
|
|
|
|
I would calculate where each line of text will break, create a new string for the new length and draw each line of text independently - then adjust the lpRect to move down the desired spacing.
|
|
|
|
|
Hi,
How can I get the colors set by CWinApp::SetDialogBkColor?
- NS -
|
|
|
|
|
Will this work:
_AFX_WIN_STATE* pWinState = _afxWinState;
COLORREF clrCtlBk = pWinState->m_hDlgBkBrush;
COLORREF clrCtlText = pWinState->m_crDlgTextClr
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Thank you.
But when I use it I get a link error:
error LNK2001: unresolved external symbol "class CProcessLocal<class _afx_win_state=""> _afxWinState" (?_afxWinState@@3V?$CProcessLocal@V_AFX_WIN_STATE@@@@A)
What should I do?
- NS -
|
|
|
|