Opening file explorer, then selecting a text document and then converting that text document?

I want the code to open Windows file explorer. Once the file explorer opens, the user picks a text document the code will then convert that document to a csv file( i already figured out how to convert the txt file to a csv file). After the csv file is converted the file explorer will open again and the user will choose another place to save the csv file.

Is it possible to do this in C/C++. If so I would appreciate any help with this program. Maybe some links to point me in the right direction? Or if you have dealt with something like this before maybe share some code?

Last edited on
Sounds like a Windows-specific API for graphical browsing of files.

Thus, would be easiest to do this in a small C# WPF application.
I doubt that you can automate the Windows File Explorer. Even if there is an ActiveX or Com Control available it would not be worth the trouble.
Why don't you use a simple OpenFileDialog ?
I asked the same question on another forum. I was hoping you guys would be able to help.

On the other forum i was told to use GetOpenFileName or another option would be to use IFileOpenDialog and IFileSaveDialog.

Are you guys aware of any examples that use these methods? and if so could you link them, I would love to learn them.

It doesn't sound like any automation here is necessary, it just needs to do an open file dialog, and then a save file dialog, sequentially.

While I agree with icy1 that a simple C# WPF application would be ideal here, check out the following for a complete example in C++.
https://msdn.microsoft.com/en-us/library/windows/desktop/dd940349(v=vs.85).aspx

In C# WPF, it can be as simple as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
private void button1_Click(object sender, RoutedEventArgs e)
{
    // Create OpenFileDialog 
    Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

    // Set filter for file extension and default file extension 
    dlg.DefaultExt = ".png";
    dlg.Filter = "JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif"; 

    // Display OpenFileDialog by calling ShowDialog method 
    Nullable<bool> result = dlg.ShowDialog();

    // Get the selected file name and display in a TextBox 
    if (result == true)
    {
        // Open document 
        string filename = dlg.FileName;
        textBox1.Text = filename;
    }
}

Source: https://stackoverflow.com/questions/10315188/open-file-dialog-and-select-a-file-using-wpf-controls-and-c-sharp
Topic archived. No new replies allowed.