2017-08-26 1 views
2

'%1は有効なWin32アプリケーションではありません':
のVisual Studio 2017
32ビットVLCのバージョン2.2を使用して任意のCPU
のためのNETフレームワーク3.5
建物使用Vlc.DotNetを使用して0.6
(私はそれがどのNETフレームワークに取り組んでいるだけだと思う​​ので...)VLC.DotNet System.ComponentModel.Win32Exception:での作業

私はどのようにこのライブラリの動作(または動作するかどうか)、単にテストのための新しいフォームを作成し
「VlcControl」と1つのボタンのドラッグ&ドロップ方法
すべてのコードは以下の通りです:

Form.cs:

using System; 
using System.IO; 
using System.Windows.Forms; 

namespace WindowsFormsApp2 
{ 
    public partial class Form1 : Form 
    { 
     public Form1() 
     { 
      InitializeComponent(); 
     } 

     private void button1_Click(object sender, EventArgs e) 
     { 
      OpenFileDialog ofd = new OpenFileDialog 
      { 
       Filter = "(*.mp4) | *.mp4" 
      }; 

      if (ofd.ShowDialog() == DialogResult.OK) 
      { 
       vlcControl1.SetMedia(new FileInfo(Path.GetFileName(ofd.FileName))); 
       vlcControl1.Play(); 
      } 
     } 
    } 
} 

Form.Designer.cs(生成)

namespace WindowsFormsApp2 
{ 
    partial class Form1 
    { 
     /// <summary> 
     /// Required designer variable. 
     /// </summary> 
     private System.ComponentModel.IContainer components = null; 

     /// <summary> 
     /// Clean up any resources being used. 
     /// </summary> 
     /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 
     protected override void Dispose(bool disposing) 
     { 
      if (disposing && (components != null)) 
      { 
       components.Dispose(); 
      } 
      base.Dispose(disposing); 
     } 

     #region Windows Form Designer generated code 

     /// <summary> 
     /// Required method for Designer support - do not modify 
     /// the contents of this method with the code editor. 
     /// </summary> 
     private void InitializeComponent() 
     { 
      this.button1 = new System.Windows.Forms.Button(); 
      this.vlcControl1 = new Vlc.DotNet.Forms.VlcControl(); 
      ((System.ComponentModel.ISupportInitialize)(this.vlcControl1)).BeginInit(); 
      this.SuspendLayout(); 
      // 
      // button1 
      // 
      this.button1.Location = new System.Drawing.Point(12, 255); 
      this.button1.Name = "button1"; 
      this.button1.Size = new System.Drawing.Size(260, 42); 
      this.button1.TabIndex = 1; 
      this.button1.Text = "button1"; 
      this.button1.UseVisualStyleBackColor = true; 
      this.button1.Click += new System.EventHandler(this.button1_Click); 
      // 
      // vlcControl1 
      // 
      this.vlcControl1.BackColor = System.Drawing.Color.Black; 
      this.vlcControl1.Location = new System.Drawing.Point(12, 12); 
      this.vlcControl1.Name = "vlcControl1"; 
      this.vlcControl1.Size = new System.Drawing.Size(260, 237); 
      this.vlcControl1.Spu = -1; 
      this.vlcControl1.TabIndex = 2; 
      this.vlcControl1.Text = "vlcControl1"; 
      this.vlcControl1.VlcLibDirectory = new System.IO.DirectoryInfo("C:\\Program Files (x86)\\VideoLAN\\VLC"); 
      this.vlcControl1.VlcMediaplayerOptions = null; 
      // 
      // Form1 
      // 
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 
      this.ClientSize = new System.Drawing.Size(284, 309); 
      this.Controls.Add(this.vlcControl1); 
      this.Controls.Add(this.button1); 
      this.Name = "Form1"; 
      this.Text = "Form1"; 
      ((System.ComponentModel.ISupportInitialize)(this.vlcControl1)).EndInit(); 
      this.ResumeLayout(false); 
     } 

     #endregion 
     private System.Windows.Forms.Button button1; 
     private Vlc.DotNet.Forms.VlcControl vlcControl1; 
    } 
} 

using System; 
using System.Windows.Forms; 

namespace WindowsFormsApp2 
{ 
    static class Program 
    { 
     [STAThread] 
     static void Main() 
     { 
      Application.EnableVisualStyles(); 
      Application.SetCompatibleTextRenderingDefault(false); 
      Application.Run(new Form1()); 
     } 
    } 
} 

Program.csの

今すぐ質問is:

ファイルで

:Form.Designer.cs

とライン:。 "のInitializeComponent()"、プログラムがクラッシュを呼び出した後

((System.ComponentModel.ISupportInitialize)(this.vlcControl1))EndInit( );

System.ComponentModel.Win32Exceptionをスロー: '% 1は有効なWin32アプリケーションではありません'

を私はそれを修正するにはどうすればよいです?

+0

"32ビットVLCを使用する"と設定します。これはAnyCPUではなく、x86です。任意のCPU に設定 –

+0

オプションは、私はすでにx86の(それはすでにプログラムファイルに設定されています...デザイナーを見るすでにすべての64ビットのVLCが唯一の実験的なことを知っている...このアプリはハズレためVLC –

答えて

1

プロジェクト - >プロパティ - >ビルド - >プラットフォームターゲット= x86

+0

のx86のだろうことを知っています)...(エイリアス32ビット)... –

+0

プロジェクトのビルド設定でPlatform Target = x86プロパティを設定してみてください。 – MakS

+0

ありがとう@MakS ...それはうまくいく...問題解決済み... –

関連する問題