|
here is the twist. My application is dialog based. I could identify where did the user call my software (e.g. if the user call it in the command line or if the user click it's icon. My problem is i could not print in the command line. if i call my application in the command line i no printing in the command line will happen.
what i really want is to make my software run in both GUI mode and CLI mode. i could make it run in GUI mode but i cant run it using the command line. i would like it to run in one mode at a time. if the user prefer to run it in GUI mode the all its functionalities should run in GUI mode. if the user prefers to run it in CLI mode all it's functionalities should run in CLI mode.
thanks for the reply...
regards...
|
|
|
|
|
What kind of application do you have ? Plain Win32 ? MFC ?
If MFC, ihe best way to do this would be to have the executive tasks of your program located in User Interface independant classes (e.g. do not locate all computation functions in the MFC GUI derived classes), and call these tasks from the InitInstance function (e.g. if there are command line options when parsing the command line in InitInstance, do not call all the MFC GUI part).
~RaGE();
|
|
|
|
|
my software supports MFC. my software functionalities are all in different classes. I would like my software to run in one mode at a time. if the user chooses to run it in GUI mode then all my functionalities should run in GUI mode. I have no problem with that. The problem comes in if the user chooses to run it in CLI mode.
thanks for the reply...
regards...
|
|
|
|
|
If it is a dialogue based application then put a condition around
<br />
int nResponse = dlg.DoModal();<br />
This is the code that displays the dialogue.
You will have to call any functions you want within the dialogue class by calling from this point instead, such as:
<br />
if(UseDlg)<br />
{<br />
int nResponse = dlg.DoModal();<br />
}<br />
else<br />
{<br />
dlg.DoFunc1();<br />
dlg.DoFunc2();<br />
nResponse = IDOK;<br />
}<br />
Note the last line gives the same effect as clicking the OK on the dialogue.
Elaine
The tigress is here
|
|
|
|
|
yes i have done that. the problem is i can't perform console i/o. i can't even print my name in the console. Can you help me about this...
thanks for the reply...
regards...
|
|
|
|
|
Here the code and step..
1. Create a MFC dialog based application.
2. Create a new thread class (named CConThread) deriving from CWinThread (Use Application wizard)
3. In the Dialog App InitInstance () function add this code
int nResponse;
CString str = this->m_lpCmdLine;
if (str.Find ("Console") > -1)
{
CWinThread *t = AfxBeginThread(RUNTIME_CLASS(CConThread),THREAD_PRIORITY_NORMAL,0,0,NULL);
WaitForSingleObject(t->m_hThread,INFINITE);
}
else
{
CWinConDlg dlg;
m_pMainWnd = &dlg;
nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
}
4. USing class wizard add Run() method to your CConThread class...
5. Add this code to your Run () method
int CConThread::Run()
{
AllocConsole();
HWND hWnd = NULL;
ifstream istr;
ofstream ostr;
//typedef HANDLE (__stdcall *FOO)(LPCTSTR);
istr.open ("CONIN$");
cin = istr;
ostr.open ("CONOUT$",ios::out);
cout = ostr;
typedef HWND (__stdcall *CW) ();
CW fp;
HMODULE hM = LoadLibrary("Kernel32.dll");
fp = (CW) GetProcAddress(hM,"GetConsoleWindow");
hWnd = (*fp)();
SetStdHandle(STD_INPUT_HANDLE,hWnd);
SetStdHandle(STD_OUTPUT_HANDLE,hWnd);
SetStdHandle(STD_ERROR_HANDLE,hWnd);
cout << "Welcome to my app .. Enter a value ";
cout.flush();
int i;
//istr >> i;
cin >>i;
cout << endl << "You have entered " << i;
cout.flush ();
istr.close();
ostr.close();
//return CWinThread::Run ();
return 0;
}
6. Compile and build the code
Execution
----------
1. If you execute the app without any command line agrument, it will display a dialog (As usual)
2. To work on command prompt d:\> AppName Console
where console is the paramter that I have checked inside the code..
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
just one more question...
Is it possible that when i call my program in the cmd it will not again call another cmd.
In short, is it possible to use the command line, where the user call my software, for printing...
thanks...
regards...
|
|
|
|
|
My email address is moodsey211@yahoo.com you could send your experiment in this email address.
One more question, is it possible to use the command line where the user called my program for printing.
I mean, i should not reallocate another command line since the user is using the command line in the first place. I would just use the command line, where the user type "mySoft.exe Console" for printing. All the printing and scanning activity to be done it that same command line.
No more new command line pop-up that will appear.
thanks...
regards...
|
|
|
|
|
i have the problem when it comes on printing the number that i have inputed can you help me...
|
|
|
|
|
I will give the vertices of outer polygon, the code need to generate the vertices of inner polygon , with given tolerance for e.g. 50 mt.
|
|
|
|
|
haveu got the algorithm first ?
making it as a code segment is not a problem ..ths problem is moer to do with geometry then codeing ...
redindian
|
|
|
|
|
I dont have the algorithm, iam waiting for that only.
|
|
|
|
|
Iam waiting for the readymade code, because i urgently need that one.
|
|
|
|
|
hi!
does anybody use dialog with big scrollbar (vertical) ?
first if i move the scrollbar down, i can see my buttons in the bottom of the dialog. important: the buttons have to be on the bottom. i don't want them at the top.
but, if i open the dialog, i can't see them.
how can i manage it? i want see the pushbuttons while scrolling, everytime.
it could be similar to the excel function to fix the window i.e for topics at the top of cells.
i tried with floating buttons, but it flickers. not so beautiful
possible, just connect with a dockable window, which include all buttons of the scrollable dialog???
does anybody have an idear?? example?
thanks!!!!
|
|
|
|
|
hi,
can anybody tell me how do i go about building an ISAPI application. the application which i intend to build is as follows: the user will select some options from a web page(options regarding some images) and then click the get button. then the image selected by the user should get displayed on the page. in html this is simple but this is only a test application.in the final application the user is going to select the name of another application and also send some data required by that application. the background program(i.e. the ISAPI extension ) will have to check whether the application required by the user exist and then pass on the data to that application and wait for the result. when it obtains the result it will show it back to the user. so as a first i want only to send back some images. can anyone tell me how to go about this application. i tried using the sample programs on code project but they did not have any explanation and did not worl properly. Lastly is there anyother better way to build this application other than what i have said(if it is the correct way)
thanks
aditya
|
|
|
|
|
Hi friends,
I would like to know how can we transmitt video captured from a webcam to another system through LAN in real time.
(Link to related articles,white papers,sample projects..etc are also welcome!!)
Thanx in advance
|
|
|
|
|
Respected all
I have a data file in the following form
-----------------------------------------------------
;sdfsd
;sdfsd
;sfhsd
;nfs
;gfsfjgsf
;X Y index
12 34 2333
14 56 3334
12 56 7895
;sdkfskd
;sdhfkjd
45 34 3433
------------------------------------------------
in the above file the line started with SEMICOLON will be consider as comments i.e i have to read only the lines stating without SEMICOLON and all lines starting from SEMICOLON will show an error exception and read that line that start without SEMICOLON.
so how can i read the above format of file reading.
waiting for + response.
david
|
|
|
|
|
CString strFile = "theFile.txt"
std::ifstream SourceFile(strFile);
char buffer[50];
while (!SourceFile.eof() && ::PathFileExists(strFile)) {
SourceFile.getline(buffer, sizeof(buffer));
if ( ) {
}
}
SourceFile.close();
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Respected Toxcct
Regards!
Thanks for response, but now how i can proceed in
if(.....)
i dont know that how i write the condition in my case, so plz push me.
Waiting for + response.
|
|
|
|
|
Hi,
I would like to know the role of IMPLEMENT_DYNAMIC,IMPLEMENT_SERIAL & IMPLEMENT_DYNCREATE macros in mFC.
I very well know that they are used for Dynamic Creation of objects,Accessing runtime information and for Serialization. But I want to know how these macros help in this? Can anyone please give me some link to articles where I can find this information.
Thanks
Madhavi.
|
|
|
|
|
Hi!
Can someone please help me how to write a button control that can be dragged and dropped?
I want to drag the button from one side of the Dialog to the other.
I'm doing this to learn.
Thanks!
|
|
|
|
|
reposting the same question[^] will cause the same answers...
if no one answered much is because :
1) the question is not clear enough
2) no one knows
3) what has been answered performs you enough infos for you to do it !
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hello,
I created a extended TabCtrl from CTabCtrl. Then subclassed it to a CPropertySheet. The problem is after I select any other page in the propertysheet, it will get hanged on activate or deactivate other windows which make my program to do repaint.
If the page has no controls on it, there is no problem.
The creation of propertysheet is as follows:
m_pPropSheet = new CPropSheetEx("",this);
m_pPropSheet->AddPage(&m_page3);
m_pPropSheet->AddPage(&m_page2);
m_pPropSheet->AddPage(&m_page1);
m_pPropSheet->Create(this,WS_CHILD|WS_VISIBLE);
In CPropSheetEx (the derived class), I use the following to subclass the tabctrl:
BOOL CPropSheetEx::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
CTabCtrl* pTabCtrl = GetTabControl();
m_tabctrl.SubclassWindow(pTabCtrl->GetSafeHwnd());
return bResult;
}
I did override OnPaint() of the CTabCtrl in my derived CTabCtrlEx to draw my special tab styles.
Can anybody help me, please?
Thank you!
|
|
|
|
|
Sorry, I didn't understand this part:
Nishad S wrote:
it will get hanged on activate or deactivate other windows which make my program to do repaint
Can you clarify it?
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Suppose my program is running top of all windows, when I minimized and then restore any other window over my program's window, then my program will get hanged.
I think it causes the complete redraw of my program's window.
It is also get hanged when I activate another window over my window completely and then reactivate my window.
In short, I think, my program gets hanged when the window is completely redrawn.
If there is no controls on the page, no problem!
|
|
|
|