Created
January 26, 2023 20:25
-
-
Save SelvinPL/0c2c1be7448646293a7d9d3b441cee96 to your computer and use it in GitHub Desktop.
SO75244656
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Runtime.InteropServices; | |
| using System; | |
| using System.Windows.Forms; | |
| // this guy stolen my code without credits https://www.codeproject.com/Articles/16310/How-to-Automate-Exporting-NET-Function-to-Unmanage | |
| using RGiesecke.DllExport; | |
| //<Project Sdk="Microsoft.NET.Sdk"> | |
| // <PropertyGroup> | |
| // <TargetFramework>net48</TargetFramework> | |
| // <PlatformTarget>x86</PlatformTarget> | |
| // </PropertyGroup> | |
| // <ItemGroup> | |
| // <PackageReference Include="UnmanagedExports.Repack.Upgrade" Version="1.2.1" /> | |
| // </ItemGroup> | |
| // <ItemGroup> | |
| // <Reference Include="System.Windows.Forms" /> | |
| // </ItemGroup> | |
| //</Project> | |
| namespace Rundll32Test | |
| { | |
| public static class NativeEntry | |
| { | |
| [DllExport("Test", CallingConvention = CallingConvention.StdCall)] | |
| public static void Test(IntPtr hwnd, IntPtr hinst, string cmdLine, int cmdShow) | |
| { | |
| MessageBox.Show(string.Format("HWND: {0}, HINST: {1}, CDMDSHOW: {3}\n{2}", hwnd, hinst, cmdLine, cmdShow)); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment