Hello again, I see it's still very hard to get help..
I finally find a way to detect double click to switch to fullscreen and I'll let that for those who are still searching:
Use a hook:
Code: Select all
wchar_t ch[256];
HWND hch=GetWindow(dialoghwnd, GW_CHILD); //searching for vlc child (the video window)
while(hch)
{
GetClassName(hch,ch,256);
if (wcsstr(ch,L"VLC"))
break;
hch=GetNextWindow(hch,GW_HWNDNEXT);
}
SetWindowsHookEx(WH_MOUSE, MouseHookProc,NULL, GetWindowThreadProcessId(hch, NULL)); //add the hook for mouse
The mouse hook proc:
Code: Select all
LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if(nCode >= 0 && WM_LBUTTONDBLCLK == wParam)
SendMessage(hWnd,WM_LBUTTONDBLCLK,0,0);
return CallNextHookEx(NULL, nCode, wParam, lParam);
}
And in the main proc:
Code: Select all
case WM_LBUTTONDBLCLK:
{
fullscreen=!fullscreen;
DWORD dwStyle = GetWindowLong(hwnd, GWL_STYLE);
if (fullscreen)
{
MONITORINFO mi = { sizeof(mi) };
if (GetWindowPlacement(hwnd, &g_wpPrev) &&
GetMonitorInfo(MonitorFromWindow(hwnd,MONITOR_DEFAULTTOPRIMARY), &mi))
{
SetWindowLong(hwnd, GWL_STYLE,dwStyle & ~WS_OVERLAPPEDWINDOW);
SetWindowPos(hwnd, HWND_TOPMOST,
mi.rcMonitor.left, mi.rcMonitor.top,
mi.rcMonitor.right - mi.rcMonitor.left,
mi.rcMonitor.bottom - mi.rcMonitor.top,
SWP_NOZORDER|SWP_NOOWNERZORDER | SWP_FRAMECHANGED|SWP_NOACTIVATE);
}
libvlc_set_fullscreen(mp,1);
}
else
{
SetWindowLong(hwnd, GWL_STYLE,dwStyle | WS_OVERLAPPEDWINDOW);
SetWindowPlacement(hwnd, &g_wpPrev);
SetWindowPos(hwnd, NULL, 0, 0, 0, 0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
libvlc_set_fullscreen(mp,0);
}
}
break;
Thanks me... and coders on other website sharing the codes !