I am trying to use ShellExecute in my program to open up various files, using the default program depending on the file extension. After reading various posts, I have the following...

Qt Code:
  1. #include "qt_windows.h"
  2. #include "qwindowdefs_win.h"
  3. #include <shellapi.h>
  4. ...
  5. long result = (long)ShellExecute(0, 0, reinterpret_cast<const WCHAR*>("test.csv"), 0, 0, SW_NORMAL);
  6. QMessageBox::critical(this, "Error", QString::number( result, 'f', 0 ) );
To copy to clipboard, switch view to plain text mode 

Now the error I get is always "2", which if I'm correct, is "file not found", possibly "path no found". I have made sure that the file is in the same directory as my executable. I have even tried "c:\test.csv", as well as "c:/test.csv", making sure the file is in the root directory.

In another post I read that I need to use "( TCHAR * ) qt_winTchar" since it is expecting a wide character string. But that is apparently old, and I should use ucs2, but I only have fromUcs4(). I really am confused.
See http://lists.trolltech.com/qt-intere...ad01271-0.html for my ref.