The error message is indicating that there is a problem converting the string from char* to wchar_t*. This can be resolved by using the L prefix to specify wide character strings.

Here's the modified code:

#include <windows.h>
#include <tchar.h>
#include <UrlMon.h>


int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine, int nShowCmd)
{
    URLDownloadToFile(NULL, _TEXT("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fi1.hdslb.com%2Fbfs%2Fface%2F5be72543ac33f61c5a3bdeca3067ec18a84a99d2.jpg&refer=http%3A%2F%2Fi1.hdslb.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1657868004&t=90241287946549b7b0d3c4e05e30c544"), 
                     _TEXT("C:\\cctry.png"), 0, NULL);

    MessageBox(NULL, _TEXT("这是消息"), _TEXT("这里是标题"), NULL);

    return 0;
}

This should resolve the compilation error.

#include windowsh#include tcharh#include UrlMonhint WINAPI WinMainHINSTANCE hInstance HINSTANCE hPrevInstance LPSTR lpCmdLine int nShowCmd URLDownloadToFileNULL _TEXThttpsgimg2bai

原文地址: https://www.cveoy.top/t/topic/i7eB 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录