I have sth like that

Qt Code:
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3. #include <QtGui>
  4. #include <QApplication>
  5. //#include <config.h>
  6.  
  7. #include <qt_windows.h>
  8.  
  9. typedef HRESULT (*P_URLDownloadToFile)(
  10. LPUNKNOWN pCaller,
  11. LPCTSTR szURL,
  12. LPCTSTR szFileName,
  13. DWORD dwReserved,
  14. void*
  15. );
  16.  
  17.  
  18. TCHAR path[] = TEXT("http://webpage.com/index.php");
  19. TCHAR filew[] = TEXT("file.name");
  20. wchar_t ur[] = TEXT("urlmon.dll");
  21.  
  22. P_URLDownloadToFile _URLDownloadToFile;
  23.  
  24. int main(int argc, char *argv[])
  25. {
  26. QApplication a(argc, argv);
  27. MainWindow w;
  28.  
  29. HRESULT uRet = 1;
  30. HINSTANCE hLib;
  31. HMODULE urlmon=LoadLibrary(ur);
  32. if(urlmon){ _URLDownloadToFile=(P_URLDownloadToFile)GetProcAddress(urlmon,"URLDL2F"); }
  33. uRet = _URLDownloadToFile(NULL,path,filew,0,NULL);
  34. if (uRet == S_OK)
  35. { qDebug() << "OK" << endl; }
  36. else { qDebug() << "Wrong" << endl;}
  37.  
  38. FreeLibrary(hLib);
  39.  
  40. // Configsettings set_settings;
  41. // set_settings.loadConfig();
  42. w.show();
  43. return a.exec();
  44. }
To copy to clipboard, switch view to plain text mode 


When I was using this code in DevC++ it was working because insted of TCHAR and wchar_t I had "string". In QtCreator I had got errors like " cannot convert 'std::string' to 'const TCHAR*' in argument passing"