我下载了一个C#拍照的程序,C/S结构的,大小始终是640*480无法修改 如题,如何修改呢,是不是要改dll文件 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 源代码我有,可是里面调用了DLL文件,我在源代码中改了半天也不起作用,根本找不到640*480,是不是封装到DLL中了? [DllImport("avicap32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] public static extern int capCreateCaptureWindowA([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszWindowName, int dwStyle, int x, int y, int nWidth, short nHeight, int hWndParent, int nID); [DllImport("avicap32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] public static extern bool capGetDriverDescriptionA(short wDriver, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszName, int cbName, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszVer, int cbVer); [DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] public static extern bool DestroyWindow(int hndw); [DllImport("user32", EntryPoint = "SendMessageA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] public static extern int SendMessage(int hwnd, int wMsg, int wParam, [MarshalAs(UnmanagedType.AsAny)] object lParam); [DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] public static extern int SetWindowPos(int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags); [DllImport("vfw32.dll")] public static extern string capVideoStreamCallback(int hwnd, videohdr_tag videohdr_tag); [DllImport("vicap32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] public static extern bool capSetCallbackOnFrame(int hwnd, string s);private void OpenCapture() { int intWidth = this.panel_Vedio.Width; int intHeight = this.panel_Vedio.Height; int intDevice = 0; string refDevice = intDevice.ToString(); hHwnd = Frm_Main.capCreateCaptureWindowA(ref refDevice, 1342177280, 0, 0, 640, 480, this.panel_Vedio.Handle.ToInt32(), 0); this.LbSysMsg.Text = ""; //this.LbSysMsg.Text += "驱动:" + refDevice; if (Frm_Main.SendMessage(hHwnd, 0x40a, intDevice, 0) > 0) { Frm_Main.SendMessage(this.hHwnd, 0x435, -1, 0); Frm_Main.SendMessage(this.hHwnd, 0x434, 0x42, 0); Frm_Main.SendMessage(this.hHwnd, 0x432, -1, 0); Frm_Main.SetWindowPos(this.hHwnd, 1, 0, 0, intWidth, intHeight, 6); this.BtnCapTure.Enabled = false; this.BtnPhoto.Enabled = true;//拍照可用 this.BtnStop.Enabled = true; } else { Frm_Main.DestroyWindow(this.hHwnd); this.BtnCapTure.Enabled = false; this.BtnPhoto.Enabled = false;//拍照不可用 this.BtnStop.Enabled = true; } } hHwnd = Frm_Main.capCreateCaptureWindowA(ref refDevice, 1342177280, 0, 0, 640, 480, this.panel_Vedio.Handle.ToInt32(), 0);640 480 是的,没有效果,它拍照好象调用的是dll,无论你设多大,照片始终是640*480 调用webService,获取DataSet,报"无法创建目录或文件" C#中类似快捷键的.cs类文件是怎么创建的 【老大们帮忙】C#POST到网络问题 时间序列分析模型预测 母公司与子公司之间的数据问题?? LonControl 问题? 谢谢 求解,如何实现usb摄像头的热插拔 c#中 如何实现日历的选取 在form2里 点击添加按钮,添加数据并且刷新form1中的datagridview 请教异常处理的方法,在线等待。 C#小数与倒数的区别 怎么用textbox控件控制复制richtextbox中文本条数
public static extern int capCreateCaptureWindowA([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszWindowName, int dwStyle, int x, int y, int nWidth, short nHeight, int hWndParent, int nID);
[DllImport("avicap32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern bool capGetDriverDescriptionA(short wDriver, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszName, int cbName, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszVer, int cbVer);
[DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern bool DestroyWindow(int hndw);
[DllImport("user32", EntryPoint = "SendMessageA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int SendMessage(int hwnd, int wMsg, int wParam, [MarshalAs(UnmanagedType.AsAny)] object lParam);
[DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int SetWindowPos(int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
[DllImport("vfw32.dll")]
public static extern string capVideoStreamCallback(int hwnd, videohdr_tag videohdr_tag);
[DllImport("vicap32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern bool capSetCallbackOnFrame(int hwnd, string s);
private void OpenCapture()
{
int intWidth = this.panel_Vedio.Width;
int intHeight = this.panel_Vedio.Height;
int intDevice = 0;
string refDevice = intDevice.ToString();
hHwnd = Frm_Main.capCreateCaptureWindowA(ref refDevice, 1342177280, 0, 0, 640, 480, this.panel_Vedio.Handle.ToInt32(), 0);
this.LbSysMsg.Text = "";
//this.LbSysMsg.Text += "驱动:" + refDevice;
if (Frm_Main.SendMessage(hHwnd, 0x40a, intDevice, 0) > 0)
{
Frm_Main.SendMessage(this.hHwnd, 0x435, -1, 0);
Frm_Main.SendMessage(this.hHwnd, 0x434, 0x42, 0);
Frm_Main.SendMessage(this.hHwnd, 0x432, -1, 0);
Frm_Main.SetWindowPos(this.hHwnd, 1, 0, 0, intWidth, intHeight, 6);
this.BtnCapTure.Enabled = false;
this.BtnPhoto.Enabled = true;//拍照可用
this.BtnStop.Enabled = true;
}
else
{
Frm_Main.DestroyWindow(this.hHwnd);
this.BtnCapTure.Enabled = false;
this.BtnPhoto.Enabled = false;//拍照不可用
this.BtnStop.Enabled = true;
}
}