简体   繁体   中英

converting c# code to powershell where it needs to consume dllimport

Say I have following c# code but now I need to convert to PowerShell. I got the DllImport piece but the c# code also has the static extern piece to it. Do I need to have same declaration in Powershell. If yes, could you guide me to correct syntax in powershell.

Thanks

[DllImport(@"C:\PDFConv\bin\Conv2PDF.dll", SetLastError = true)]
static extern UInt32 ProcessConv(UInt32 val, string lpSourcePath, String lpSourceFile, string lpDestPath, string lpDestFile);


private void btnConvert_Click(object sender, EventArgs e)
{            
  ProcessConv(1, "C:\\source", "test.docx", "C:\\dest\\pdf", "test.pdf");
}

除了Lee Holmes博客CB提到的内容外,请查看有关Add-Type的帮助,特别是示例5。

man Add-Type -Examples

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM