----- Original Message -----
From: Trey Pattillo <[EMAIL PROTECTED]>
To: MapInfo List <[EMAIL PROTECTED]>
Sent: Sunday, November 29, 1998 4:51 PM
Subject: MI RE: STOP Min/Max/Close on map window


> This was from Ian Robertson "MI Controlling Map Windows"....
> "I've just been asked if there is a way of preventing a map window
> from being maximised. I didn't think there was, but am I wrong ?"
>
> HERE IT IS......FOR ALL...................
>
> Modify the code as need.
> Also can be used in Integrated Apps, just get the window handle (have
> fun)....
>
> FORMATTING MAY ALTER THE ORIGINAL
> '========= NO Minimize / Maximize / Close =======
> 'by Trey Pattillo
> '29 Nov 98
> '
> 'NOTES
> ' PLACE THIS "IMMEDIATELY" AFTER OPENING WINDOW (map from .....)
> ' in Win9x the Min/Max work together (so I'm told I use NT4x)
> ' if MOVE is "uncommented" then window can not be moved
> ' SIZE by "dragging" still works (more API to Stop)
> ' CHANGE "open" AND "map from" TO WHAT YOU NEED
>
> '=========INCLUDES / DECLARES / DEFINES / VARIABLES
> include "e:\mb40\menu.def"
> include "e:\mb40\mapbasic.def"
> include "e:\mb40\icons.def"
>
>      'deletes the system menu items
>  Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Integer, ByVal
> nPosition As Integer, ByVal wFlags As Integer) As Integer
>
> 'return handle of the window menu (even if not visible)
> Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Integer, ByVal
> bRevert As Integer) As Integer
>
> 'sets window styles
> Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal
> hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As
> Integer
>
> 'gets window style
> Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal
> hwnd As Integer, ByVal nIndex As Integer) As Integer
>
> 'redraw menu bar
> Declare Function DrawMenuBar Lib "user32" Alias "DrawMenuBar" (ByVal hwnd
As
> Integer) As Integer
>
> Define MF_BYCOMMAND &H1024
> Define SC_RESTORE &HF120
> Define SC_MOVE &HF010
> Define SC_SIZE &HF000
> Define SC_MINIMIZE &HF020
> Define SC_MAXIMIZE &HF030
> 'bar
> Define SC_CLOSE &HF060 'also for sysmenu(top left corner)
> 'bar
> 'NEXT (MI custom ???? won't go away)
>
> Define GWL_STYLE -16
> Define SWP_NOSIZE 1
> Define SWP_NOMOVE 2
> define WS_MINIMIZEBOX &H20000
> define WS_MAXIMIZEBOX &H10000
>
> DIM hMenuHandle as Integer
> DIM hWnd as Integer
> DIM RC as Integer
> Dim L as Integer
>
> '==================================================
> ' REMOVE/ALTER THESE TWO LINE -- MY TEST STUFF
> '==================================================
> open table "e:\mi45\county\nu_base"
> map from nu_base
> '==================================================
>
> ' MAIN CODE FOLLOWS:===============================
> 'let MI get the WinHandle of window
> hWnd=WindowInfo(frontwindow(),Win_info_Wnd)
>
> 'need handle for window "menu"
> hMenuHandle=GetSystemMenu(hwnd, False)
>
> If (hMenuHandle <> 0) Then 'exit if handle not returned
>
> 'removes SysMenu>MINIMIZE (no evvect on "button" see below)
> RC=DeleteMenu(hMenuHandle, SC_MINIMIZE, MF_BYCOMMAND)
>
> 'removes SysMenu>MAXIMIZE (no effect on "button" see below)
> RC=DeleteMenu(hMenuHandle, SC_MAXIMIZE, MF_BYCOMMAND)
>
> 'removes SysMenu>CLOSE & disables "X"
> RC=DeleteMenu(hMenuHandle, SC_CLOSE, MF_BYCOMMAND)
>
> 'remove SysMenu>MOVE [can not move window]
> ' (remove comment to use)
> ' RC=DeleteMenu(hMenuHandle, SC_MOVE, MF_BYCOMMAND)
>
> 'removes SysMenu>RESTORE (keep if you allow minimize)
> RC=DeleteMenu(hMenuHandle, SC_RESTORE, MF_BYCOMMAND)
>
> 'removes SyMenu>SIZE (dragging still works)
> RC=DeleteMenu(hMenuHandle, SC_SIZE, MF_BYCOMMAND)
>
> 'these four lines remove bar and everything except NEXT (MapInfo custom
> ?????)
> 'from SysMenu (start at TOP "0" then rest pulls up to 0)
> 'if you leave some items (they are number top/bottom 0...x)
> '
> RC=DeleteMenu(hMenuHandle, 0, MF_BYCOMMAND)
> RC=DeleteMenu(hMenuHandle, 0, MF_BYCOMMAND)
> RC=DeleteMenu(hMenuHandle, 0, MF_BYCOMMAND)
> RC=DeleteMenu(hMenuHandle, 0, MF_BYCOMMAND)
>
> '=========KILL Min/Max BUTTONS
> 'get the window style settings
> L=GetWindowLong(hWnd, GWL_STYLE)
>
> 'remove the MinBox
> L=L-WS_MINIMIZEBOX
>
> 'remove the MaxBox
> L=L-WS_MAXIMIZEBOX
>
> 'set the new style
> L=SetWindowLong(hWnd, GWL_STYLE, L)
>
> 'force a "redraw"
> RC=DrawMenuBar(hWnd)
> '==========
> end if
>
> --------------------------------------------------------------------------
--
> --------------
> Trey Pattillo
> [EMAIL PROTECTED]
> http://www.wap3.com
>
> "Real Programmers use C......it's the only one they can spell"
>
>
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to