eed to send computer Keyboard shortcut to VST . how ?
eed to send computer Keyboard shortcut to VST . how ?
Still learning it .need to send computer Keyboard shortcut to VST from button or knob . i want press button in a patch which will send computer num pad key ar any other key qwerty etc (which is assigned to some function in VST obviously ) reason why i want to do it that way is i want then save this action as preset snapshot . hope i explained well what i'm trying to achieve . i can't work it out . still trying . will post solution if i find it .
Thank you
GC
Thank you
GC
humm,
I don't think it's possible in the general case. Keyboard handling is provided by the VST itself and unfortunately Usine can't hook that.
I don't think it's possible in the general case. Keyboard handling is provided by the VST itself and unfortunately Usine can't hook that.
Olivier Sens
www.brainmodular.com
www.brainmodular.com
Yeas .Thx .tried everything with no avail . its for FL Studio . such a quality sounds i get it from there but FL is so wrapped in it's shell .meaning no parameters are available to be modulated or saved in a preset snapshot from Usine . they have FL 21 on horizon . hope they will make it possible to access its parameters from outside . many thx anyhow .
-
sm_jamieson
- Member
- Posts: 551
- Contact:
Windows can send key events to another window using C++. I expect MAC can do similar.
This could be done in a user module using the SDK.
Google this for examples: "windows send keystrokes to application c++
Usine should be able to provide the window handle for the VST window.
So I think a Send Key to VST module should be possible.
Simon.
This could be done in a user module using the SDK.
Google this for examples: "windows send keystrokes to application c++
Usine should be able to provide the window handle for the VST window.
So I think a Send Key to VST module should be possible.
Simon.
i could not figure that part outsm_jamieson wrote: ↑25 May 2022, 11:03Windows can send key events to another window using C++. I expect MAC can do similar.
This could be done in a user module using the SDK.
Google this for examples: "windows send keystrokes to application c++
Usine should be able to provide the window handle for the VST window.
So I think a Send Key to VST module should be possible.
Simon.
-
sm_jamieson
- Member
- Posts: 551
- Contact:
To help, I'd have to try and code it and see how far I get.
It might also depend on exactly how the VST window gets its input events.
Might need a new SDK function to get the window handle from Usine.
Also needs to support the 2 modes now - the original VST window and the new VST Client window
(The Client window gets around the problem where VST windows were getting stuck under other windows)
I did some experiments with this a few years ago. I'll see if I can dig out the code.
It might also depend on exactly how the VST window gets its input events.
Might need a new SDK function to get the window handle from Usine.
Also needs to support the 2 modes now - the original VST window and the new VST Client window
(The Client window gets around the problem where VST windows were getting stuck under other windows)
I did some experiments with this a few years ago. I'll see if I can dig out the code.
-
sm_jamieson
- Member
- Posts: 551
- Contact:
OK, seems to be 2 methods.
1. Use SendInput to send to currently active window (creates key events as if typed)
example from google:
void keyPressTilde() {
ip.ki.wVk = 0xC0; // virtual-key code for the key
ip.ki.dwFlags = 0;
SendInput(1, &ip, sizeof(INPUT));
ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release
SendInput(1, &ip, sizeof(INPUT));
};
2. Use SendMessage to send key events to any windows (can be in background).
This only works if the application (VST) gets input by the messaging system and modifiers
may not work, since they are often obtained using the global key states not the messages.
It might work if a simple keypress is required.
e.g.
int main()
{
LPCWSTR Target_window_Name = TEXT("Untitled - Notepad"); //<- Has to match window name
HWND hWindowHandle = FindWindow(NULL, Target_window_Name);
HWND EditClass = FindWindowEx(hWindowHandle, NULL, L"Edit", NULL);
SendMessage(EditClass, WM_KEYDOWN, 0x5A, 0x002C0001);
SendMessage(EditClass, WM_CHAR, 0x7A, 0x002C0001); //"z"
SendMessage(EditClass, WM_KEYUP, 0x5A, 0xC02C0001);
return(0);
}
1. Use SendInput to send to currently active window (creates key events as if typed)
example from google:
void keyPressTilde() {
ip.ki.wVk = 0xC0; // virtual-key code for the key
ip.ki.dwFlags = 0;
SendInput(1, &ip, sizeof(INPUT));
ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release
SendInput(1, &ip, sizeof(INPUT));
};
2. Use SendMessage to send key events to any windows (can be in background).
This only works if the application (VST) gets input by the messaging system and modifiers
may not work, since they are often obtained using the global key states not the messages.
It might work if a simple keypress is required.
e.g.
int main()
{
LPCWSTR Target_window_Name = TEXT("Untitled - Notepad"); //<- Has to match window name
HWND hWindowHandle = FindWindow(NULL, Target_window_Name);
HWND EditClass = FindWindowEx(hWindowHandle, NULL, L"Edit", NULL);
SendMessage(EditClass, WM_KEYDOWN, 0x5A, 0x002C0001);
SendMessage(EditClass, WM_CHAR, 0x7A, 0x002C0001); //"z"
SendMessage(EditClass, WM_KEYUP, 0x5A, 0xC02C0001);
return(0);
}
-
sm_jamieson
- Member
- Posts: 551
- Contact:
One other point. The VST might not process input if it is not activated / in focus anyway.
You can use a windows call to bring a window into and out of focus using SetForegroundWindow(hWnd)
and ShowWindow(hWnd, SW_MINIMIZE);
If the VST supports it, the best idea would be to map the function to a midi CC message or automation control
and use that.
You can use a windows call to bring a window into and out of focus using SetForegroundWindow(hWnd)
and ShowWindow(hWnd, SW_MINIMIZE);
If the VST supports it, the best idea would be to map the function to a midi CC message or automation control
and use that.
Who is online
Users browsing this forum: No registered users and 74 guests
