#include "windows.h"
#include "winnls.h"
#include "shobjidl.h"
#include "objbase.h"
#include "objidl.h"
#include "shlguid.h"
HRESULT CreateLink(LPCWSTR lpszPathObj, LPCSTR lpszPathLink, LPCWSTR lpszDesc)
{
HRESULT hres;
IShellLink* psl;
// Get a pointer to the IShellLink interface. It is assumed that CoInitialize
// has already been called.
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&psl);
if (SUCCEEDED(hres))
{
IPersistFile* ppf;
// Set the path to the shortcut target and add the description.
psl->SetPath(lpszPathObj);
psl->SetDescription(lpszDesc);
// Query IShellLink for the IPersistFile interface, used for saving the
// shortcut in persistent storage.
hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);
if (SUCCEEDED(hres))
{
WCHAR wsz[MAX_PATH];
// Ensure that the string is Unicode.
MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1, wsz, MAX_PATH);
// Add code here to check return value from MultiByteWideChar
// for success.
// Save the link by calling IPersistFile::Save.
hres = ppf->Save(wsz, TRUE);
ppf->Release();
}
psl->Release();
}
return hres;
}
#include
int main()
{
CoInitialize(NULL);
std::wstring sourceFile = L"C:\\path\\to\\source\\file.txt";
std::string linkName = "C:\\path\\to\\file.lnk";
std::string comment = ""; // you can see comment in properties of the link
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79328952/create-a-shortcut-with-a-dialog-box[/url]
Как программно показать окно создания ярлыка на C++ с помощью WinAPI? Я знаю, как создать сам ярлык на C++, это можно сделать так: [code]#include "windows.h" #include "winnls.h" #include "shobjidl.h" #include "objbase.h" #include "objidl.h" #include "shlguid.h"
// Get a pointer to the IShellLink interface. It is assumed that CoInitialize // has already been called. hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&psl); if (SUCCEEDED(hres)) { IPersistFile* ppf;
// Set the path to the shortcut target and add the description. psl->SetPath(lpszPathObj); psl->SetDescription(lpszDesc);
// Query IShellLink for the IPersistFile interface, used for saving the // shortcut in persistent storage. hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);
if (SUCCEEDED(hres)) { WCHAR wsz[MAX_PATH];
// Ensure that the string is Unicode. MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1, wsz, MAX_PATH);
// Add code here to check return value from MultiByteWideChar // for success.
// Save the link by calling IPersistFile::Save. hres = ppf->Save(wsz, TRUE); ppf->Release(); } psl->Release(); } return hres; } #include
int main() {
CoInitialize(NULL); std::wstring sourceFile = L"C:\\path\\to\\source\\file.txt"; std::string linkName = "C:\\path\\to\\file.lnk"; std::string comment = ""; // you can see comment in properties of the link std::cout
Я работаю над приложением продукта Eclipse RCP и хочу добиться поведения, аналогичного Eclipse IDE, при запуске нескольких экземпляров с панели задач. В частности, я хотел бы:
Запустить первый экземпляр приложения из исполняемого файла (exe)....
Запрос фонового местоположения перенаправляет пользователя в настройки разрешений приложения.
Но недавно я обнаружил, что приложение «Просто автоматически» показывает диалог вместо перенаправления пользователя на эту страницу настроек. Как мне...
Я разрабатываю приложение Flutter, которое использует структуру доступа к хранению (SAF) для запроса разрешений папки. Когда открывается нативный диалог saf Android Saf, я хочу отобразить текст/руководство для наложения, чтобы помочь пользователям...
Чтобы передать некоторые объекты JavaScript с веб-страницы «foo.com» на всплывающая веб-страница на «bar.com»
Скажем, из с «foo.com/some_page/» на «bar.com/another_page.html»...
Я пытаюсь просмотреть и извлечь инвентаризацию продукта на веб -сайте с помощью Python selenium. У меня не было никаких проблем, взаимодействующих с сайтом; Однако, чтобы просмотреть запасы продукта, я исчерпал варианты, о которых я знаю. У меня...