簡體   English   中英

將C#代碼轉換為需要消耗dllimport的powershell

[英]converting c# code to powershell where it needs to consume dllimport

說我有以下c#代碼,但現在我需要轉換為PowerShell。 我得到了DllImport片段,但C#代碼也具有靜態外部片段。 我是否需要在Powershell中具有相同的聲明。 如果是的話,您能指導我在Powershell中更正語法嗎?

謝謝

[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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM