Disable browser resizing

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Disable browser resizing

Postby tehpsy » Tue Jul 09, 2013 10:27 am

Is there any way to disable resizing of the cefclient application? Or at least specifying a minimum browser window size; currently the user can hide GUI elements by resizing the window!
tehpsy
Newbie
 
Posts: 5
Joined: Tue Jul 09, 2013 9:41 am

Re: Disable browser resizing

Postby magreenblatt » Tue Jul 09, 2013 11:41 am

This can be done using OS flags or functions. For example, on windows remove the WS_THICKFRAME style to disable resizing.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Disable browser resizing

Postby tehpsy » Wed Jul 10, 2013 2:02 am

Thanks! That worked perfectly.

It turns out you can also disable resizing by processing WM_GETMINMAXINFO messages:

case WM_GETMINMAXINFO: {
MINMAXINFO *pMinMax = (MINMAXINFO*)lParam;
pMinMax->ptMaxTrackSize.x = pMinMax->ptMinTrackSize.x = 920;
pMinMax->ptMaxTrackSize.y = pMinMax->ptMinTrackSize.y = 644;
}
Last edited by tehpsy on Wed Jul 10, 2013 4:02 am, edited 3 times in total.
tehpsy
Newbie
 
Posts: 5
Joined: Tue Jul 09, 2013 9:41 am

Re: Disable browser resizing

Postby tehpsy » Wed Jul 10, 2013 2:29 am

In case this is helpful to anyone else, use the following to disable window resizing on mac:

[mainWnd setStyleMask:[mainWnd styleMask] & ~NSResizableWindowMask];
tehpsy
Newbie
 
Posts: 5
Joined: Tue Jul 09, 2013 9:41 am

Re: Disable browser resizing

Postby codr33 » Sat Jul 22, 2017 5:44 am

Where can I set WM_GETMINMAXINFO in cefsimple?
codr33
Newbie
 
Posts: 6
Joined: Sat Jul 22, 2017 5:42 am

Re: Disable browser resizing

Postby codr33 » Sat Sep 23, 2017 11:07 am

I added this at the end of cefsimple_win.cc and there's no change, am I approaching it right at all?

Code: Select all
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
   LPARAM lParam) {

   switch (message) {
      case WM_GETMINMAXINFO: {
         MINMAXINFO *pMinMax = (MINMAXINFO*)lParam;
         pMinMax->ptMaxTrackSize.x = pMinMax->ptMinTrackSize.x = 920;
         pMinMax->ptMaxTrackSize.y = pMinMax->ptMinTrackSize.y = 644;
         break;
      }
   }


   return DefWindowProc(hWnd, message, wParam, lParam);
}
codr33
Newbie
 
Posts: 6
Joined: Sat Jul 22, 2017 5:42 am

Re: Disable browser resizing

Postby codr33 » Fri Sep 29, 2017 2:22 am

codr33 wrote:I added this at the end of cefsimple_win.cc and there's no change, am I approaching it right at all?

Code: Select all
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
   LPARAM lParam) {

   switch (message) {
      case WM_GETMINMAXINFO: {
         MINMAXINFO *pMinMax = (MINMAXINFO*)lParam;
         pMinMax->ptMaxTrackSize.x = pMinMax->ptMinTrackSize.x = 920;
         pMinMax->ptMaxTrackSize.y = pMinMax->ptMinTrackSize.y = 644;
         break;
      }
   }


   return DefWindowProc(hWnd, message, wParam, lParam);
}


Any ideas on this?
codr33
Newbie
 
Posts: 6
Joined: Sat Jul 22, 2017 5:42 am

Re: Disable browser resizing

Postby magreenblatt » Fri Sep 29, 2017 8:15 am

You need to create the parent window yourself. See the cefclient sample application and the root_window_win.cc file specifically.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 42 guests