Edit on GitHub

Native Win32 API Interop

As #Script is a scripting language utilizing JS syntax to invoke .NET APIs, the Win 32 support ends up being both simple & intuitive.

Where it calls the CustomMethods.cs .NET Win 32 APIs (wrapped in a #Script method) directly from JS as done in App.ts which can be invoked using JS syntax using the evaluateCode TypeScript API, e.g:

import { evaluateCode } from '@servicestack/desktop';

await evaluateCode(`chooseColor()`);
await evaluateCode(`chooseColor('#336699')`);

The app dotnet tool already includes these dotnet/pinvoke .NET Wrapper API NuGet packages below so they can be used within your App without needing to distribute them with your App:

<PackageReference Include="PInvoke.AdvApi32" Version="0.7.78" />
<PackageReference Include="PInvoke.BCrypt" Version="0.7.78" />
<PackageReference Include="PInvoke.Crypt32" Version="0.7.78" />
<PackageReference Include="PInvoke.DwmApi" Version="0.7.78" />
<PackageReference Include="PInvoke.Gdi32" Version="0.7.78" />
<PackageReference Include="PInvoke.Hid" Version="0.7.78" />
<PackageReference Include="PInvoke.Kernel32" Version="0.7.78" />
<PackageReference Include="PInvoke.Magnification" Version="0.7.78" />
<PackageReference Include="PInvoke.MSCorEE" Version="0.7.78" />
<PackageReference Include="PInvoke.Msi" Version="0.7.78" />
<PackageReference Include="PInvoke.Fusion" Version="0.7.78" />
<PackageReference Include="PInvoke.NCrypt" Version="0.7.78" />
<PackageReference Include="PInvoke.NetApi32" Version="0.7.78" />
<PackageReference Include="PInvoke.NTDll" Version="0.7.78" />
<PackageReference Include="PInvoke.Psapi" Version="0.7.78" />
<PackageReference Include="PInvoke.SetupApi" Version="0.7.78" />
<PackageReference Include="PInvoke.Shell32" Version="0.7.78" />
<PackageReference Include="PInvoke.SHCore" Version="0.7.78" />
<PackageReference Include="PInvoke.User32" Version="0.7.78" />
<PackageReference Include="PInvoke.Userenv" Version="0.7.78" />
<PackageReference Include="PInvoke.UxTheme" Version="0.7.78" />
<PackageReference Include="PInvoke.WtsApi32" Version="0.7.78" />

See Win32 App for more info & examples on Win32 integration.

app://win32


Publishing Desktop Apps >