To Open logfile in a notepad !!!!!!!!!!!!!
-
I am using WinExec("C:\\logfile.txt",SW_SHOW) to open my file in a notepad on pressing a certain button but the file is not opened in the notepad. Infact nothing is happening when I press the button. I am using the same code of line WinExec("Notepad.exe,SW_SHOW") to open the notepad and it is working properly there. Plz give me its solution, by just giving the path of our file, it could open in a notepad. thanx Reply me soon
-
I am using WinExec("C:\\logfile.txt",SW_SHOW) to open my file in a notepad on pressing a certain button but the file is not opened in the notepad. Infact nothing is happening when I press the button. I am using the same code of line WinExec("Notepad.exe,SW_SHOW") to open the notepad and it is working properly there. Plz give me its solution, by just giving the path of our file, it could open in a notepad. thanx Reply me soon
summo wrote: I am using WinExec("C:\\logfile.txt",SW_SHOW) to open my file in a notepad According to MSDN, the first parameter of WinExec is "Pointer to a null-terminated character string that contains the command line (file name plus optional parameters) for the application to be executed". In other words, first parameter must include name of program you want to execute. WinExec is not shell-oriented, i.e., it does not "associate" file types with applications. What you want is ShellExecute, which is shell-oriented:
ShellExecute(NULL, "open", "C:\\logfile.txt", NULL, NULL, SW_SHOW);
Best wishes, Hans
-
I am using WinExec("C:\\logfile.txt",SW_SHOW) to open my file in a notepad on pressing a certain button but the file is not opened in the notepad. Infact nothing is happening when I press the button. I am using the same code of line WinExec("Notepad.exe,SW_SHOW") to open the notepad and it is working properly there. Plz give me its solution, by just giving the path of our file, it could open in a notepad. thanx Reply me soon
-
Did you try WinExec("Notepad.exe C:\\logfile.txt", SW_SHOW)? WinExec("C:\\logfile.txt", SW_SHOW) tries to execute logfile.txt which is not an executable file. // Afterall I realized that even my comment lines have bugs
-
Thanks Alot Toni78, u r really genious. yest the code is working, now tell me, after writing WinExec("Notepad.exe C:\\logfile.txt",SW_SHOW) i want that the file logfile.txt opened in notepad must be maximized. thanx