Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more: , +

Hi, 

I am in the process of building a windows service that uses the Quicktime COM control to access various movie (.mov) files. The purpose of using the control is to load the movie and take screen grabs from certain sections of the movie file.

The way the Quicktime control does this is to provide access to a method named CopyFrame(someFramelocation). This method places the frame into the clipboard so that it should be accessible via the IDataObject. The code i am about to go through works absolutely fine on my development machine which is a 64 bit install of Windows 7 with VS2008, .Net 3.5 SP1 running on it. 

However, it seems that it will not work on Windows Server 2008. As it is a service i installed VS2008 on the server to debug it easily. Please find the code below, any help would be greatly appreciated. 

Setting up the Quicktime control is done with the following code.  

AxQTControl _quickTimeControl = new AxQTOControlLib.AxQTControl();  

                    _quickTimeControl.Enabled = true; 

                    _quickTimeControl.Name = "axQTControl1"; 

                    this.Controls.Add(_quickTimeControl);   

                    _quickTimeControl.MovieControllerVisible = false; 

                    _quickTimeControl.URL = FileToProcess.FullName;

 Once the URL path is set the control automatically sets the controls movie property (which exposes the file specified by the URL). The movie property itself, which is of type QTMovie is read only. 

QTMovie theMovie = _quickTimeControl.Movie;

Now we have the movie (as long as it is not null) we can copy a frame to the clipboard with the following code: 

Clipboard.Clear(); 

theMovie.CopyFrame(15);

Ok, that about covers the Quicktime bit. Now the bit where i am having problems.

 // frame is now on the clipboard 

IDataObject data = Clipboard.GetDataObject();

if (data != null) Data is not null 

string[] test = data.GetFormats(true); Returns Array With Bitmap in it  

if (data.GetDataPresent(DataFormats.Bitmap))  Evaluates to True, so data is present and in the required format 

Image storyBoardImage = (Bitmap)data.GetData(DataFormats.Bitmap, true); 

The image above is always null. I have tried every way of getting data out of the GetData() method but nothing works. As i say this works fine on my dev machine 

If anyone can give me some advise as to how, even though all the checks for data and data types pass, the Getdata() method always returns null. This seems to just be a windows server 2008 issue - the code is identical to my dev machine, the movie files in question are the same, stored in the same network location.

This is driving me bonkers. 

Posted


You don't make it clear whether the code was also running as a windows service on your dev machine. You should understand that windows services on server 2008, vista and W7 all run in windows session 0, while the logged on user is running in session 1 (on xp and earlier the first logged on user was also in session 0). One ramification of this is that the windows service cannot normally display anything on the logged on users UI without some extra gymnastics. See this online training session for more info     http://channel9.msdn.com/learn/courses/Windows7/SessionIsolation/ .
 
Share this answer
 
Were you able to get the solution for this. I am also facing a similar problem
 
Share this answer
 
Comments
Kevinio 16-Sep-11 5:06am    
Hi, i'm sorry i'm afraid I didn't. Due to time considerations in getting something up and running and in production I had to do a bit of a hack work around - never good I know! Basically within our virtualisation farm I set up a low powered machine that was running a client OS - Win 7 in this case - whose only purpose was to run this service. The service has been running pretty much without a hitch since I put it live about a month after I initially asked this question and hence I have had no pressing reason to go back to it. I know during my attempts I tried on both server 2008 and server 2003 and had no look on either. If you are doing something similar to me with the QT control have you considered trying an alternative product such as FFMPEG? This was my going to be my first choice but as we were working with Apple Pro Res encoded content it was not possible. I don't think this suite uses the clipboard so you may not have the same problems.

Sorry I can't be of more help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900