i like to have A Windows 10/11 Progressbar from Windows Shell API, specifically the IProgressDialog interface

but i have no Idea how to use Microsoft.WindowsAPICodePack or use the Windows SDK for it ?
Code: Select all | Expand
#include "FiveWin.ch"
FUNCTION Main()
Test()
RETURN NIL
#pragma BEGINDUMP
#include <windows.h>
#include <shlobj.h>
#include <hbapi.h>
void test( void )
{
CoInitialize(NULL);
IProgressDialog* pProgress;
HRESULT hr = CoCreateInstance(CLSID_ProgressDialog, NULL, CLSCTX_INPROC_SERVER, IID_IProgressDialog, (void**)&pProgress);
if (SUCCEEDED(hr))
{
pProgress->SetTitle(L"Copying file...");
pProgress->StartProgressDialog(NULL, NULL, PROGDLG_NORMAL, NULL);
for (ULONG i = 0; i <= 100; i++)
{
pProgress->SetProgress(i, 100);
Sleep(50);
}
pProgress->StopProgressDialog();
pProgress->Release();
}
CoUninitialize();
}
HB_FUNC( TEST )
{
test();
}
#pragma ENDDUMP
THX for the Sample.Antonio Linares wrote: Sun Apr 06, 2025 4:44 pm Here you have a working example.
To build it go to FWH\samples and modify buildh32.bat this way:
cl.exe -nologo -c -O2 -W4 -wd4127 /TP /I%hdir%\include %1.c
then do: buildh32.bat jimmy
i also have NO Folder called /TP/c:\fwh64\samples\Iprogress>cl.exe -nologo -c -O2 -W4 -wd4127 /TP /I\include pprogres.c
Der Befehl "cl.exe" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
i have Visual Studio Community 2022 installed, but there is NO CL.EXE on my PC (search using Everything) ?Antonio Linares wrote: Mon Apr 07, 2025 6:58 am cl.exe is the C/C++ compiler for Visual Studio.
You have to install Visual Studio Community 2022 with C/C++ support.
https://visualstudio.microsoft.com
Code: Select all | Expand
c:\fwh64\samples\Iprogress>"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64\cl.exe" -nologo -c -O2 -W4 -wd4127 /TP /I%hdir%\include pprogres.c pprogres.c
c:\harbour64\include\hbdefs.h(50): fatal error C1083: Datei (Include) kann nicht geöffnet werden: "stdarg.h": No such file or directory
c:\fwh64\samples\Iprogress>
can you please tell me WHERE (which line) you add Flag -TP in buildh64.bat ?Antonio Linares wrote: Tue Apr 08, 2025 10:58 am I just built it using FWH\samples\buildh64.bat and adding the flag -TP to cl.exe and worked fine on first try![]()
Code: Select all | Expand
cl -TP -W3 -O2 -c -I%hdir%\include -D_WIN64 -D__FLAT__ -I%fwdir%\include -I-I"%ProgramFiles(x86)%\Windows Kits"\10\Include\10.0.18362.0\ucrt %1.c
do i have wrong "Windows KIts" ?[vcvarsall.bat] Environment initialized for: 'x64'
Compiling...
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Compiling 'pprogres.prg' and generating preprocessed output to 'pprogres.ppo'...
Lines 5061, Functions/Procedures 1
Generating C source output to 'pprogres.c'... Done.
Microsoft (R) C/C++-Optimierungscompiler Version 19.43.34809 für x64
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
pprogres.c
c:\harbour64\include\hbdefs.h(51): fatal error C1083: Datei (Include) kann nicht geöffnet werden: "stdio.h": No such file or directory
LINK : fatal error LNK1181: Eingabedatei "pprogres.obj" kann nicht geöffnet werden.
* Linking errors *
c:\fwh64\samples\Iprogress>
Code: Select all | Expand
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
cl -TP -W3 -O2 -c -Ic:\harbour\include -D_WIN64 -D__FLAT__ -Ic:\fwh\include -I"%ProgramFiles(x86)%\Windows Kits"\10\Include\10.0.22621.0\ucrt\ pprogres.C
Code: Select all | Expand
link @msvc.tmp /nologo /subsystem:windows /NODEFAULTLIB:libucrt /NODEFAULTLIB:msvcrt