Quantcast
Channel: Total Commander
Viewing all articles
Browse latest Browse all 3823

Plugins and addons: devel.+support (English) • external call to update addon

$
0
0
I try to call a addons from a c++ file, do it is possibile?
I get crash with 7zip plugin.

Code:

#include <windows.h>#include <iostream>typedef int (__stdcall* PackFilesW_t)(const wchar_t* PackedFile, const wchar_t* SubPath, const wchar_t* SrcPath, const wchar_t* AddList, int Flags);int main() {// Path to the WCX file (Total Commander plugin)const wchar_t* wcxPath = L"path\\to\\yourplugin.wcx";// Load the DLL (WCX plugin)HMODULE hModule = LoadLibraryW(wcxPath);if (!hModule) {std::wcerr << L"Error: Unable to load the WCX plugin.\n";return 1;}// Get the pointer to the PackFilesW functionPackFilesW_t PackFilesW = (PackFilesW_t)GetProcAddress(hModule, "PackFilesW");if (!PackFilesW) {std::wcerr << L"Error: Unable to find the PackFilesW function.\n";FreeLibrary(hModule);return 1;}// Function parametersconst wchar_t* PackedFile = L"output.pack"; // Name of the compressed fileconst wchar_t* SubPath = L"";              // SubPath (empty for root)const wchar_t* SrcPath = L"path\\to\\source\\"; // Source folderwchar_t AddList[] = L"file1.txt\0file2.txt\0\0"; // File list terminated with double \0int Flags = 0;                             // Flags (0 = default)// Call the PackFilesW functionint result = PackFilesW(PackedFile, SubPath, SrcPath, AddList, Flags);// Check the resultif (result == 0) {std::wcout << L"Compression completed successfully.\n";} else {std::wcerr << L"Error during compression, code: " << result << L"\n";}// Release the DLLFreeLibrary(hModule);return 0;}

Statistics: Posted by Hurdet — 2024-12-21, 11:35 UTC



Viewing all articles
Browse latest Browse all 3823

Trending Articles