Capture activities on screen and save it in avi file

Hi All,

        I am working on a desktop application with
     Please help me that how i can capture activities on screen and to save it
     in a media file like avi.And after this i can play it in media player.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi bkniazi,
Try using Windows Media Encoder 9 Series, You have to play with its API to record everything
also see this link
bkniaziAuthor Commented:
Dear armoghan,
I want coding in to record and save activities on screen.such as mouse movements
writing in ms word and so on.And then i can open it in window media player.
Unfortunately, I dont have a ready made sample in VB.NET.
Actually only free software that has the ability to capture Movie is Windows Media Encorder
Its SDK is available. So i means that such kind of thing can be done using it.

The otherway is capture screen shorts with Mouse after specific intervals and save them as Bitmaps and then convert them in an AVI somehow..

Unfortunatley, both methods are difficult and only bits and pieces of code is available on Internet. But the better solution is using Windows Media Encorder.
You have to look into its SDK to do the desired thing.

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

bkniaziAuthor Commented:
Dear armoghan,
I do not require a software to do my task I am developing it myself.
So require some help in this area of VB.NET.
Sorry, probably i could not clear myself. thats is what I am trying to say is
The SDK below will help you write such code in VB.NET. But you have to look into it
bkniaziAuthor Commented:
Dear armoghan,
I am trying to use the window media encoder to complete this work
but if you send a small application in which can record activities on screen during
run time then i will be thankful....................

Ok see this code, It has been taken from the SDK's CHM file
under the heading "Using a Screen Capture as a Source" you can find it easily in C:\WMSDK\WMEncSDK9\wmencsdk.chm in search window
This can be further enhanced to the required thing.

' Declare objects and variables.
  Dim Encoder as WMEncoder
  Dim SrcGrpColl As IWMEncSourceGroupCollection
  Dim SrcGrp As IWMEncSourceGroup
  Dim SrcVid As IWMEncVideoSource

' Create a WMEncoder object.
  Set Encoder = New WMEncoder

' Retrieve a source group collection.
  Set SrcGrpColl = Encoder.SourceGroupCollection

' Create a source group called SG_1.
  Set SrcGrp = SrcGrpColl.Add("SG_1")

' Create a video source object and an audio source object.
  Set SrcVid = SrcGrp.AddSource(WMENC_VIDEO)

' Specify the screen capture plug-in to set up the video source.
  SrcVid.SetInput "ScreenCap://ScreenCapture1"
bkniaziAuthor Commented:
Dear armoghan,
 Thanks I have checked the sample of window media encoder which encode a previosely
saved media file so how i can capture the working on screen and at the end i can save it
in a media file.I think you will have understand my requirements.If not then you
can ask any time.Many Thanks for your help.
Ok I have placed the demo and src on
here is the link
bkniaziAuthor Commented:
any more help plz
bkniaziAuthor Commented:
Thanks ArmoghanAsif,
I am checking the application you posted now.
bkniaziAuthor Commented:
Hi Armoghan,
The application is working well but the colors and pictures of the
movie are not looking very good.
Please help for this problem.
bkniaziAuthor Commented:
Dear armoghan,
The problem in this application is that the windows media encoder must be
installed before running this project.
So is there any way that i did not install the windows media encoder and can run the
application Or any other way to complete this task.plz help.
Many thanks.
Ok for Color porblem
see such code commented in the src.
You have to find the approriate Profile and Attach it with SrcGrp

in this code
If Pro.Name = "Windows Media Video 8 for Local Area Network (384 Kbps)" Then
                SrcGrp.Profile = Pro
                Exit For
        End If

About the windows Media Instalation problem.
When you will make the setup of the project, you should include Media Encoder in it so that it installs first on the system.

Please ask all other questions on the Thread in Codeproject site at the bottom and close this question

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.