|
nachilau wrote: I have written a program which contains a GUI windows and also a console windows. When the program start, I allocate a console window from Windows.
How are you doing that exactely ?
nachilau wrote: when the child prcoess get closed, its parent process will also be destoryed
Certainly not.
~RaGE();
|
|
|
|
|
The way that I do it is
AllocConsole();
m_hout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleMode(m_hout, ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
If you say that it is not true that when the child process get deleted, the parent process also get deleted, then I don't understand why my GUI get closed when the user close the console window.
|
|
|
|
|
Hi,
Does someone knows , or knows a demo, package how to extract data from a txt file and plot directly by using Visual C++ 6?
Thanks a lot,
TPP
|
|
|
|
|
|
I am developing VC++ Application using Managed Extensions in visual Studio .NET 2003. I have selected the .NET Console Application Template for this and included the necessary namespaces and dll files. Th problem I am being facing is: OnPaint Event Handler is not working (!unresolved link externals). How do I resolve this? I am pasting the code below.
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#using <system.dll>
#using <system.drawing.dll>
#using <system.windows.forms.dll>
using namespace System::Windows::Forms;
using namespace System::Drawing;
using namespace System::Drawing::Imaging;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Managed class subjected to Garbage Collector indicated by __gc keyword
__gc class MyForm:public Form
{
public:
//Constructor
MyForm();
protected:
//When the form is to be re-painted the OnPaint() event handler will be invoked
void OnPaint(PaintEventArgs *e);
private:
//To display graphic file on the we must use Bitmap Class object like:
Bitmap *m_Bitmap;
// Event handlers for the Menu Commands
void OnMnuOpen(Object* sender, EventArgs *e);
void OnMnuSave(Object* sender, EventArgs *e);
void OnMnuExit(Object* sender, EventArgs *e);
};
//Constructor
MyForm::MyForm()
{
//Creating Menu for the form (Object of MainMenu type)
MainMenu *mnu = new MainMenu();
//Creating Menu Items (Object of MenuItem type)
MenuItem *item = mnu->MenuItems->Add("File");
/*
Creating the options that appear under the File menu and add them to
File MenuItem
*/
item->MenuItems->Add("Open",new EventHandler(this,&MyForm::OnMnuOpen));
item->MenuItems->Add("SaveAs",new EventHandler(this,&MyForm::OnMnuSave));
item->MenuItems->Add("Exit",new EventHandler(this,&MyForm::OnMnuExit));
/*
The entire menu has been created but it will will be visible only when its
reference is passed to the menu property of the form, which is done by the
line of code below i.e. this->Menu = mnu;
*/
this->Menu = mnu;
}
void MyForm::OnMnuOpen(Object* sender, EventArgs *e)
{
//using Windows Open Dialog Box
OpenFileDialog *Odlg = new OpenFileDialog();
Odlg->Filter = Odlg->Filter->Concat((String *)"Image Files(JPEG, GIF, BMP, etc.)|*.jpg; *.gif; *.bmp; *.tif; *.tiff; *.png");
Odlg->Filter = Odlg->Filter->Concat(Odlg->Filter,"|JPEG Files (*.jpg; *.jpeg)| *.jpg; *.jpeg");
Odlg->Filter = Odlg->Filter->Concat(Odlg->Filter,"|GIF Files (*.gif)|*.gif");
Odlg->Filter = Odlg->Filter->Concat(Odlg->Filter,"|BMP Files (*.bmp)|*.bmp");
Odlg->Filter = Odlg->Filter->Concat(Odlg->Filter,"|TIFF Files (*.tif; *.tiff)| *.tif; *.tiff");
Odlg->Filter = Odlg->Filter->Concat(Odlg->Filter,"|PNG Files (*.png)|*.png");
Odlg->Filter = Odlg->Filter->Concat(Odlg->Filter,"|All Files (*.*)|*.*");
Odlg->FilterIndex = 3;
// Handling the click OK of the Dialog
if((Odlg->ShowDialog()) == DialogResult::OK)
{
String *fileName = Odlg->FileName;
if(fileName->Length != 0)
{
try
{
m_Bitmap = new Bitmap(fileName);
AutoScroll = true;
AutoScrollMinSize = m_Bitmap->Size;
Invalidate();
}
catch(Exception *e)
{
MessageBox::Show("Invalid image format", "ERROR");
}
}
}
}
void MyForm::OnMnuSave(Object* sender, EventArgs *e)
{
SaveFileDialog *Sdlg = new SaveFileDialog();
Sdlg->Filter = "JPEG Files(*.jpg; *.jpeg)|*.jpg; *.jpeg |GIFF Files(*.gif)|*.gif|BMP Files(*.bmp)|*.bmp|TIFF Files(*.tif; *.tiff)|*.tif; *.tiff";
if(Sdlg->ShowDialog() == DialogResult::OK)
{
String *SaveStr;
/*
FilterIndex refers to the index of the file types in the filter string
that is currently selected by the user
*/
//Getting the Index of the selected file type in the filter
int index = Sdlg->FilterIndex;
//Getting the File name typed by the user
SaveStr = Sdlg->FileName;
switch(index)
{
case 1:
m_Bitmap->Save(SaveStr,ImageFormat::Jpeg);
break;
case 2:
m_Bitmap->Save(SaveStr,ImageFormat::Gif);
break;
case 3:
m_Bitmap->Save(SaveStr,ImageFormat::Bmp);
break;
case 4:
m_Bitmap->Save(SaveStr,ImageFormat::Tiff);
break;
}
}
}
void MyForm::OnMnuExit(Object* sender,EventArgs *e)
{
this->Close();
}
int _tmain()
{
Application::Run(new MyForm());
return 0;
}
Syed Fasih
|
|
|
|
|
(wrong forum, go have a look at the CLI/C++ one )
but I was wondering, why did you select a console application for what it looks a Form based application ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Well In Visual Studio .Net 2003 I am not able to find template named MANAGED APPLICATION. This code must be used for Managed .... My friend told me put it in Console... Please guide me as I am new to Managed code
Thank you in advance;)
|
|
|
|
|
I am student, i need to develop a application that requires to access a function that is already available in outlook 2003 (specifically the dial function in the the action menu of outlook 2003). If someone can tell me how to access the function, it would be really helpful
Thanking you in advance
Robin Bhatnagar
|
|
|
|
|
Does Outlook COM expose it as an interface?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
hi David,
Outlook exposes its functionality through many interfaces. the application ID of outlook is outlook.application.u can search it in registry.then u can find out the dll for that. and after that everything is in ur hand.
bye,
.
chetan prakash agrawal
|
|
|
|
|
I knew this. I was prodding zeeshan to do some research on his own. I'm a big fan of the old "Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." adage.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
I am currently doing an application and i am required to save data from edit boxes to a file and load them when need. I am familiar with the C++ , FILE *fp method of file i/o. But is there a proper and simple MFC method for doing file i/o ? (Sample code greatly appreciated =) )
Thanks
|
|
|
|
|
BeakX wrote: But is there a proper and simple MFC method for doing file i/o ?
See the CFile and CStdioFile classes.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
You can also consider persisting data using CArchive in MFC.
George Mileka
|
|
|
|
|
Perhaps BeakX could, too!
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
You can also use fstream.h
To get data from the file make an object of ifstream
and to write data to file, make an object of ofstream
then use these objects just like cout and cin in c++. These are very easy to use.
You can visit msdn.microsoft.com for the help on ifstream and ofstream.
Good Luck.
We Believe in Excellence
-- modified at 23:21 Monday 20th February, 2006
|
|
|
|
|
Thanks. I'll be sure and let BeakX know.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
BeakX wrote: But is there a proper and simple MFC method for doing file i/o ? (Sample code greatly appreciated =) )
I belive CStdioFile is one most stable File handlling class MFC have
"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
|
|
|
|
|
Hi there,
guys, I have an idea to work on some editor ( very simple one with some simple syntax adn color controls). Seems like some fun. Could some one point to some directions where I should start looking, some links or tutorials??
Regards,
|
|
|
|
|
Google for scintilla
~RaGE();
|
|
|
|
|
Thanks for the help. Good starting point
Regards
|
|
|
|
|
|
Thanks for your help,
Regards
|
|
|
|
|
How cain i convert Stream data Image to Image?
I get from Http a Stream data Image but when i will convert to image, always have trouble to Parameters. Anybody know how can i do this? Thanks..
Vander
|
|
|
|
|
Hello,
I have the need for a tab control that renders slighly different from the default control provided in the mfc library. I would like for it to display tabs on the left hand side, but with horizontal text. Additionally, I would like to have navigation buttons (up/down), and for each tab to have a close button. Finally, one must be able to add 'pages' dynamically. In short, I would like to have something like :
No navigation needed
___________________________________
| TAB 1 [x] | |
------------| |
| TAB 2 [x] | |
------------| DIALOG 1 |
| TAB 3 [x] | |
------------| |
| |
| |
|______________________|
Navigation needed
___________________________________
| UP BUTTON | |
------------| |
| TAB 4 [x] | |
------------| DIALOG 5 |
| TAB 5 [x] | |
------------| |
| TAB 6 [x] | |
------------| |
|DOWN_BUTTON|______________________|
I dont mind doing the coding myself, but to be honest, I dont know where to start as far as having it render in this manner. Any suggestions or sample code would be greatly appreciated.
Thanks,
-----------------
Genaro
|
|
|
|