Solved

What is the value of WS_MAXIMIZEBOX?

Posted on 1999-01-01
5
462 Views
Last Modified: 2008-02-20
I want to be able to catpure the maximize box event in my vb app. what i need is to know the # that is sent to  "Windowsproc" when a window is being maximized?
for example: I belive the WM_SETCURSOR = &H20 and WM_WINDOWPOSCHANGING = &H46. Is there one for MAXIMIZING/MINIMIZING a window?
The reason i need this is because i have created my own Windowsproc that intercepts windows callls to my form and want to change certain aspects of this information. In this case i want to be able to set the MAXIMIZE and MINIMIZE box to do something different.
0
Comment
Question by:aniston
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
heathprovost earned 0 total points
ID: 1453601
WM_GETMINMAXINFO = &H24


From the Win32 API Reference

WM_GETMINMAXINFO

lpmmi = (LPMINMAXINFO) lParam; // address of structure
 

The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window's default maximized size and position, or its default minimum or maximum tracking size.

Parameters

lpmmi

Value of lParam. Points to a MINMAXINFO structure that contains the default maximized position and dimensions, and the default minimum and maximum tracking sizes. An application can override the defaults by setting the members of this structure.

Return Value

If an application processes this message, it should return zero.

Remarks

The maximum tracking size is the largest window size that can be produced by using the borders to size the window. The minimum tracking size is the smallest window size that can be produced by using the borders to size the window.

See Also

MoveWindow, SetWindowPos, MINMAXINFO





MINMAXINFO

typedef struct tagMINMAXINFO {  // mmi

    POINT ptReserved;
    POINT ptMaxSize;
    POINT ptMaxPosition;
    POINT ptMinTrackSize;
    POINT ptMaxTrackSize;
} MINMAXINFO;
 

The MINMAXINFO structure contains information about a window's maximized size and position and its minimum and maximum tracking size.

Members

ptReserved

Reserved; do not use.

ptMaxSize

Specifies the maximized width (point.x) and the maximized height (point.y) of the window.

ptMaxPosition

Specifies the position of the left side of the maximized window (point.x) and the position of the top of the maximized window (point.y).

ptMinTrackSize

Specifies the minimum tracking width (point.x) and the minimum tracking height (point.y) of the window.

ptMaxTrackSize

Specifies the maximum tracking width (point.x) and the maximum tracking height (point.y) of the window.

See Also

POINT, WM_GETMINMAXINFO
0
 

Author Comment

by:aniston
ID: 1453602
You are a ****ing GENIUS!!! This is the kind of answer is was looking for...Thank you, thank you!
0
 

Author Comment

by:aniston
ID: 1453603
You wouldn't bty chance know what these WM_ codes are:

&H215
&H112
&HD

And is there somewhere online that i can go to check these values up myself rather than having to ask you experts?
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1453604
&H215 = WM_CAPTURECHANGED
WM_CAPTURECHANGED
hwndNewCapture = (HWND) lParam;    // handle of window to gain mouse capture
 

The WM_CAPTURECHANGED message is sent to the window that is losing the mouse capture.

Parameters

hwndNewCapture

Value of lParam. Identifies the window that is gaining the mouse capture.

Return Value

An application should return zero if it processes this message.

Remarks

A window receives this message even if it calls ReleaseCapture itself. An application should not attempt to set the mouse capture in response to this message.
When it receives this message, a window should redraw itself, if necessary, to reflect the new mouse-capture state.




&H112 = WM_SYSCOMMAND
WM_SYSCOMMAND

uCmdType = wParam;        // type of system command requested
xPos = LOWORD(lParam);    // horizontal postion, in screen coordinates
yPos = HIWORD(lParam);    // vertical postion, in screen coordinates
 

A window receives this message when the user chooses a command from the System menu (also known as Control menu) or when the user chooses the Maximize button or Minimize button.

Parameters

uCmdType

Specifies the type of system command requested. This can be one of these values:

Value      Meaning
SC_CLOSE      Closes the window.
SC_CONTEXTHELP      Changes the cursor to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message.
SC_DEFAULT      Selects the default item; the user double-clicked the System menu.
SC_HOTKEY      Activates the window associated with the application-specified hot key. The low-order word of lParam identifies the window to activate.
SC_HSCROLL      Scrolls horizontally.
SC_KEYMENU      Retrieves the System menu as a result of a keystroke.
SC_MAXIMIZE (or SC_ZOOM)      Maximizes the window.
SC_MINIMIZE (or SC_ICON)      Minimizes the window.
SC_MONITORPOWER      Windows 95 only: Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.
SC_MOUSEMENU      Retrieves the System menu as a result of a mouse click.
SC_MOVE      Moves the window.
SC_NEXTWINDOW      Moves to the next window.
SC_PREVWINDOW      Moves to the previous window.
SC_RESTORE      Restores the window to its normal position and size.
SC_SCREENSAVE      Executes the screen saver application specified in the [boot] section of the SYSTEM.INI file.
SC_SIZE      Sizes the window.
SC_TASKLIST      Executes or activates Windows Task Manager.
SC_VSCROLL      Scrolls vertically.
xPos

Specifies the horizontal position of the cursor, in screen coordinates, if a System menu command is chosen with the mouse. Otherwise, the xPos parameter is not used.

yPos

Specifies the vertical position of the cursor, in screen coordinates, if a System menu command is chosen with the mouse. This parameter is - 1 if the command is chosen using a system accelerator, or zero if using a mnenomic.

Return Value

An application should return zero if it processes this message.

Remarks

The DefWindowProc function carries out the System menu request for the predefined actions specified in the previous table.
In WM_SYSCOMMAND messages, the four low-order bits of the uCmdType parameter are used internally by Windows. To obtain the correct result when testing the value of uCmdType, an application must combine the value 0xFFF0 with the uCmdType value by using the bitwise AND operator.
The menu items in a System menu can be modified by using the GetSystemMenu, AppendMenu, InsertMenu, ModifyMenu, InsertMenuItem, and SetMenuItem functions. Applications that modify the System menu must process WM_SYSCOMMAND messages.

An application can carry out any system command at any time by passing a WM_SYSCOMMAND message to DefWindowProc. Any WM_SYSCOMMAND messages not handled by the application must be passed to DefWindowProc. Any command values added by an application must be processed by the application and cannot be passed to DefWindowProc.
Accelerator keys that are defined to choose items from the System menu are translated into WM_SYSCOMMAND messages; all other accelerator keystrokes are translated into WM_COMMAND messages.



&HD = WM_GETTEXT
WM_GETTEXT

wParam = (WPARAM) cchTextMax;   // number of characters to copy
lParam = (LPARAM) lpszText;     // address of buffer for text
 

An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller.

Parameters

cchTextMax

Value of wParam. Specifies the maximum number of characters to be copied, including the terminating null character.

lpszText

Value of lParam. Points to the buffer that is to receive the text.

Return Value

The return value is the number of characters copied.

Default Action

The DefWindowProc function copies the text associated with the window into the specified buffer and returns the number of characters copied.

Remarks

For an edit control, the text to be copied is the content of the edit control. For a combo box, the text is the content of the edit control (or static-text) portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. To copy the text of an item in a list box, an application can use the LB_GETTEXT message.
When the WM_GETTEXT message is sent to a static control with the SS_ICON style, the handle of the icon will be returned in the first four bytes of the buffer pointed to by lpszText. This is true only if the WM_SETTEXT message has been used to set the icon.

The following is a piece of the messaging unit included with Delphi 3 (I do not use VB).  This should help you.

{ Window Messages }

const
  WM_NULL             = &H0;
  WM_CREATE           = &H1;
  WM_DESTROY          = &H2;
  WM_MOVE             = &H3;
  WM_SIZE             = &H5;
  WM_ACTIVATE         = &H6;
  WM_SETFOCUS         = &H7;
  WM_KILLFOCUS        = &H8;
  WM_ENABLE           = &HA;
  WM_SETREDRAW        = &HB;
  WM_SETTEXT          = &HC;
  WM_GETTEXT          = &HD;
  WM_GETTEXTLENGTH    = &HE;
  WM_PAINT            = &HF;
  WM_CLOSE            = &H10;
  WM_QUERYENDSESSION  = &H11;
  WM_QUIT             = &H12;
  WM_QUERYOPEN        = &H13;
  WM_ERASEBKGND       = &H14;
  WM_SYSCOLORCHANGE   = &H15;
  WM_ENDSESSION       = &H16;
  WM_SYSTEMERROR      = &H17;
  WM_SHOWWINDOW       = &H18;
  WM_CTLCOLOR         = &H19;
  WM_WININICHANGE     = &H1A;
  WM_SETTINGCHANGE = WM_WININICHANGE;
  WM_DEVMODECHANGE    = &H1B;
  WM_ACTIVATEAPP      = &H1C;
  WM_FONTCHANGE       = &H1D;
  WM_TIMECHANGE       = &H1E;
  WM_CANCELMODE       = &H1F;
  WM_SETCURSOR        = &H20;
  WM_MOUSEACTIVATE    = &H21;
  WM_CHILDACTIVATE    = &H22;
  WM_QUEUESYNC        = &H23;
  WM_GETMINMAXINFO    = &H24;
  WM_PAINTICON        = &H26;
  WM_ICONERASEBKGND   = &H27;
  WM_NEXTDLGCTL       = &H28;
  WM_SPOOLERSTATUS    = &H2A;
  WM_DRAWITEM         = &H2B;
  WM_MEASUREITEM      = &H2C;
  WM_DELETEITEM       = &H2D;
  WM_VKEYTOITEM       = &H2E;
  WM_CHARTOITEM       = &H2F;
  WM_SETFONT          = &H30;
  WM_GETFONT          = &H31;
  WM_SETHOTKEY        = &H32;
  WM_GETHOTKEY        = &H33;
  WM_QUERYDRAGICON    = &H37;
  WM_COMPAREITEM      = &H39;
  WM_COMPACTING       = &H41;

  WM_COMMNOTIFY       = &H44;    { obsolete in Win32}

  WM_WINDOWPOSCHANGING = &H46;
  WM_WINDOWPOSCHANGED = &H47;
  WM_POWER            = &H48;

  WM_COPYDATA         = &H4A;
  WM_CANCELJOURNAL    = &H4B;
  WM_NOTIFY           = &H4E;
  WM_INPUTLANGCHANGEREQUEST = &H50;
  WM_INPUTLANGCHANGE  = &H51;
  WM_TCARD            = &H52;
  WM_HELP             = &H53;
  WM_USERCHANGED      = &H54;
  WM_NOTIFYFORMAT     = &H55;

  WM_CONTEXTMENU      = &H7B;
  WM_STYLECHANGING    = &H7C;
  WM_STYLECHANGED     = &H7D;
  WM_DISPLAYCHANGE    = &H7E;
  WM_GETICON          = &H7F;
  WM_SETICON          = &H80;

  WM_NCCREATE         = &H81;
  WM_NCDESTROY        = &H82;
  WM_NCCALCSIZE       = &H83;
  WM_NCHITTEST        = &H84;
  WM_NCPAINT          = &H85;
  WM_NCACTIVATE       = &H86;
  WM_GETDLGCODE       = &H87;
  WM_NCMOUSEMOVE      = &HA0;
  WM_NCLBUTTONDOWN    = &HA1;
  WM_NCLBUTTONUP      = &HA2;
  WM_NCLBUTTONDBLCLK  = &HA3;
  WM_NCRBUTTONDOWN    = &HA4;
  WM_NCRBUTTONUP      = &HA5;
  WM_NCRBUTTONDBLCLK  = &HA6;
  WM_NCMBUTTONDOWN    = &HA7;
  WM_NCMBUTTONUP      = &HA8;
  WM_NCMBUTTONDBLCLK  = &HA9;

  WM_KEYFIRST         = &H100;
  WM_KEYDOWN          = &H100;
  WM_KEYUP            = &H101;
  WM_CHAR             = &H102;
  WM_DEADCHAR         = &H103;
  WM_SYSKEYDOWN       = &H104;
  WM_SYSKEYUP         = &H105;
  WM_SYSCHAR          = &H106;
  WM_SYSDEADCHAR      = &H107;
  WM_KEYLAST          = &H108;

  WM_INITDIALOG       = &H110;
  WM_COMMAND          = &H111;
  WM_SYSCOMMAND       = &H112;
  WM_TIMER            = &H113;
  WM_HSCROLL          = &H114;
  WM_VSCROLL          = &H115;
  WM_INITMENU         = &H116;
  WM_INITMENUPOPUP    = &H117;
  WM_MENUSELECT       = &H11F;
  WM_MENUCHAR         = &H120;
  WM_ENTERIDLE        = &H121;

  WM_CTLCOLORMSGBOX   = &H132;
  WM_CTLCOLOREDIT     = &H133;
  WM_CTLCOLORLISTBOX  = &H134;
  WM_CTLCOLORBTN      = &H135;
  WM_CTLCOLORDLG      = &H136;
  WM_CTLCOLORSCROLLBAR= &H137;
  WM_CTLCOLORSTATIC   = &H138;

  WM_MOUSEFIRST       = &H200;
  WM_MOUSEMOVE        = &H200;
  WM_LBUTTONDOWN      = &H201;
  WM_LBUTTONUP        = &H202;
  WM_LBUTTONDBLCLK    = &H203;
  WM_RBUTTONDOWN      = &H204;
  WM_RBUTTONUP        = &H205;
  WM_RBUTTONDBLCLK    = &H206;
  WM_MBUTTONDOWN      = &H207;
  WM_MBUTTONUP        = &H208;
  WM_MBUTTONDBLCLK    = &H209;
  WM_MOUSEWHEEL       = &H20A;
  WM_MOUSELAST        = &H20A;

  WM_PARENTNOTIFY     = &H210;
  WM_ENTERMENULOOP    = &H211;
  WM_EXITMENULOOP     = &H212;
  WM_NEXTMENU         = &H213;

  WM_SIZING           = 532;
  WM_CAPTURECHANGED   = 533;
  WM_MOVING           = 534;
  WM_POWERBROADCAST   = 536;
  WM_DEVICECHANGE     = 537;

  WM_IME_STARTCOMPOSITION        = &H10D;
  WM_IME_ENDCOMPOSITION          = &H10E;
  WM_IME_COMPOSITION             = &H10F;
  WM_IME_KEYLAST                 = &H10F;

  WM_IME_SETCONTEXT              = &H281;
  WM_IME_NOTIFY                  = &H282;
  WM_IME_CONTROL                 = &H283;
  WM_IME_COMPOSITIONFULL         = &H284;
  WM_IME_SELECT                  = &H285;
  WM_IME_CHAR                    = &H286;

  WM_IME_KEYDOWN                 = &H290;
  WM_IME_KEYUP                   = &H291;

  WM_MDICREATE        = &H220;
  WM_MDIDESTROY       = &H221;
  WM_MDIACTIVATE      = &H222;
  WM_MDIRESTORE       = &H223;
  WM_MDINEXT          = &H224;
  WM_MDIMAXIMIZE      = &H225;
  WM_MDITILE          = &H226;
  WM_MDICASCADE       = &H227;
  WM_MDIICONARRANGE   = &H228;
  WM_MDIGETACTIVE     = &H229;
  WM_MDISETMENU       = &H230;

  WM_ENTERSIZEMOVE    = &H231;
  WM_EXITSIZEMOVE     = &H232;
  WM_DROPFILES        = &H233;
  WM_MDIREFRESHMENU   = &H234;

  WM_MOUSEHOVER       = &H2A1;
  WM_MOUSELEAVE       = &H2A3;

  WM_CUT              = &H300;
  WM_COPY             = &H301;
  WM_PASTE            = &H302;
  WM_CLEAR            = &H303;
  WM_UNDO             = &H304;
  WM_RENDERFORMAT     = &H305;
  WM_RENDERALLFORMATS = &H306;
  WM_DESTROYCLIPBOARD = &H307;
  WM_DRAWCLIPBOARD    = &H308;
  WM_PAINTCLIPBOARD   = &H309;
  WM_VSCROLLCLIPBOARD = &H30A;
  WM_SIZECLIPBOARD    = &H30B;
  WM_ASKCBFORMATNAME  = &H30C;
  WM_CHANGECBCHAIN    = &H30D;
  WM_HSCROLLCLIPBOARD = &H30E;
  WM_QUERYNEWPALETTE  = &H30F;
  WM_PALETTEISCHANGING= &H310;
  WM_PALETTECHANGED   = &H311;
  WM_HOTKEY           = &H312;

  WM_PRINT            = 791;
  WM_PRINTCLIENT      = 792;

  WM_HANDHELDFIRST    = 856;
  WM_HANDHELDLAST     = 863;

  WM_PENWINFIRST      = &H380;
  WM_PENWINLAST       = &H38F;

  WM_COALESCE_FIRST   = &H390;
  WM_COALESCE_LAST    = &H39F;

  WM_DDE_FIRST        = &H3E0;
  WM_DDE_INITIATE     = WM_DDE_FIRST + 0;
  WM_DDE_TERMINATE    = WM_DDE_FIRST + 1;
  WM_DDE_ADVISE       = WM_DDE_FIRST + 2;
  WM_DDE_UNADVISE     = WM_DDE_FIRST + 3;
  WM_DDE_ACK          = WM_DDE_FIRST + 4;
  WM_DDE_DATA         = WM_DDE_FIRST + 5;
  WM_DDE_REQUEST      = WM_DDE_FIRST + 6;
  WM_DDE_POKE         = WM_DDE_FIRST + 7;
  WM_DDE_EXECUTE      = WM_DDE_FIRST + 8;
  WM_DDE_LAST         = WM_DDE_FIRST + 8;

  WM_APP = $8000;

{ NOTE: All Message Numbers below 0x0400 are RESERVED }

{ Private Window Messages Start Here }

  WM_USER             = &H400;

{ Button Notification Codes }

const
  BN_CLICKED       = 0;
  BN_PAINT         = 1;
  BN_HILITE        = 2;
  BN_UNHILITE      = 3;
  BN_DISABLE       = 4;
  BN_DOUBLECLICKED = 5;
  BN_PUSHED = BN_HILITE;
  BN_UNPUSHED = BN_UNHILITE;
  BN_DBLCLK = BN_DOUBLECLICKED;
  BN_SETFOCUS = 6;
  BN_KILLFOCUS = 7;

{ Button Control Messages }
const
  BM_GETCHECK = &HF0;
  BM_SETCHECK = &HF1;
  BM_GETSTATE = &HF2;
  BM_SETSTATE = &HF3;
  BM_SETSTYLE = &HF4;
  BM_CLICK    = &HF5;
  BM_GETIMAGE = &HF6;
  BM_SETIMAGE = &HF7;

{ Listbox Notification Codes }

const
  LBN_ERRSPACE  = (-2);
  LBN_SELCHANGE = 1;
  LBN_DBLCLK    = 2;
  LBN_SELCANCEL = 3;
  LBN_SETFOCUS  = 4;
  LBN_KILLFOCUS = 5;

{ Listbox messages }

const
  LB_ADDSTRING            = &H180;
  LB_INSERTSTRING         = &H181;
  LB_DELETESTRING         = &H182;
  LB_SELITEMRANGEEX       = &H183;
  LB_RESETCONTENT         = &H184;
  LB_SETSEL               = &H185;
  LB_SETCURSEL            = &H186;
  LB_GETSEL               = &H187;
  LB_GETCURSEL            = &H188;
  LB_GETTEXT              = &H189;
  LB_GETTEXTLEN           = &H18A;
  LB_GETCOUNT             = &H18B;
  LB_SELECTSTRING         = &H18C;
  LB_DIR                  = &H18D;
  LB_GETTOPINDEX          = &H18E;
  LB_FINDSTRING           = &H18F;
  LB_GETSELCOUNT          = &H190;
  LB_GETSELITEMS          = &H191;
  LB_SETTABSTOPS          = &H192;
  LB_GETHORIZONTALEXTENT  = &H193;
  LB_SETHORIZONTALEXTENT  = &H194;
  LB_SETCOLUMNWIDTH       = &H195;
  LB_ADDFILE              = &H196;
  LB_SETTOPINDEX          = &H197;
  LB_GETITEMRECT          = &H198;
  LB_GETITEMDATA          = &H199;
  LB_SETITEMDATA          = &H19A;
  LB_SELITEMRANGE         = &H19B;
  LB_SETANCHORINDEX       = &H19C;
  LB_GETANCHORINDEX       = &H19D;
  LB_SETCARETINDEX        = &H19E;
  LB_GETCARETINDEX        = &H19F;
  LB_SETITEMHEIGHT        = &H1A0;
  LB_GETITEMHEIGHT        = &H1A1;
  LB_FINDSTRINGEXACT      = &H1A2;
  LB_SETLOCALE            = &H1A5;
  LB_GETLOCALE            = &H1A6;
  LB_SETCOUNT             = &H1A7;
  LB_INITSTORAGE          = &H1A8;
  LB_ITEMFROMPOINT        = &H1A9;
  LB_MSGMAX               = 432;

{ Combo Box Notification Codes }

const
  CBN_ERRSPACE   = (-1);
  CBN_SELCHANGE  = 1;
  CBN_DBLCLK     = 2;
  CBN_SETFOCUS   = 3;
  CBN_KILLFOCUS  = 4;
  CBN_EDITCHANGE = 5;
  CBN_EDITUPDATE = 6;
  CBN_DROPDOWN   = 7;
  CBN_CLOSEUP    = 8;
  CBN_SELENDOK   = 9;
  CBN_SELENDCANCEL = 10;

{ Combo Box messages }

  CB_GETEDITSEL            = &H140;
  CB_LIMITTEXT             = &H141;
  CB_SETEDITSEL            = &H142;
  CB_ADDSTRING             = &H143;
  CB_DELETESTRING          = &H144;
  CB_DIR                   = &H145;
  CB_GETCOUNT              = &H146;
  CB_GETCURSEL             = &H147;
  CB_GETLBTEXT             = &H148;
  CB_GETLBTEXTLEN          = &H149;
  CB_INSERTSTRING          = &H14A;
  CB_RESETCONTENT          = &H14B;
  CB_FINDSTRING            = &H14C;
  CB_SELECTSTRING          = &H14D;
  CB_SETCURSEL             = &H14E;
  CB_SHOWDROPDOWN          = &H14F;
  CB_GETITEMDATA           = &H150;
  CB_SETITEMDATA           = &H151;
  CB_GETDROPPEDCONTROLRECT = &H152;
  CB_SETITEMHEIGHT         = &H153;
  CB_GETITEMHEIGHT         = &H154;
  CB_SETEXTENDEDUI         = &H155;
  CB_GETEXTENDEDUI         = &H156;
  CB_GETDROPPEDSTATE       = &H157;
  CB_FINDSTRINGEXACT       = &H158;
  CB_SETLOCALE             = 345;
  CB_GETLOCALE             = 346;
  CB_GETTOPINDEX           = 347;
  CB_SETTOPINDEX           = 348;
  CB_GETHORIZONTALEXTENT   = 349;
  CB_SETHORIZONTALEXTENT   = 350;
  CB_GETDROPPEDWIDTH       = 351;
  CB_SETDROPPEDWIDTH       = 352;
  CB_INITSTORAGE           = 353;
  CB_MSGMAX                = 354;

{ Edit Control Notification Codes }

const
  EN_SETFOCUS  = &H100;
  EN_KILLFOCUS = &H200;
  EN_CHANGE    = &H300;
  EN_UPDATE    = &H400;
  EN_ERRSPACE  = &H500;
  EN_MAXTEXT   = &H501;
  EN_HSCROLL   = &H601;
  EN_VSCROLL   = &H602;

{ Edit Control Messages }

const
  EM_GETSEL              = &HB0;
  EM_SETSEL              = &HB1;
  EM_GETRECT             = &HB2;
  EM_SETRECT             = &HB3;
  EM_SETRECTNP           = &HB4;
  EM_SCROLL              = &HB5;
  EM_LINESCROLL          = &HB6;
  EM_SCROLLCARET         = &HB7;
  EM_GETMODIFY           = &HB8;
  EM_SETMODIFY           = &HB9;
  EM_GETLINECOUNT        = &HBA;
  EM_LINEINDEX           = &HBB;
  EM_SETHANDLE           = &HBC;
  EM_GETHANDLE           = &HBD;
  EM_GETTHUMB            = &HBE;
  EM_LINELENGTH          = &HC1;
  EM_REPLACESEL          = &HC2;
  EM_GETLINE             = &HC4;
  EM_LIMITTEXT           = &HC5;
  EM_CANUNDO             = &HC6;
  EM_UNDO                = &HC7;
  EM_FMTLINES            = &HC8;
  EM_LINEFROMCHAR        = &HC9;
  EM_SETTABSTOPS         = &HCB;
  EM_SETPASSWORDCHAR     = &HCC;
  EM_EMPTYUNDOBUFFER     = &HCD;
  EM_GETFIRSTVISIBLELINE = &HCE;
  EM_SETREADONLY         = &HCF;
  EM_SETWORDBREAKPROC    = &HD0;
  EM_GETWORDBREAKPROC    = &HD1;
  EM_GETPASSWORDCHAR     = &HD2;
  EM_SETMARGINS          = 211;
  EM_GETMARGINS          = 212;
  EM_SETLIMITTEXT        = EM_LIMITTEXT;    //win40 Name change
  EM_GETLIMITTEXT        = 213;
  EM_POSFROMCHAR         = 214;
  EM_CHARFROMPOS         = 215;

const
  { Scroll bar messages }
  SBM_SETPOS = 224;             { not in win3.1  }
  SBM_GETPOS = 225;             { not in win3.1  }
  SBM_SETRANGE = 226;           { not in win3.1  }
  SBM_SETRANGEREDRAW = 230;     { not in win3.1  }
  SBM_GETRANGE = 227;           { not in win3.1  }
  SBM_ENABLE_ARROWS = 228;      { not in win3.1  }
  SBM_SETSCROLLINFO = 233;
  SBM_GETSCROLLINFO = 234;

{ Dialog messages }

  DM_GETDEFID = (WM_USER+0);
  DM_SETDEFID = (WM_USER+1);
  DM_REPOSITION = (WM_USER+2);

  PSM_PAGEINFO = (WM_USER+100);
  PSM_SHEETINFO = (WM_USER+101);


Hope this helps


0
 

Author Comment

by:aniston
ID: 1453605
One more thing....I have implemented what you said into my code and it works great. It is just that i notice that the System menu (that has the Min,Max, and CLose buttons) "FLICKERS" when i attempt to MAXIMIZE the window. Since i restrict the max and min sizes of the form it looks as if i am missing some WM_ calls that tell the System Menu not to redraw (unless it has to). Can you look over this code and see where i may be making a mistake?


--------
Option Explicit
Public NumTasks As Integer

Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
      Public Const SM_CXFRAME = 32
      Public Const SM_CYFRAME = 33
      Public Const SM_CXBORDER = 5

      'Window messages
      Public Const WM_SETCURSOR = &H20
      Public Const WM_GETMINMAXINFO = &H24

      'Send message
      Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
      Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
      Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
      Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
      Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (lpvDest As Any, ByVal lpvSource As Any, ByVal cbCopy As Long)
      Declare Sub CopyMemoryBack Lib "kernel32.dll" Alias "RtlMoveMemory" (ByVal lpvDest As Any, ByRef lpvSource As Any, ByVal cbCopy As Long)

      Type POINTAPI
              x As Long
              y As Long
      End Type
      Type RECT
              Left As Long
              Top As Long
              Right As Long
              Bottom As Long
      End Type

' This is the structure that is passed by reference (ie an address) to your message handler
' The key items in this structure are ptMinTrackSize and ptMaxTrackSize
Type MINMAXINFO
        ptReserved As POINTAPI
        ptMaxSize As POINTAPI
        ptMaxPosition As POINTAPI
        ptMinTrackSize As POINTAPI
        ptMaxTrackSize As POINTAPI
End Type

      'Hooks
      Declare Function CallWindowProc Lib "user32" Alias _
      "CallWindowProcA" (ByVal lpPrevWndFunc As Long, _
          ByVal hwnd As Long, ByVal Msg As Long, _
          ByVal wParam As Long, ByVal lParam As Long) As Long

      Declare Function SetWindowLong Lib "user32" Alias _
      "SetWindowLongA" (ByVal hwnd As Long, _
      ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

      'SetWindowLong hook message
      Public Const GWL_WNDPROC = -4

      'Persistent hook variables
      Private lpPrevWndProc As Long
      Private gHW As Long
      Private xOffset As Integer

      'Subclass the window
      Public Sub Hook(hwnd As Long)
      Dim dwRet As Long
      xOffset = GetSystemMetrics(SM_CXFRAME)
      xOffset = xOffset + GetSystemMetrics(SM_CXBORDER)
         
          gHW = hwnd
          lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, _
          AddressOf WindowProc)
      End Sub

      'Restrore default message processing
      Public Sub Unhook()
          Dim temp As Long
          temp = SetWindowLong(gHW, GWL_WNDPROC, _
          lpPrevWndProc)
      End Sub

      'Hook procedure
      Function WindowProc(ByVal hw As Long, ByVal uMsg As _
      Long, ByVal wParam As Long, ByVal lParam As Long) As _
      Long
        Dim rct As RECT
        Debug.Print uMsg
          Select Case uMsg
          Case WM_SETCURSOR '32

              Dim pt As POINTAPI
              GetCursorPos pt
              GetWindowRect hw, rct
              If NumTasks = 1 Or (pt.x < rct.Left + xOffset) Or (pt.x > rct.Right - xOffset) Then
                  Exit Function
              Else
                      WindowProc = CallWindowProc(lpPrevWndProc, hw, _
                      uMsg, wParam, lParam)
              End If
          Case WM_GETMINMAXINFO '36
            Dim MinMax As MINMAXINFO
            GetWindowRect hw, rct
           
            CopyMemory MinMax, ByVal lParam, Len(MinMax)
           
            If MinMax.ptMaxPosition.x <= 0 And MinMax.ptMaxPosition.y <= 0 And MinMax.ptMaxSize.x >= Screen.Width \ Screen.TwipsPerPixelX And MinMax.ptMaxSize.y >= Screen.Height \ Screen.TwipsPerPixelY Then
                MinMax.ptMaxPosition.x = rct.Left
                MinMax.ptMaxPosition.y = rct.Top
                MinMax.ptMaxSize.x = 3000 \ Screen.TwipsPerPixelX
                MinMax.ptMaxSize.y = CLng(1034.91 + (MainForm.ButtonLabel(NumTasks).Height * NumTasks)) \ Screen.TwipsPerPixelY
            End If
           
            MinMax.ptMinTrackSize.x = 3000 \ Screen.TwipsPerPixelX
            MinMax.ptMinTrackSize.y = CLng(1034.91 + MainForm.ButtonLabel(NumTasks).Height) \ Screen.TwipsPerPixelY
            MinMax.ptMaxTrackSize.x = 3000 \ Screen.TwipsPerPixelX
            MinMax.ptMaxTrackSize.y = CLng(1034.91 + (MainForm.ButtonLabel(NumTasks).Height * NumTasks)) \ Screen.TwipsPerPixelY
       
            ' Here we copy the datastructure back up to the address passed in the parameters
            ' because Windows will look there for the information.
            CopyMemoryBack ByVal lParam, MinMax, Len(MinMax)
       
            ' This message tells Windows that the message was handled successfully
            WindowProc = 1
            Exit Function
          Case Else
              WindowProc = CallWindowProc(lpPrevWndProc, hw, _
          uMsg, wParam, lParam)
          End Select

      End Function
------

Thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now