Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
all i get is an empty console screen... can anybody help me with the shellexecute codes, i just want to open a text file.Code:#include "windows.h" #include "iostream.h" int main() { char input; cin.get(input); ShellExecute(NULL, "open", "hello.txt", "input", "C:\Documents and Settings\Administrator\Desktop\Alpha\hello.txt", SW_HIDE); return 0; }
According to MSDN:
4. If parameter 3 is a file, parameter 4 must be NULL.
5. This is the working directory. "C:\Documents and Settings\etcetera\hello.txt" is not a directory, it is a file. Also, backslashes need to be escaped, like "C:\\Documents and Settings\\etcetera", which is why you're getting all those warnings about nonsense escape characters.
6. SW_HIDE says to immediately hide the notepad window.