CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

View: 2975|Reply: 10

My 12 Weeks for C# & .NET Project! Guide me please?

[Copy link]
Post time 6-9-2006 05:12 PM | Show all posts |Read mode
Im a 3rd year student at Nanyang Polytechnic in Singapore.

Now i was given 12 weeks to finished a project, using C# and Visual Studio 2005 (And Later DirectX - DirectShow, for audio and video processing)

My project now is to:

1st Objective - develop/build a software that can capture video live from webcam and playback audio from an audio file

after im able to do this

i need to

To be frank, i never learn C# and dont know what the heck is .NET, so i need you guys help.

I will be available from 8.30am to 6pm from Mon to Friday.

i really need ya help... in guiding me, please.

today i will go library to lend a book about C# and Visual Studio.

i know about this websites http://www.codeproject.com, is there anywhere relevant that i can read on.

omgd, this project is sooooo hard! i never do programmign before except knowing some basic languages of Java, C++ and C Programming. And whats more, im no good at all at programming.

Help. Thank alot!

if you interested in my ym or msn, please PM me.
Reply

Use magic Report


ADVERTISEMENT


Post time 7-9-2006 11:37 AM | Show all posts
try this site for starters, it's a beginner's guide to C# and .NET.

If you have experience in Java, you will find that C# is essentially Microsoft's .NET version of Java :bgrin:

http://msdn.microsoft.com/vstudi ... arning/default.aspx

Programming is not the key to completing your project. C# is merely a programming tool. Plan your 12 weeks ahead and set goals in achieving your problem. Use the "divide and conquer" concept, break down your problem into little ones.

Let me know if u need help. My ym is [email protected]
Reply

Use magic Report

 Author| Post time 7-9-2006 02:48 PM | Show all posts
finally, thanks shahnazz..

i will add you in MSN...

my mail [email protected] anyway...
Reply

Use magic Report

Post time 7-9-2006 06:02 PM | Show all posts
hahaha mengambil kesempatan nmpk..
karang aku pon terikut-ikut..lol

[ Last edited by  poyoex at 7-9-2006 06:18 PM ]
Reply

Use magic Report

 Author| Post time 7-9-2006 07:44 PM | Show all posts
maksud kau?
Reply

Use magic Report

Post time 8-9-2006 03:45 PM | Show all posts
for your webcam... find any programming api / DLL which would let you interact with the webcam.. read it and plan how you're going to capture the video feed.

for audio, not sure but i think you can use some already-available APIs within Windows / .NET to play audio files.

good luck. 12 weeks... not much time really... considering your situation... all the best!!! anything just ask and i'll just guide you loosely cause my background is more low-level C than Windows API.
Reply

Use magic Report

Follow Us
 Author| Post time 9-9-2006 03:53 PM | Show all posts
thanks boyan, do you have yahoo or msn?

anw.. ive read all directshow, directx, c# basic, and start to play around with visual studio 2005, but just that i dont know how to start... those source code povided..i dont know how to make use of it..
Reply

Use magic Report

Post time 10-9-2006 12:57 AM | Show all posts
just concentrate with video capture first. or, i think, it would be much simpler to play audio files. for a shortcut just integrate windows media player into your application, i guess.

how's your progress coming along?

[ Last edited by  shahnazz at 10-9-2006 12:58 AM ]
Reply

Use magic Report


ADVERTISEMENT


Post time 10-9-2006 01:04 AM | Show all posts
i'm sure you are referring to this web site:

http://www.codeproject.com/cs/media/directxcapture.asp

the source code is already there. i haven't had the time to try and compile / run the application, furthermore i don't have a webcam so i can't really test out. but since everything is there already, i guess u just need a brush-up on C#.

remember, if u are already coversant with C++ and Java, u are read for C#. some terms u need to remember (namespaces, collections, etc... which are specific to .NET and C#)

need any help, let us know :bgrin:
Reply

Use magic Report

 Author| Post time 10-9-2006 09:13 PM | Show all posts
thanks alot guys, as for now, ive been reading lots of website..
that link u post shahnazz veyr usefull, i might consider using it as  a base..
as for now.. i will read more about it...
Reply

Use magic Report

 Author| Post time 12-9-2006 12:37 PM | Show all posts
i got this problems.. see the code below.

Form1.cs

using System;
using System.Windows.Forms;
using QuartzTypeLib;


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

        // Define constants used for specifying the window style.
        private const int WS_CHILD = 0x40000000;
        private const int WS_CLIPCHILDREN = 0x2000000;

        // Hold a form-level reference to the media control interface,
        // so the code can control playback of the currently loaded
        // movie.
        private IMediaControl mc = null;

        // Hold a form-level reference to the video window in case it
        // needs to be resized.
        private IVideoWindow videoWindow = null;

        private void button1_Click(object sender, EventArgs e)
        {
            // Allow the user to choose a file.
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter =
            "Media Files|*.mpg;*.avi;*.wma;*.mov;*.wav;*.mp2;*.mp3|" +
            "All Files|*.*";

            if (DialogResult.OK == openFileDialog.ShowDialog())
            {
                // Stop the playback for the current movie, if it exists.
                //if (mc != null) mc.Stop();

                // Load the movie file.
                FilgraphManager graphManager = new FilgraphManager();
                graphManager.RenderFile(openFileDialog.FileName);

                // Attach the view to a picture box on the form.
                try
                {
                    videoWindow = (IVideoWindow)graphManager;
                    videoWindow.Owner = (int)pictureBox1.Handle;
                    videoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
                    videoWindow.SetWindowPosition(
                      pictureBox1.ClientRectangle.Left,
                      pictureBox1.ClientRectangle.Top,
                      pictureBox1.ClientRectangle.Width,
                      pictureBox1.ClientRectangle.Height);
                }
                catch
                {
                    // An error can occur if the file does not have a video
                    // source (for example, an MP3 file.)
                    // You can ignore this error and still allow playback to
                    // continue (without any visualization).
                }

                // Start the playback (asynchronously).
                mc = (IMediaControl)graphManager;
                mc.Run();
            }
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            if (videoWindow != null)
            {
                try
                {
                    videoWindow.SetWindowPosition(
                        pictureBox1.ClientRectangle.Left,
                        pictureBox1.ClientRectangle.Top,
                        pictureBox1.ClientRectangle.Width,
                        pictureBox1.ClientRectangle.Height);
                }
                catch
                {
                    // Ignore the exception thrown when resizing the form
                    // when the file does not have a video source.
                }
            }
        }

        //Button to exit an application
        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        //Button to stop a video file
        private void button3_Click(object sender, EventArgs e)
        {
            if (mc != null) mc.Stop();
        }

        //Button to play a video file
        private void button4_Click(object sender, EventArgs e)
        {
            if (mc != null) mc.Run();
        }

        //Button for user to choose an audio file
        private void button5_Click(object sender, EventArgs e)
        {
            // Allow the user to choose a file.
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "Media Files|*.wav;*.mp3;*.mp2;*.wma|All Files|*.*";

            if (DialogResult.OK == openFileDialog.ShowDialog())
            {
                // Access the IMediaControl interface.
                QuartzTypeLib.FilgraphManager graphManager =
                  new QuartzTypeLib.FilgraphManager();
                QuartzTypeLib.IMediaControl mc =
                  (QuartzTypeLib.IMediaControl)graphManager;

                // Specify the file.
                mc.RenderFile(openFileDialog.FileName);

                // Start playing the audio asynchronously.
                mc.Run();
            }
        
        }

        //Label at the top most of the program
        private void label1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Audio Integrated Therapy (AIT) Device for Authistic");
        }
        
    }

}


And also, when i click on the Audio button to play an audio file, it gives me this error:-

COMException was Unhandled

System.Runtime.InteropServices.COMException was unhandled
  Message="Exception from HRESULT: 0x80040256"
  Source="Interop.QuartzTypeLib"
  ErrorCode=-2147220906
  StackTrace:
       at QuartzTypeLib.FilgraphManagerClass.RenderFile(String strFilename)
       at MovieShow.Form1.button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\Student\My Documents\Mohammed Rizal\MovieShow\MovieShow\Form1.cs:line 43
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
       at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.set_Visible(Boolean value)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at MovieShow.Program.Main() in C:\Documents and Settings\Student\My Documents\Mohammed Rizal\MovieShow\MovieShow\Program.cs:line 17
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

[ Last edited by  sLapshock at 12-9-2006 05:58 PM ]
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT


Forum Hot Topic

 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

28-12-2024 11:11 PM GMT+8 , Processed in 0.068718 second(s), 25 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list