|
楼主 |
发表于 2013-10-14 17:38:04
|
显示全部楼层
我之前写的
[DllImport("shell32.dll")]
public static extern int ShellExecute(IntPtr hwnd, StringBuilder lpszOp, StringBuilder lpszFile, StringBuilder lpszParams, StringBuilder lpszDir, int FsShowCmd);
public static void openbp(string bpbh)
{
accessdata m_db = new accessdata();
DataSet ds_file = m_db.getdataset("select Fjnr,fjlx from gl_bp where Bpbh='" + bpbh + "'");
if (ds_file != null && ds_file.Tables[0].Rows.Count > 0)
{
Byte[] Files = (Byte[])ds_file.Tables[0].Rows[0]["Fjnr"];
if (Files.Length > 0)
{
string savePath = AppDomain.CurrentDomain.BaseDirectory;
savePath += "filetemporary" + ds_file.Tables[0].Rows[0]["fjlx"].ToString();
FileStream fs;
if (System.IO.File.Exists(savePath))
{
fs = new FileStream(savePath, FileMode.Truncate);
}
else
{
fs = new FileStream(savePath, FileMode.CreateNew);
}
BinaryWriter br = new BinaryWriter(fs);
br.Write(Files, 0, Files.Length);
br.Close();
fs.Close();
//System.Diagnostics.Process.Start(savePath);
ShellExecute(IntPtr.Zero, new StringBuilder("Open"), new StringBuilder(savePath), new StringBuilder(""), new StringBuilder(""), 0);
//WinExec(savePath, 0);
}
}
}
能够打开,但是0应该是隐藏,
我打开的效果确实。直接弹出暴风影音。
|
|