|
I'm writing a program that tracks a moving objects in a mpeg file. I'm using AForge.net. I'm new to c# and programming. I cannot get to play the video. For right now I want to play the video in a picture box and cature new and old video frame to compare the movements. Here is my code so far that does not work.
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
How do I get to play the video in the picture box?? }
private void button1_Click(object sender, EventArgs e)
{
videoSource = new FileVideoSource(videoFile);
//videoSource.
//videoSource.NewFrame += new AForge.Video.NewFrameEventHandler(video_NewFrame);
videoSource.Start();
}
private void video_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs)
{
Bitmap bitmap = eventArgs.Frame;
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
openFileDialog.Filter = "Video (.mpeg)|*.mpeg|(.avi)|*.avi|ALL Files (*.*)|*.*";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
videoFile = openFileDialog.FileName;
}
}
Help anyone please:kathsunil
Posts: 1
Joined: Wed Feb 18, 2009 11:56 am
Private message
|
|
|
|
|
|
helo... am too working on the same kind od project... and my project has a windows service whicl listens the client requests on a port and then sends the messages to the client.
the client has a form which has a login mod which when provided with the user and password it sends to the server and authenticates at the server and then sends back the result.
and the client also secretly monitors the websites and the applcations visited by the user and sends the activity to the server at a fixed duration and the server logs in the data in to a db.
it will b completed within 5 or 6 days.. and regarding the udp connection you have used are you deploying the sys in LAN or INTERNET ? if its in lan then tcp type of connection is recommeneded, ... request if any help needed.... bye
|
|
|
|
|
|
I'm not sure what you've got at the moment, but you could use something like:
Process proc = Process.Start("Stuff");<br />
proc.MainWindowHandle ...
maybe you can find something useful in proc.MainModule and proc.Modules
And if not, there's always FindWindow[^] and FindWindowEx[^] which should let you grab the windows your looking for.
EDIT: And conveniently, I think the question below has some code that uses FindWindowEx so if your unsure on how to use it, there it is.
My current favourite word is: Delicious!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
I don't have the titles for the child windows or their class names to use find window ex.How I recieved the child window that I have a handle to I used enum child windows.
|
|
|
|
|
Hi
Ok so i have only been playing with C# for 1 day, so it's probably just me who can't get it to work.
It's a very small program to take 3 inputs (a string, a number and a selected process name) then input the string a number of times into the selected process. For testing i have Notepad open and the application name is "a.txt - Notepad"
Now my problem is that it works perfectly if i simply put "a.txt - Notepad" into the code. But if i do
String a = "a.txt - Notepad"
and then proc.MainWindowTitle == a then it doesn't work
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
using System.Collections;
namespace ting
{
public partial class frmMain : Form
{
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
[DllImport("User32.Dll", EntryPoint = "PostMessageA")]
static extern bool PostMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
[DllImport("user32.dll")]
static extern byte VkKeyScan(char ch);
public frmMain()
{
InitializeComponent();
comboBox1.DataSource = ProcessValidation.ListAllApplications();
}
private void Form1_Load(object sender, EventArgs e) { }
private void StartButtonClick(object sender, EventArgs e)
{
const uint WM_KEYDOWN = 0x100;
string text = txtText.Text;
string tidx = txtTime.Text;
if (tidx == "") tidx = "1";
int tid = int.Parse(tidx);
string windowTitle = (string)comboBox1.SelectedItem;
//MessageBox.Show(windowTitle + "a.txt - Notepad");
Process[] procs = Process.GetProcessesByName("Notepad");
foreach (Process proc in procs)
{
MessageBox.Show(windowTitle);
if (proc.MainWindowTitle == windowTitle)//"a.txt - Notepad")
{
// get handle to Notepad's edit window
IntPtr hWnd = FindWindowEx(proc.MainWindowHandle, IntPtr.Zero, "edit", null);
for (int i = 0; i < tid; i++)
{
for (int z = 0; z < text.Length; z++)
{
PostMessage(hWnd, WM_KEYDOWN, VkKeyScan(text[z]), 0);
}
// Thread.Sleep(11000);
}
break;
}
}
}
private void closeButtonClick(object sender, EventArgs e)
{
this.Close();
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
Show();
WindowState = FormWindowState.Normal;
}
private void frmMain_Resize(object sender, EventArgs e)
{
if (FormWindowState.Minimized == WindowState)
Hide();
}
}
}
ProcessList.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Management;
using System.ComponentModel;
using System.Diagnostics;
using System.Collections;
namespace ting
{
public static class ProcessList
{
public static ArrayList ListAllApplications()
{
StringBuilder sb = new StringBuilder();
ArrayList a = new ArrayList();
foreach (Process p in Process.GetProcesses("."))
{
try
{
if (p.MainWindowTitle.Length > 0)
{
a.Add(p.MainWindowTitle.ToString() + Environment.NewLine);
}
}
catch { }
}
return a;
}
}
}
Form1.designer.cs
namespace ting
{
partial class frmMain
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///
/// <param name="disposing" />true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
this.btnStart = new System.Windows.Forms.Button();
this.btnClose = new System.Windows.Forms.Button();
this.txtText = new System.Windows.Forms.TextBox();
this.txtTime = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.panel1 = new System.Windows.Forms.Panel();
this.processValidationBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.processValidationBindingSource)).BeginInit();
this.SuspendLayout();
//
// btnStart
//
this.btnStart.Location = new System.Drawing.Point(16, 16);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(75, 23);
this.btnStart.TabIndex = 0;
this.btnStart.Text = "Start";
this.btnStart.UseVisualStyleBackColor = true;
this.btnStart.Click += new System.EventHandler(this.StartButtonClick);
//
// btnClose
//
this.btnClose.Location = new System.Drawing.Point(178, 16);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(75, 23);
this.btnClose.TabIndex = 1;
this.btnClose.Text = "Luk";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.closeButtonClick);
//
// txtText
//
this.txtText.BackColor = System.Drawing.SystemColors.Menu;
this.txtText.Location = new System.Drawing.Point(16, 75);
this.txtText.Name = "txtText";
this.txtText.Size = new System.Drawing.Size(100, 20);
this.txtText.TabIndex = 2;
//
// txtTime
//
this.txtTime.BackColor = System.Drawing.SystemColors.MenuBar;
this.txtTime.Location = new System.Drawing.Point(153, 75);
this.txtTime.Name = "txtTime";
this.txtTime.Size = new System.Drawing.Size(100, 20);
this.txtTime.TabIndex = 3;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(5, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(28, 13);
this.label1.TabIndex = 5;
this.label1.Text = "Text";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(142, 12);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(22, 13);
this.label2.TabIndex = 6;
this.label2.Text = "Tid";
//
// notifyIcon1
//
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Text = "KillerApp 1.0";
this.notifyIcon1.Visible = true;
this.notifyIcon1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseDoubleClick);
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(16, 130);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(237, 21);
this.comboBox1.TabIndex = 11;
//
// panel1
//
this.panel1.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.label2);
this.panel1.Location = new System.Drawing.Point(6, 45);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(255, 256);
this.panel1.TabIndex = 12;
//
// processValidationBindingSource
//
this.processValidationBindingSource.DataSource = typeof(ting.ProcessList);
//
// frmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(269, 313);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.txtTime);
this.Controls.Add(this.txtText);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.btnStart);
this.Controls.Add(this.panel1);
this.Name = "frmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Kims Killer App";
this.Load += new System.EventHandler(this.Form1_Load);
this.Resize += new System.EventHandler(this.frmMain_Resize);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.processValidationBindingSource)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.TextBox txtText;
private System.Windows.Forms.TextBox txtTime;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.BindingSource processValidationBindingSource;
private System.Windows.Forms.Panel panel1;
}
}
|
|
|
|
|
Might the string include a newline or some extra spaces in the combobox ? You could try using the Trim() method or looking at the value in the debugger. Or you could use .Contains instead of ==
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
put breakpoint on that comparision line then you will be able to know what proc.MainWindowTitle hold...
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I writing some application that in some point in my application i need to check something in the microsoft outlook.
I found that to do it i need to use Microsoft Interop Outlook ( Microsoft.Office.Interop.Outlook) and when office 2007 is install on the machine its not this Interop assembly exist in the GAC -
But i want also to give the user the option to use my application when he have office 2003 on his machine. In this case i don't have this assemble in the GAC and i don't know how to solve this problem ( how to install this interop and how to create this interop that will match office 2003 ).
|
|
|
|
|
You probably interop with 2003 using COM
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Yes, as i said before ... i need to interop with 2003.
I need to use COM - but to use this interop in C#.
How to do it ... ?
|
|
|
|
|
You would have to search the web for docs on the COM object in Outlook 2003. But, as for the steps, you'd install Outlook 2003 and create a reference to it's COM object in your project.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Add a reference to your project using Browse to MSOutl.olb . The default location for that file is C:\Program Files\Microsoft Office\Office11 .
After that you should be able to use Outlooks object model[^].
You may also find this[^] useful.
|
|
|
|
|
I had one of my apps installed on a Vista machine the other day for the first time. Had a lot of issues but ultimatly it turned out to be that I had to go to properties of the exe and choose Unblock. Then everything worked fine.
Since this is the first time I've installed on Vista I'm wondering if this is a known issue..if so is there documentation somewhere to work around this.
My app and the install package were built with VS2008 it is a C# app targeting dotNet Framework 2.0
I have installed this on hundreds of XP/2k machines and never seen this before.
tia
Rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
modified on Saturday, February 21, 2009 3:04 PM
|
|
|
|
|
I don't believe there is a way around the vista protection short of turning it off completely. vista is crap. =\
|
|
|
|
|
Apps get blocked if they come from a memory stick, or from the web. If you install them with an msi, this will not happen. But yes, I do agree with the other poster that Vista sucks.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
This was from a msi with a setup.exe made by VS 2008 setput project.
I'm afraid I don't have control over the vista box's. As leases are running out that's what the PC's are being replaced with. I'm just glad I found confirmation and a work around this fast!!
thanks
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Hi all,
I am trying to type text in text box using following statement
ie.TextField(Find.ByName("USER")).Value="username";
when i tried this iam getting an exception--
"Could not find INPUT (text password textarea hidden) or TEXTAREA element tag matching criteria"
also i tried "ie.TextField(Find.ByName("USER")).Typetext" but in vain
How to resolve this problem ...please help me out
Thanx in advance
|
|
|
|
|
|
Oh Thanks
|
|
|
|
|
Hello,
How do you create a program that has ability to run a bit of code only when the program first executes and then ignores it all subsequent times?
Many thanks.
Andy.
|
|
|
|
|
Keep track of whether the program has executed the code (by saving this piece of information in a config/ini file or the registry, for example).
/ravi
|
|
|
|
|
Hello!
I need code in C# to crypt data in RC2, DES or Rijndael algorythm.
Please, don't offer me realisation based on standart (built-in) .NET methods
|
|
|
|
|
_c2h5oh_ wrote: Please, don't offer me realisation based on standart (built-in) .NET methods
Why not?
/ravi
|
|
|
|