- 223
- 53
Использую этот код для скачки и запуска текстовика с сервера, в визуал студио он нормально работает, а через плагин апи игра появляется в процессах но не запускается.
Работает:
Не работает:
P.S: Как сохранять файл в temp папку?
Работает:
Код:
// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include <iostream>
#include<Windows.h>
#include "shellapi.h"
#pragma comment(lib, "Shell32.lib")
#include <iostream>
#include<string>
#pragma comment(lib, "urlmon.lib")
int main()
{
std::cout << "Hello World!\n";
std::string dwnld_URL = "http://sabaka.tk/test.txt";
std::string savepath = "C:\\Users\\exn\\Documents\\filename.txt";
HRESULT hr = URLDownloadToFile(NULL, dwnld_URL.c_str(), savepath.c_str(), 0, NULL);
if (SUCCEEDED(hr)) { ShellExecuteA(NULL, "open", savepath.c_str(), NULL, NULL, SW_SHOWNORMAL); }
return 0;
}
Не работает:
Код:
#include "plugin.h"
#include "shellapi.h"
#pragma comment(lib, "Shell32.lib")
#include <iostream>
#include<Windows.h>
#include<string>
#pragma comment(lib, "urlmon.lib")
using namespace plugin;
class Cfps_down {
public:
Cfps_down() {
std::string dwnld_URL = "http://sabaka.tk/test.txt";
std::string savepath = "C:\\Users\\exn\\Documents\\filename.txt";
HRESULT hr = URLDownloadToFile(NULL, dwnld_URL.c_str(), savepath.c_str(), 0, NULL);
if (SUCCEEDED(hr)) { ShellExecuteA(NULL, "open", savepath.c_str(), NULL, NULL, SW_SHOWNORMAL); }
}
} cfps_down;
P.S: Как сохранять файл в temp папку?