What I want to do is a program like notepad. I want that all the ".txt" files, when I double click on them, open with my program instead of notepad. But I don't have any clue how to do this. So, in resume, I want:
Make my program predeterminate for .txt extension files
Make a program that open "automatically? " that file. Like when I open a test.txt file, and the notepad show the content of that file.
If you have any doubt, or I didn't explained very well, please ask!
This can be done by changing your OS setting. For example: Right Click -> Open With -> Choose default program, then select a direction to your execute.
I don't think you can implement it into your program.
I think this will get you started:
http://www.codeproject.com/Articles/12474/How-To-Make-A-Very-Simple-Text-Editor-Using-MFC-in
Related
I need to make a windows console application file explorer using c++ , but I couldn't figure out how to use functions to display files nor how am I going to make it look like knowing that console application doesn't support buttons or displaying lists , specially that the project must be based on windows.h library. any tip, advice or suggestion may be helpful , thank you !
Have a look at http://www.martinbroadhurst.com/list-the-files-in-a-directory-in-c.html and scroll down to method 4. There you can see a possible implementation of a read-directory function. You should store a default start path, implement some console arguments as commands, then, whenever the user writes a command (for example goUp) ,change the path accordingly (in this case, remove the last foldername), call the function, which reads the directory, again and output all files in that folder.
So I was writing a simple c++ program and I want to have the "tab" function to show directories instead of manually typing in the directory in the terminal as input.
Thanks in advance!
Edit: Basically after starting the program I want it to read the terminal for any input and in that input I want to have the "shell function" which can auto-complete/suggest directories.
Edit: Readline looks promising from what I have read. I will try it out when I have time and leave feedback.
I am new to programming and seem to be having trouble figuring out how to direct output to a printer.
cout directs to monitor, is there a command to direct to the print queue?
I have a simple console program and am using code blocks for my ide.
A problem like this is dependent on your operating system. Assuming you use windows, you may need to look at the 'Windows API' which may or may not have a method of doing this. Alternatively, you can output to a text file, then use a script to open the file, run through the print menu, and close the file which is less eloquent but will work.
I have a program that opens a WAV file and then plots the waveform. If the WAV file has 2 channels, two graphs are shown, one for each channel. It's working fine but I want to add things in the File Menu that I created. So far, I have three buttons: New, Open File, and Close. So far, the Open File and the Close buttons are working fine.
I want to make the program to be able to let the user view several waveforms of several WAV Files at the same time. One option would be to create more graphs, the process would be quite tedious. Another option would be to open another window and this is what I want to do.
However, this is my problem. I made a quick search on how to open an existing program in C++, and so far, the solutions that I encounter involve opening an exe file and the project folder does not contain an exe file.
I also tried to take a quick look on the functions and I can't find the function that seems to open the window and I can't seem to find it.
Your best bet is to use fork. Alternatively you could use threads.
Use GetModuleFileName API to get the path+ name of your executable. Then Use ShellExecute to run this APP.
I am not sure how to explain this, so I will give a scenario.
I want to write a program, which will be set as the default program for a file extension. When the program opens, it will output everything in the program. i.e file.txt contains the word hello, and when opened, my program opens and displays the word hello.
The idea is like Notepad. When a text file is opened, the contents are displayed. However, mine will be in a DOS window.
How can I achieve this?
Sorry if there is another question like this somewhere on here, TBH I am not too sure what this is called and thus can't search.
EDIT: My apologies. I am running Windows 7
If you open a file "with" your program (for instance using file type associations or by dragging the file onto the .exe), then the filename of the data file is passed as the command-line parameter to your application.
See:
What are the arguments to main() for?
I want to write a program, which will be set as the default program for a file extension.
See:
How File Associations Work
File Types and File Associations
You will associate your app with file extension and your app will do whatever it has to do.