Non-Resizable, Non-Movable Window

If you want to work with nonresizable, nonmovable windows, insert this code into your project (SDI or MDI applications).

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
  if (BaseClass::OnCreate(lpCreateStruct) == -1)
    return -1;

  // Do something

  // Remove positions of menu
  CMenu* pTopMenu = GetSystemMenu(FALSE);
  if(pTopMenu != NULL)
  {
  pTopMenu -> RemoveMenu(SC_SIZE, MF_BYCOMMAND);      //Size
  pTopMenu -> RemoveMenu(SC_MOVE, MF_BYCOMMAND);      //Move
  pTopMenu -> RemoveMenu(SC_MAXIMIZE, MF_BYCOMMAND);  //Maximize
  }

  return 0;
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
  if( !BaseClass::PreCreateWindow(cs) )
    return FALSE;

  // Create a window without max button and sizable border
  cs.style &= ~(WS_MAXIMIZEBOX|WS_THICKFRAME);

  return TRUE;
}


Comments

  • How about Non-Moveable Win32 dialog (WinCE 3.0)Application

    Posted by Legacy on 04/09/2003 12:00am

    Originally posted by: Francis

    I try to apply the following code to compile a non-moveable dialog appication for Wince 3.0 platform.
    
    

    case WM_INITDIALOG:
    HMENU HandleMenu ;
    HandleMenu = GetSystemMenu(hDlg,FALSE);
    if(!RemoveMenu(HandleMenu ,0,MF_BYPOSITION))
    {
    Error = GetLastError();
    wsprintf(wcPassword,L"%x",Error);
    MessageBox(NULL,wcPassword,NULL,MB_OK);
    }

    and i get error code 120 which is ERROR_CALL_NOT_IMPLEMENTED (This function is not supported on this system.)


    May i know is that anyway to develop a Non-moveable dialog application in Wince 3.0?

    Thank you.

    Reply
  • keyboard windows key control

    Posted by Legacy on 04/03/2003 12:00am

    Originally posted by: leo

    Sir
    I am doing my MCA. I have a project. I have a doubt about how can control windows key in KEYBOARD.

    for example
    i have a login menu. My aim is user should enter into my login way.

    The Problem is
    They have to move using start button(windows key) and they can access like msword are else.
    So please kindly help me how can i control windows key. help me.
    Thanking you sir

    Reply
  • How about Dialogs

    Posted by Legacy on 02/18/2002 12:00am

    Originally posted by: Mikael

    Is it possible to make Dialog windows Nonmovable too ?

    Reply
  • How to remove resizing of window when double click in caption

    Posted by Legacy on 07/20/2001 12:00am

    Originally posted by: Sveinung Tollefsen

    I have tryed the method decribed, and it work fine exept if I double click in the caption the window resizes away from MAXIMIZE.

    I have added the line

    pFrame->ModifyStyle( 0,0,SWP_NOSIZE );

    But this did not help.

    Any sugestions?

    Reply
  • How to make ActiveX nonresizable?

    Posted by Legacy on 07/16/2001 12:00am

    Originally posted by: Dave Smith

    I am designing an ActiveX which needs nonresiable, i copy code here to
    CSampleCtrl::PreCreateWindow(CREATESTRUCT& cs),
    it does not work, ActiveX still can resize, it works for .exe.

    Reply
  • How to prevent positioning of an external program's window

    Posted by Legacy on 07/12/2001 12:00am

    Originally posted by: Peter Hentrich

    It is mentioned how to control the frame and child window properties.
    
    But what about manipulating an external program's window?

    e.g. I am running an external program MATLAB in the background and have successfully obtained a handle and set its window position using

    ::SetWindowPos(hNextApp, HWND_TOP, 745, 110, 520, 350, SWP_NOMOVE);

    However, I can't prevent the user from moving, minimizing or closing the window i.e. SWP_NOMOVE isn't working!

    Any suggestions?
    Thank you for your precious time!!

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • You probably have several goals for your patient portal of choice. Is "community" one of them? With a bevy of vendors offering portal solutions, it can be challenging for a hospital to know where to start. Fortunately, YourCareCommunity helps ease the decision-making process. Read this white paper to learn more. "3 Ways Clinicians can Leverage a Patient Portal to Craft a Healthcare Community" is a published document owned by www.medhost.com

  • The impact of a data loss event can be significant. Real-time data is essential to remaining competitive. Many companies can no longer afford to rely on a truck arriving each day to take backup tapes offsite. For most companies, a cloud backup and recovery solution will eliminate, or significantly reduce, IT resources related to the mundane task of backup and allow your resources to be redeployed to more strategic projects. The cloud - can now be comfortable for you – with 100% recovery from anywhere all …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds