平台目标:anycpu 下是正常播放
如果是 x86 则报错 %1不是有效的 win32应用程序
private void vlcControl1_VlcLibDirectoryNeeded(object sender, VlcLibDirectoryNeededEventArgs e) {
var currentAssembly = Assembly.GetEntryAssembly();
var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
if (currentDirectory == null)
return;
if (AssemblyName.GetAssemblyName(currentAssembly.Location).ProcessorArchitecture == ProcessorArchitecture.X86)
e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"lib\x86\"));
else
e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"lib\x64\")); if (!e.VlcLibDirectory.Exists) {
var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
folderBrowserDialog.Description = "Select Vlc libraries folder.";
folderBrowserDialog.RootFolder = Environment.SpecialFolder.Desktop;
folderBrowserDialog.ShowNewFolderButton = true;
if (folderBrowserDialog.ShowDialog() == DialogResult.OK) {
e.VlcLibDirectory = new DirectoryInfo(folderBrowserDialog.SelectedPath);
}
}
}
x86 x64都有正常对应的目录
大神们帮帮忙 ,一共只有50分 全给了
如果是 x86 则报错 %1不是有效的 win32应用程序
private void vlcControl1_VlcLibDirectoryNeeded(object sender, VlcLibDirectoryNeededEventArgs e) {
var currentAssembly = Assembly.GetEntryAssembly();
var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
if (currentDirectory == null)
return;
if (AssemblyName.GetAssemblyName(currentAssembly.Location).ProcessorArchitecture == ProcessorArchitecture.X86)
e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"lib\x86\"));
else
e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"lib\x64\")); if (!e.VlcLibDirectory.Exists) {
var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
folderBrowserDialog.Description = "Select Vlc libraries folder.";
folderBrowserDialog.RootFolder = Environment.SpecialFolder.Desktop;
folderBrowserDialog.ShowNewFolderButton = true;
if (folderBrowserDialog.ShowDialog() == DialogResult.OK) {
e.VlcLibDirectory = new DirectoryInfo(folderBrowserDialog.SelectedPath);
}
}
}
x86 x64都有正常对应的目录
大神们帮帮忙 ,一共只有50分 全给了
解决方案 »
- 如何限制 textBox1 输入的仅为阿拉伯数字
- 一个项目,是不是可以理解为一个“命名空间”呀,因为命名空间的名字就是项目文件名呀?
- 下载MSDN的开源软件package this问题(两贴共80分)
- 本机没问题,上传到服务器就乱了?
- VS2008 GridView 显示日期字段怎样去掉时间?
- c#中将录入textbox的值通过Button传给listview
- 正则表达式的问题,谢谢大家帮忙了
- 在Datagrid中怎样让符合条件的某个单元格的字体显示红色?
- 关于windowsXP下连接数码相机后操作拍照的编成??
- com+注册问题
- listview中的问题
- c# 柱形图 只显示一根柱子,并且没有留白
ProcessorArchitecture也未必会返回ProcessorArchitecture.X86
这样将会使用x64的文件夹,从而报错
你可以使用Environment.Is64BitProcess试试
e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"lib\x86\"));已经进到这一步了,的确是86的 就是会出错。我怀疑 是不是 86的库有问题 还是哪里要设置什么 搞了2天了 没搞明白