|
|
See some of the suggested solutions here[^].
Broadly speaking the filename is passed to your application as a command line (text string) and you need to parse the string to find the filename and any optional parameters you may accept.
It's time for a new signature.
|
|
|
|
|
If your app was created via the MFC wizard, all of the pieces should already be in place. If not, check out EnableShellOpen() and RegisterShellFileTypes() .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I am making a text editor in C++ and want it to save rtf an txt files. I have made a rich text box called richTextBox1, a toolstrip button called ToolStripButton1 and a save file dialog called saveFileDialog1. I need the save file dialog to save the contents of the rich text box when the tool strip button is clicked. Here is my code so far:
private: System::Void toolStripButton11_Click(System::Object^ sender, System::EventArgs^ e) {
saveFileDialog1->Filter="Text File|*.txt|Rich Text Document|*.rtf|All Files|*.*";
saveFileDialog1->Title="Save As";
this->saveFileDialog1->ShowDialog();
}
How do I make the dialog save the contents of the rich text box?
|
|
|
|
|
Hi,
the saveFileDialog is a dialog, it communicates with the user, it does not save a thing. Your code has to perform the necessary save actions upon the user's choices. So check for the dialog result, and if "OK", save the data yourself to the selected file.
|
|
|
|
|
mmagill0 wrote: How do I make the dialog save the contents of the rich text box?
You don't; the dialog merely gives the user the opportunity to select the destination file where the data will be saved. Your program then has to write the data into that file in the format relevant to the file type.
It's time for a new signature.
|
|
|
|
|
so how do I use the information returned from the dialog to save the file?
|
|
|
|
|
If ShowDialog() returns DialogResult.OK , use saveFileDialog1->FileName to open file file and write the contents.
|
|
|
|
|
mmagill0 wrote: so how do I use the information returned from the dialog to save the file?
The only information you have from the dialog is the file name and destination directory. From this you create the file and write your data to it, the dialog has no further influence on this process.
It's time for a new signature.
|
|
|
|
|
In addition to what's already been suggested, you might receive more help by posting to the correct forum.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
if i'm using winforms with C++, do I post in winforms or C++??
|
|
|
|
|
I think you are fine here; although your program uses Winforms (Managed C++/CLI) your question relates to C++ and Windows API.
It's time for a new signature.
|
|
|
|
|
I'm using Visual C++ 6 on Windows XP. My program uses COlePropertyPage property pages. One of them has a List Control. When the user clicks a certain part of my List Control, a dialog box appears, and when the user is done with it, it disappears. However, if the dialog box is moved over part of my List Control, when the box is closed that part is erased and set to gray, the color of the underlying COlePropertyPage. I want the List Control to refresh itself when the dialog box disappears. The control will refresh itself if another window is placed on top and then removed. Of course, I don't want the user to have to do that! The List Control should refresh immediately when the dialog disappears.
I'm trying Invalidate(), UpdateWindow() and RedrawItems() one at a time and all three at once. It makes no difference. Actually, I note that my DrawItem function is called even without calling those repaint functions. Calling them just repeats the DrawItem function being called. However, the DrawItem call has no effect. Also I've tried setting the control to dirty with COlePropertyPage::SetControlStatus(). Nothing works.
Thanks for any help..
|
|
|
|
|
Hi Member
How can i add File Icon in list control?
m_LIST.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP);
m_LIST.InsertColumn(1, _T("File Name"), LVCFMT_LEFT, 80);
m_LIST.InsertItem(0, "file.doc");
m_LIST.InsertItem(0, "file.pdf");
i want to add word icon,pdf icon(Microsoft defoult icon).
|
|
|
|
|
Try the SetImageList() method.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
i try to use this code.
SHFILEINFO fi;
BOOL bReturn = FALSE;
HIMAGELIST himl = NULL;
ZeroMemory (&fi, sizeof (fi));
himl = (HIMAGELIST)SHGetFileInfo (filename, 0, &fi, sizeof (fi), SHGFI_ATTRIBUTES | SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
bReturn = m_ImageListSmall.Attach (himl);
m_LIST.SetImageList (&m_ImageListSmall, LVSIL_SMALL);
I have found only same image showing in all column(what ever file is .doc or .pdf).
Can you guide me for this problem.
|
|
|
|
|
How many images are in the image list? When you add items to the list control, what index are you using for the image?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I want to know how to declare three dimensional arrays in C/C++ and how they work. Examples will do. Please help.
|
|
|
|
|
Maybe this link[^] will help get you started.
|
|
|
|
|
I have been to that site but it only talks about it without examples. I know it can for instance be declared as follows:
int rates[10][4][3];
The declaration is what has been shown on the site. But I want to know how to initialise the array when it is declared, and know how the indexing will refer to a particular value in the initialising list.
|
|
|
|
|
OK, how about this[^] site.
|
|
|
|
|
Try the information here[^]. Although this only covers 2D arrays, you can think of the third dimension as a number of 2D arrays one on top of the other, the index increasing as you go further down the planes.
It's time for a new signature.
|
|
|
|
|
Dan_K wrote: But I want to know how to initialise the array when it is declared...
Like:
int Array3D[2][4][6] =
{
{
{ 1,2,3,4,5,6 },
{ 7,8,9,10,11,12 },
{ 13,14,15,16,17,18 },
{ 19,20,21,22,23,24 }
},
{
{ 77,78,79,80,81,82 },
{ 83,84,85,86,87,88 },
{ 89,90,91,92,93,94 },
{ 95,96,97,98,99,100 }
}
};
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
|
A sample;
int array[3][4][5] = {
{
{ 1, 2, 3, 4, 5 },
{ 1, 2, 3, 4, 5 },
{ 1, 2, 3, 4, 5 },
{ 1, 2, 3, 4, 5 }
},
{
{ 1, 2, 3, 4, 5 },
{ 1, 2, 3, 4, 5 },
{ 1, 2, 3, 4, 5 },
{ 1, 2, 3, 4, 5 }
},
{
{ 1, 2, 3, 4, 5 },
{ 1, 2, 3, 4, 5 },
{ 1, 2, 3, 4, 5 },
{ 1, 2, 3, 4, 5 }
}
};
|
|
|
|
|