View Single Post
Old 04-29-2010, 02:15 PM   #31
Human being with feelings
Tale's Avatar
Join Date: Jul 2008
Location: The Netherlands
Posts: 2,964

Setting focus when you open the editor is easy (and probably a good idea indeed). You just add SetFocus() to the WM_CREATE block:

  if (msg == WM_CREATE) {
    SetWindowLongPtr(hWnd, GWLP_USERDATA, (LPARAM) (lpcs->lpCreateParams));
		int mSec = int(1000.0 / sFPS);
		SetTimer(hWnd, IPLUG_TIMER_ID, mSec, NULL);
		SetFocus(hWnd); // <--- Add this line
		return 0;
However, setting focus when you click on the title bar is trickier. I think the problem is that the window frame including the title bar is provided by the host, i.e. it's not actually part of the plug-in window. So when you click on the titlebar this will cause window messages to be sent to the host providing the frame, but not to the plug-in window itself.
Martinic Scanner Vibrato - Elka Panther - Tale's JSFX Pack - WDL.git
Tale is offline   Reply With Quote