PDA

View Full Version : Running CCE from Delphi


migor
3rd October 2002, 20:38
Here is Delphi6 component for executing CCE encoder.It not uses button pushing and CCEs menus, so it reliable and not depends of opening-closing another windows.
Was tested with CCESP 2.5 and CCESP 2.66 beta in Win2000 and WinXP.
Certainly, it can be improved, but it is working. May be, someone can find it useful.

See new thread http://forum.doom9.org/showthread.php?s=&threadid=36997

MattO
3rd October 2002, 21:50
Where?

as I am really interested in seeing this.

Please try attaching again ;)

migor
3rd October 2002, 21:59
I'm trying attach the file...
If it will be unseccessful again, drop e-mail to me.

MattO
5th October 2002, 18:17
Michael

I only have Delphi 3.

Your CCERun compiles OK, but when run it gives a Shell32.dll error.

can you help?

MattO

migor
5th October 2002, 21:20
OK, Matto !

Thank you for the test. Your result not dpend on the version of Delphi, not version specific function are used. I found, that this problem exists only in Win98-WinME, but component was not tested in Win98 before. Now I see, that here is a bug.
I will try to fix it.
Michael.

migor
5th October 2002, 22:06
It seems, that I have fixed the bug. It was just a timing error.
CCE processed a variable after it had been destroyed.
Here is fixed version.

The change is in the function TM_RunCCE.RunCCE(const FileName : string): Boolean;

WAS:
if Drop <> 0 then PostMessage(wnd, wm_DropFiles, Drop, 0);
GlobalFree(Drop);
Sleep(1000);
NOW:
if Drop <> 0 then PostMessage(wnd, wm_DropFiles, Drop, 0);
Sleep(1000); //Gives enough time to CCE for file acception
GlobalFree(Drop);

Michael.

layer3maniac
7th October 2002, 07:16
VERY cool, migor! I use Delphi 3 myself because it makes MUCH smaller executables than Delphi 6. This might be a very useful component... Thanks!

migor
11th October 2002, 21:19
An improved version of the component.

Changes:

1. LinkMemo property was removed.
2. Four events were added:
OnNoSourceFound
OnSourceCheck
OnFileStarted
OnFileEncoded
and some minor changes.
Help file included.
Michael.

MattO
12th October 2002, 11:06
migor

please try attaching it again ;)

thanks

MattO

migor
12th October 2002, 15:58
The new attachment appeared!

mmgrover
16th October 2002, 20:29
Has anybody figured a way to close the "Save ECL" message box that comes up when a avs file is dropped in?






mike

mmgrover
18th October 2002, 02:31
Hi guys...

I was playing around at work today and added code to this project
to close the SaveDialog for ecl files so it doesn't prompt you.

I hav'nt had a chance to test it much yet :-(


mike

migor
18th October 2002, 09:12
I have found the solution too, but still need some work yet. I want add a simple error handling event.I will publish this code, and it's very interesting to see your way, what is the difference.Will you publish it?

Michael.:)

mmgrover
18th October 2002, 12:56
Mine was attached to the message, but it didn't show up?

I can put it on my ftp dir?


mike

migor
18th October 2002, 17:54
Mike, I beleive that your attachment will appear tomorrow. I have same
problem, but all my attachments are here finally!

Michael

mmgrover
18th October 2002, 19:02
It's Showing up now :-)


mike

migor
19th October 2002, 21:30
Mike,

I have seen your code, and it work well.
You have a nice solution to close the dialog box. In my opinion, however, the CCEDialogTitle is an unnecessary parameter. This dialog is a top-level modal window and therefore I think that it can be found in this way: Wnd := GetNextWindow(FCCEhandle,GW_HWNDPREV).

I have been working on improving the code and here are the changes I made:
1. WinExec() has been replaced by CreateProcess() and PostMessage() is used instead of SendMessage().
2. Encode() has been fully rewritten.
3. When a non-ecl file is used, the dialog "Save changes to..." closes automatically.
4. New event "OnError" has been added. In case an ecoding error occures, the message is passed as a parameter, and CCE is closed. But if there are more source files then the encoding will be continued of the next file in the list.
5. Added compatibility with CCE SP 2.66

The code has been tested with CCE SP 2.50, CCE SP 2.66 beta and
CCE SP 2.66 Trial Version.

This code may not be highly-optimized, and I will be happy to see any changes and improvements.

The file is attached.:cool:

Edit: I decided to delete this attachment because I am getting closer to the completion of a highly-improved version (using window enumeration). It will be done tomorrow or the day after tomorrow at night.

mmgrover
19th October 2002, 22:01
Michael, sounds cool.
You read my mind, I had replaced my version with CreateProcess too.
You have alot more control over the app. You also can Enumerate
and find windows by a thread ID :-)


I have been playing with setting parameters of the encode job with:


Wnd := FindWindow(nil,PChar('CCE SP Trial Version -- noname *'));
if IsWindow(Wnd) then
begin

Wnd := GetWindow(Wnd,GW_CHILD);
if IsWindow(Wnd) then
begin
PostMessage(Wnd, WM_LBUTTONDBLCLK,0,MakeLParam(10,10));
end
else
ShowMessage('Error Locating List Window');

end
else
ShowMessage('Error Locating Main Window');


this lil snippet brings up the Encoder settings window for the first
job in the list. I was playing with each setting, but havn't been back to it yet :-( My wife has me doing HoneyDo work, LMAO


mike

migor
19th October 2002, 22:58
Hi Mike.

It's very nice. I thought about using EnumWindows() too, but I didn't do it because it would take additional time, and I wanted to make a fully working algorithm ASAP. That's why my code doesn't look perfective enough.
I'll be happy if you take a look at the code. Maybe you can add your own changes or improvements to my code or maybe you will find something useful in my code for your's.

migor
22nd October 2002, 20:21
Here is a new version of the component.

1. CreateProcess(), PostMessage() and Window enumeration are
implemented now.
2. Encode() has been fully rewritten.
3. When a non-ecl file is used, the dialog "Save changes to..." closes automatically.
4. New event "OnError" has been added. In case an ecoding error
occures, the message is passed as a parameter, and CCE is closed.
But if there are more source files in the list, then the encoding
of the next file will start.
5. Now compatible with CCE SP 2.66

The code has been tested with CCE SP 2.50, CCE SP 2.66 beta and
CCE SP 2.66 Trial Version

What do you think about it?

File attached.

Check new thread for the enchanced version:
http://forum.doom9.org/showthread.php?s=&threadid=36997