Get handle of the Vegas application windows ?

Rosebud wrote on 5/30/2007, 4:02 PM
I need to know how to get the handle of the Vegas application windows.

I want to use this method:

[DllImport("USER32.DLL")]
public static extern IntPtr FindWindow(string lpClassName,
string lpWindowName);

But I don’t find how to get the lpClassName and the lpWindowName strings.

Any help will be appreciated.

Gilles

Comments

Rosebud wrote on 5/30/2007, 11:35 PM
Problem solved.

I can use null for lpClassName.
I use “Vegas.Project.FilePath” to determine lpWindowName.
SonyPJM wrote on 5/31/2007, 6:54 AM
You can use the MainWindow property of the Vegas object which returns an IWin32Window interface. The Handle property of this interface gives you Vegas' main window handle:


void FromVegas(Vegas vegas)
{
IntPtr hwndVegas = vegas.MainWindow.Handle;
}


What do you need to do with the window handle? Maybe we can add it as a "proper" feature.
Rosebud wrote on 5/31/2007, 7:55 AM
Many Thx !
Very more easy than my actual method ;))

I’m making a script to access event on Timeline (it would be nice to have this feature in the Edit Detail Window for future Vegas version)
This script have a non-modal form and I need to know Vegas Handle to send shortcut to it.
Like this :
SetForegroundWindow(vegasHandle);
SendKeys.SendWait("*");

You can find a beta version of my script HERE.
I use the “*” shortcut to center view around cursor.
This schortcut work with a French keyboard on a WinXP French version.
But in the help shortcuts list, this shortcut is “\”.

So I’m not sure my script is working with an English keyboard.
Please, can you tell me if after double clicking a line in my script 's listview, Vegas center view around cursor ?

Thx again.
SonyPJM wrote on 5/31/2007, 9:05 AM
I can't run pre-compiled scripts here because of general security concerns (nothing against you personally).

But yes, on English keyboard, the '\' key centers the view around the cursor.

I think the scripting enhancements we are working on now will help you very much.
Rosebud wrote on 5/31/2007, 12:36 PM
> I think the scripting enhancements we are working on now will help you very much.

Very good news!
Thx.