Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Any way to intercept WM_SIZING with SDI/MDI application

Any way to intercept WM_SIZING with SDI/MDI application

Scheduled Pinned Locked Moved C / C++ / MFC
comquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aldeba
    wrote on last edited by
    #1

    I need to restrict the resizing of the SDI application. I tried the method found in http://www.codeproject.com/useritems/mdibackgroundimage.asp to hook on to WM_SIZING and it worked. But i was wondering whether there was any other way, any msg i could overload? tried all the PreTranslateMessage and ProcessMessageFilter message map, but it did'nt work. This is a slightly modified one from winamp plugin. very slightly. i just wanted

    WNDPROC pfnOldWndProc;

    // new one

    LRESULT CALLBACK pfnNewWndProc(HWND hwnd, UINT uMsg, WPARAM wParam,LPARAM lParam)
    {
    CRect rect;

    switch (uMsg)	{
    case WM\_SIZING :
    	if ((wParam==WMSZ\_BOTTOMLEFT) || (wParam==WMSZ\_BOTTOMRIGHT))
    		wParam=WMSZ\_BOTTOM;
    	else if ((wParam==WMSZ\_TOPLEFT) || (wParam==WMSZ\_TOPRIGHT))
    		wParam=WMSZ\_TOP;
    	GetWindowRect(hwnd,rect);
    	((RECT\*)lParam)->left= rect.left;
    	((RECT\*)lParam)->right = rect.right;
    	break;
    }
    return CallWindowProc(pfnOldWndProc, hwnd, uMsg, wParam, lParam);
    

    }

    and in InitInstance()

    HWND hMain = GetActiveWindow();
    pfnOldWndProc = (WNDPROC)GetWindowLong(hMain, GWL\_WNDPROC);
    SetWindowLong(hMain, GWL\_WNDPROC, (long)pfnNewWndProc);
    
    C S 2 Replies Last reply
    0
    • A aldeba

      I need to restrict the resizing of the SDI application. I tried the method found in http://www.codeproject.com/useritems/mdibackgroundimage.asp to hook on to WM_SIZING and it worked. But i was wondering whether there was any other way, any msg i could overload? tried all the PreTranslateMessage and ProcessMessageFilter message map, but it did'nt work. This is a slightly modified one from winamp plugin. very slightly. i just wanted

      WNDPROC pfnOldWndProc;

      // new one

      LRESULT CALLBACK pfnNewWndProc(HWND hwnd, UINT uMsg, WPARAM wParam,LPARAM lParam)
      {
      CRect rect;

      switch (uMsg)	{
      case WM\_SIZING :
      	if ((wParam==WMSZ\_BOTTOMLEFT) || (wParam==WMSZ\_BOTTOMRIGHT))
      		wParam=WMSZ\_BOTTOM;
      	else if ((wParam==WMSZ\_TOPLEFT) || (wParam==WMSZ\_TOPRIGHT))
      		wParam=WMSZ\_TOP;
      	GetWindowRect(hwnd,rect);
      	((RECT\*)lParam)->left= rect.left;
      	((RECT\*)lParam)->right = rect.right;
      	break;
      }
      return CallWindowProc(pfnOldWndProc, hwnd, uMsg, wParam, lParam);
      

      }

      and in InitInstance()

      HWND hMain = GetActiveWindow();
      pfnOldWndProc = (WNDPROC)GetWindowLong(hMain, GWL\_WNDPROC);
      SetWindowLong(hMain, GWL\_WNDPROC, (long)pfnNewWndProc);
      
      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      aldeba wrote: I need to restrict the resizing of the SDI application. WM_MINMAXINFO is what you need Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002 Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002

      1 Reply Last reply
      0
      • A aldeba

        I need to restrict the resizing of the SDI application. I tried the method found in http://www.codeproject.com/useritems/mdibackgroundimage.asp to hook on to WM_SIZING and it worked. But i was wondering whether there was any other way, any msg i could overload? tried all the PreTranslateMessage and ProcessMessageFilter message map, but it did'nt work. This is a slightly modified one from winamp plugin. very slightly. i just wanted

        WNDPROC pfnOldWndProc;

        // new one

        LRESULT CALLBACK pfnNewWndProc(HWND hwnd, UINT uMsg, WPARAM wParam,LPARAM lParam)
        {
        CRect rect;

        switch (uMsg)	{
        case WM\_SIZING :
        	if ((wParam==WMSZ\_BOTTOMLEFT) || (wParam==WMSZ\_BOTTOMRIGHT))
        		wParam=WMSZ\_BOTTOM;
        	else if ((wParam==WMSZ\_TOPLEFT) || (wParam==WMSZ\_TOPRIGHT))
        		wParam=WMSZ\_TOP;
        	GetWindowRect(hwnd,rect);
        	((RECT\*)lParam)->left= rect.left;
        	((RECT\*)lParam)->right = rect.right;
        	break;
        }
        return CallWindowProc(pfnOldWndProc, hwnd, uMsg, wParam, lParam);
        

        }

        and in InitInstance()

        HWND hMain = GetActiveWindow();
        pfnOldWndProc = (WNDPROC)GetWindowLong(hMain, GWL\_WNDPROC);
        SetWindowLong(hMain, GWL\_WNDPROC, (long)pfnNewWndProc);
        
        S Offline
        S Offline
        S Maharajan
        wrote on last edited by
        #3

        Ur Requirement is to limit resizing. U should go for the message WM_GETMINMAXINFO. OnGetMinMaxInfo(MINMAXINFO *mmi) message handler, mmi->ptMaxSize, mmi->ptMaxTrackSize, mmi->ptMaxTrackSize are the relevent member to be filled to limit resizing. mmi->ptMaxTrackSize is SIZE u want to restrict.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups