Page 1 of 1

DisplaySystemMetrics - jaPBe plugin & standalone

Posted: Tue Apr 07, 2009 11:27 pm
by sverson
I needed a little helper.
Maybe someone else can use it. :wink:

Code: Select all

; **********************
; DisplaySystemMetrics
; jaPBe plugin & standalone
; 2009-04-08 sverson
; **********************

EnableExplicit

#SM_DIGITIZER              = 94
#SM_MAXIMUMTOUCHES         = 95
#SM_ENTRYCOUNT             = 92
#SM_SendCode               = 1
#SM_SendConstant           = 2
#SM_SendValue              = 3
#mywm_Plugin_Cancel        = #WM_USER+18
#mywm_plugin_EnablejaPBe   = #WM_USER+20
#WMCD_InsertText           = 2
#wmcd_Fatal_Error          = 6
#wmcd_Compilation_Finished = 10

Global Dim _SM_No.l(#SM_ENTRYCOUNT)
Global Dim _SM_Name.s(#SM_ENTRYCOUNT,1)
Global _SM_TableNo.l, _SM_TableID.l, _SM_InfoNo.l, _SM_InfoID.l
Global _SM_ButtonInsertCodeNo.l, _SM_ButtonInsertCodeID.l, _SM_ButtonInsertConstantNo.l, _SM_ButtonInsertConstantID.l, _SM_ButtonInsertValueNo.l, _SM_ButtonInsertValueID.l
Global _SM_ButtonQuitNo.l, _SM_ButtonQuitID.l, _SM_CheckBoxjaPBeNo.l, _SM_CheckBoxjaPBeID.l
Global _SM_MainWIndowNo.l, _SM_MainWIndowID.l, _SM_EditorHwnd.l=0
Global _SM_FontID.l = GetGadgetFont(#PB_Default)
Global _SM_ClipBoard$ = GetClipboardText()
Global jaPBe_Handle.l, jaPBe_Version$, jaPBe_CompilerMsg.s, jaPBe_CompilerType.l, jaPBe_Selection.l, jaPBe_CurrentWord.l, jaPBe_CompleteText.l, jaPBe_CurrentLine.l, SM_Parameter$, jaPBe_Found.b=#False

Procedure Callback(WindowId, message, wParam, lParam)
  Protected result = #PB_ProcessPureBasicEvents
  Protected *cd.COPYDATASTRUCT
  If message=#WM_COPYDATA
    *cd.COPYDATASTRUCT=lParam
    result=#False
    If wParam=jaPBe_Handle
      Select *cd\dwData
        Case $FFFFFFFF
        Default
          If *cd\dwData>=#wmcd_Fatal_Error And *cd\dwData<=#wmcd_Compilation_Finished
            jaPBe_CompilerMsg=PeekS(*cd\lpData,*cd\cbData)
            If jaPBe_CompilerMsg=Chr(255)
              jaPBe_CompilerMsg=""
            EndIf
            jaPBe_CompilerType=*cd\dwData
            result=#True
          EndIf
      EndSelect
    Else
      MessageRequester("jaPBe-Plugin","I got a message NOT from jaPBe!")
    EndIf
  EndIf
  ProcedureReturn result
EndProcedure

Procedure SendDataS(ziel,Type,Message$)
  Protected cd.COPYDATASTRUCT
  cd\dwData=Type
  cd\cbData=Len(Message$)+1
  cd\lpData=@Message$
  ProcedureReturn SendMessage_(ziel,#WM_COPYDATA,WindowID(1),cd)
EndProcedure

Procedure.l _SM_ColumnAutoSize(GadgetID.l)
  Protected AktColumn.l, ColumnCount.l, TableWidth.l=0
  ColumnCount = SendMessage_(SendMessage_(GadgetID,#LVM_GETHEADER,0,0),#HDM_GETITEMCOUNT,#Null,#Null)-1
  For AktColumn=0 To ColumnCount
    SendMessage_(GadgetID,#LVM_SETCOLUMNWIDTH,AktColumn,#LVSCW_AUTOSIZE)
    TableWidth + SendMessage_(GadgetID, #LVM_GETCOLUMNWIDTH, AktColumn, 0)
  Next
  ProcedureReturn TableWidth
EndProcedure

Procedure _SM_Init()
  Protected SM_Pos.l =0
  _SM_No(SM_Pos)= #SM_ARRANGE : _SM_Name(SM_Pos,0)= "SM_ARRANGE" : _SM_Name(SM_Pos,1)= "The flags that specify how the system arranged minimized windows. For more information, see the Remarks section in this topic." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CLEANBOOT : _SM_Name(SM_Pos,0)= "SM_CLEANBOOT" : _SM_Name(SM_Pos,1)= "The value that specifies how the system is started:"+Chr(13)+"  * 0 Normal boot"+Chr(13)+"  * 1 Fail-safe boot"+Chr(13)+"  * 2 Fail-safe with network boot"+Chr(13)+"A fail-safe boot (also called SafeBoot, Safe Mode, or Clean Boot) bypasses the user startup files." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CMONITORS : _SM_Name(SM_Pos,0)= "SM_CMONITORS" : _SM_Name(SM_Pos,1)= "The number of display monitors on a desktop. For more information, see the Remarks section in this topic." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CMOUSEBUTTONS : _SM_Name(SM_Pos,0)= "SM_CMOUSEBUTTONS" : _SM_Name(SM_Pos,1)= "The number of buttons on a mouse, or zero if no mouse is installed." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXBORDER : _SM_Name(SM_Pos,0)= "SM_CXBORDER" : _SM_Name(SM_Pos,1)= "The width of a window border, in pixels. This is equivalent to the #SM_CXEDGE value for windows with the 3-D look." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXCURSOR : _SM_Name(SM_Pos,0)= "SM_CXCURSOR" : _SM_Name(SM_Pos,1)= "The width of a cursor, in pixels. The system cannot create cursors of other sizes." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXDLGFRAME : _SM_Name(SM_Pos,0)= "SM_CXDLGFRAME" : _SM_Name(SM_Pos,1)= "This value is the same as #SM_CXFIXEDFRAME." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXDOUBLECLK : _SM_Name(SM_Pos,0)= "SM_CXDOUBLECLK" : _SM_Name(SM_Pos,1)= "The width of the rectangle around the location of a first click in a double-click sequence, in pixels. The second click must occur within the rectangle that is defined by #SM_CXDOUBLECLK and #SM_CYDOUBLECLK for the system to consider the two clicks a double-click. The two clicks must also occur within a specified time."+Chr(13)+"To set the width of the double-click rectangle, call SystemParametersInfo with SPI_SETDOUBLECLKWIDTH." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXDRAG : _SM_Name(SM_Pos,0)= "SM_CXDRAG" : _SM_Name(SM_Pos,1)= "The number of pixels on either side of a mouse-down point that the mouse pointer can move before a drag operation begins. This allows the user to click and release the mouse button easily without unintentionally starting a drag operation. If this value is negative, it is subtracted from the left of the mouse-down point and added to the right of it." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXEDGE : _SM_Name(SM_Pos,0)= "SM_CXEDGE" : _SM_Name(SM_Pos,1)= "The width of a 3-D border, in pixels. This metric is the 3-D counterpart of #SM_CXBORDER." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXFIXEDFRAME : _SM_Name(SM_Pos,0)= "SM_CXFIXEDFRAME" : _SM_Name(SM_Pos,1)= "The thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels. #SM_CXFIXEDFRAME is the height of the horizontal border, and #SM_CYFIXEDFRAME is the width of the vertical border."+Chr(13)+"This value is the same as #SM_CXDLGFRAME." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXFOCUSBORDER : _SM_Name(SM_Pos,0)= "SM_CXFOCUSBORDER" : _SM_Name(SM_Pos,1)= "The width of the left and right edges of the focus rectangle that the DrawFocusRect draws. This value is in pixels."+Chr(13)+"Windows 2000:  This value is not supported." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXFRAME : _SM_Name(SM_Pos,0)= "SM_CXFRAME" : _SM_Name(SM_Pos,1)= "This value is the same as #SM_CXSIZEFRAME." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXFULLSCREEN : _SM_Name(SM_Pos,0)= "SM_CXFULLSCREEN" : _SM_Name(SM_Pos,1)= "The width of the client area for a full-screen window on the primary display monitor, in pixels. To get the coordinates of the portion of the screen that is not obscured by the system taskbar or by application desktop toolbars, call the SystemParametersInfo function with the SPI_GETWORKAREA value." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXHSCROLL : _SM_Name(SM_Pos,0)= "SM_CXHSCROLL" : _SM_Name(SM_Pos,1)= "The width of the arrow bitmap on a horizontal scroll bar, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXHTHUMB : _SM_Name(SM_Pos,0)= "SM_CXHTHUMB" : _SM_Name(SM_Pos,1)= "The width of the thumb box in a horizontal scroll bar, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXICON : _SM_Name(SM_Pos,0)= "SM_CXICON" : _SM_Name(SM_Pos,1)= "The default width of an icon, in pixels. The LoadIcon function can load only icons with the dimensions that #SM_CXICON and #SM_CYICON specifies." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXICONSPACING : _SM_Name(SM_Pos,0)= "SM_CXICONSPACING" : _SM_Name(SM_Pos,1)= "The width of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of size #SM_CXICONSPACING by #SM_CYICONSPACING when arranged. This value is always greater than or equal to #SM_CXICON." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXMAXIMIZED : _SM_Name(SM_Pos,0)= "SM_CXMAXIMIZED" : _SM_Name(SM_Pos,1)= "The default width, in pixels, of a maximized top-level window on the primary display monitor." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXMAXTRACK : _SM_Name(SM_Pos,0)= "SM_CXMAXTRACK" : _SM_Name(SM_Pos,1)= "The default maximum width of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXMENUCHECK : _SM_Name(SM_Pos,0)= "SM_CXMENUCHECK" : _SM_Name(SM_Pos,1)= "The width of the default menu check-mark bitmap, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXMENUSIZE : _SM_Name(SM_Pos,0)= "SM_CXMENUSIZE" : _SM_Name(SM_Pos,1)= "The width of menu bar buttons, such as the child window close button that is used in the multiple document interface, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXMIN : _SM_Name(SM_Pos,0)= "SM_CXMIN" : _SM_Name(SM_Pos,1)= "The minimum width of a window, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXMINIMIZED : _SM_Name(SM_Pos,0)= "SM_CXMINIMIZED" : _SM_Name(SM_Pos,1)= "The width of a minimized window, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXMINSPACING : _SM_Name(SM_Pos,0)= "SM_CXMINSPACING" : _SM_Name(SM_Pos,1)= "The width of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged. This value is always greater than or equal to #SM_CXMINIMIZED." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXMINTRACK : _SM_Name(SM_Pos,0)= "SM_CXMINTRACK" : _SM_Name(SM_Pos,1)= "The minimum tracking width of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXPADDEDBORDER : _SM_Name(SM_Pos,0)= "SM_CXPADDEDBORDER" : _SM_Name(SM_Pos,1)= "The amount of border padding for captioned windows, in pixels."+Chr(13)+"Windows XP/2000:  This value is not supported." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXSCREEN : _SM_Name(SM_Pos,0)= "SM_CXSCREEN" : _SM_Name(SM_Pos,1)= "The width of the screen of the primary display monitor, in pixels. This is the same value obtained by calling GetDeviceCaps as follows: GetDeviceCaps( hdcPrimaryMonitor, HORZRES)." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXSIZE : _SM_Name(SM_Pos,0)= "SM_CXSIZE" : _SM_Name(SM_Pos,1)= "The width of a button in a window caption or title bar, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXSIZEFRAME : _SM_Name(SM_Pos,0)= "SM_CXSIZEFRAME" : _SM_Name(SM_Pos,1)= "The thickness of the sizing border around the perimeter of a window that can be resized, in pixels. #SM_CXSIZEFRAME is the width of the horizontal border, and #SM_CYSIZEFRAME is the height of the vertical border."+Chr(13)+"This value is the same as #SM_CXFRAME." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXSMICON : _SM_Name(SM_Pos,0)= "SM_CXSMICON" : _SM_Name(SM_Pos,1)= "The recommended width of a small icon, in pixels. Small icons typically appear in window captions and in small icon view." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXSMSIZE : _SM_Name(SM_Pos,0)= "SM_CXSMSIZE" : _SM_Name(SM_Pos,1)= "The width of small caption buttons, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXVIRTUALSCREEN : _SM_Name(SM_Pos,0)= "SM_CXVIRTUALSCREEN" : _SM_Name(SM_Pos,1)= "The width of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors. The #SM_XVIRTUALSCREEN metric is the coordinates for the left side of the virtual screen." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CXVSCROLL : _SM_Name(SM_Pos,0)= "SM_CXVSCROLL" : _SM_Name(SM_Pos,1)= "The width of a vertical scroll bar, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYBORDER : _SM_Name(SM_Pos,0)= "SM_CYBORDER" : _SM_Name(SM_Pos,1)= "The height of a window border, in pixels. This is equivalent to the #SM_CYEDGE value for windows with the 3-D look." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYCAPTION : _SM_Name(SM_Pos,0)= "SM_CYCAPTION" : _SM_Name(SM_Pos,1)= "The height of a caption area, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYCURSOR : _SM_Name(SM_Pos,0)= "SM_CYCURSOR" : _SM_Name(SM_Pos,1)= "The height of a cursor, in pixels. The system cannot create cursors of other sizes." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYDLGFRAME : _SM_Name(SM_Pos,0)= "SM_CYDLGFRAME" : _SM_Name(SM_Pos,1)= "This value is the same as #SM_CYFIXEDFRAME." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYDOUBLECLK : _SM_Name(SM_Pos,0)= "SM_CYDOUBLECLK" : _SM_Name(SM_Pos,1)= "The height of the rectangle around the location of a first click in a double-click sequence, in pixels. The second click must occur within the rectangle defined by #SM_CXDOUBLECLK and #SM_CYDOUBLECLK for the system to consider the two clicks a double-click. The two clicks must also occur within a specified time."+Chr(13)+"To set the height of the double-click rectangle, call SystemParametersInfo with SPI_SETDOUBLECLKHEIGHT." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYDRAG : _SM_Name(SM_Pos,0)= "SM_CYDRAG" : _SM_Name(SM_Pos,1)= "The number of pixels above and below a mouse-down point that the mouse pointer can move before a drag operation begins. This allows the user to click and release the mouse button easily without unintentionally starting a drag operation. If this value is negative, it is subtracted from above the mouse-down point and added below it." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYEDGE : _SM_Name(SM_Pos,0)= "SM_CYEDGE" : _SM_Name(SM_Pos,1)= "The height of a 3-D border, in pixels. This is the 3-D counterpart of #SM_CYBORDER." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYFIXEDFRAME : _SM_Name(SM_Pos,0)= "SM_CYFIXEDFRAME" : _SM_Name(SM_Pos,1)= "The thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels. #SM_CXFIXEDFRAME is the height of the horizontal border, and #SM_CYFIXEDFRAME is the width of the vertical border."+Chr(13)+"This value is the same as #SM_CYDLGFRAME." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYFOCUSBORDER : _SM_Name(SM_Pos,0)= "SM_CYFOCUSBORDER" : _SM_Name(SM_Pos,1)= "The height of the top and bottom edges of the focus rectangle drawn by DrawFocusRect. This value is in pixels."+Chr(13)+"Windows 2000:  This value is not supported." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYFRAME : _SM_Name(SM_Pos,0)= "SM_CYFRAME" : _SM_Name(SM_Pos,1)= "This value is the same as #SM_CYSIZEFRAME." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYFULLSCREEN : _SM_Name(SM_Pos,0)= "SM_CYFULLSCREEN" : _SM_Name(SM_Pos,1)= "The height of the client area for a full-screen window on the primary display monitor, in pixels. To get the coordinates of the portion of the screen not obscured by the system taskbar or by application desktop toolbars, call the SystemParametersInfo function with the SPI_GETWORKAREA value." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYHSCROLL : _SM_Name(SM_Pos,0)= "SM_CYHSCROLL" : _SM_Name(SM_Pos,1)= "The height of a horizontal scroll bar, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYICON : _SM_Name(SM_Pos,0)= "SM_CYICON" : _SM_Name(SM_Pos,1)= "The default height of an icon, in pixels. The LoadIcon function can load only icons with the dimensions #SM_CXICON and #SM_CYICON." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYICONSPACING : _SM_Name(SM_Pos,0)= "SM_CYICONSPACING" : _SM_Name(SM_Pos,1)= "The height of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of size #SM_CXICONSPACING by #SM_CYICONSPACING when arranged. This value is always greater than or equal to #SM_CYICON." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYKANJIWINDOW : _SM_Name(SM_Pos,0)= "SM_CYKANJIWINDOW" : _SM_Name(SM_Pos,1)= "For double byte character set versions of the system, this is the height of the Kanji window at the bottom of the screen, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYMAXIMIZED : _SM_Name(SM_Pos,0)= "SM_CYMAXIMIZED" : _SM_Name(SM_Pos,1)= "The default height, in pixels, of a maximized top-level window on the primary display monitor." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYMAXTRACK : _SM_Name(SM_Pos,0)= "SM_CYMAXTRACK" : _SM_Name(SM_Pos,1)= "The default maximum height of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYMENU : _SM_Name(SM_Pos,0)= "SM_CYMENU" : _SM_Name(SM_Pos,1)= "The height of a single-line menu bar, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYMENUCHECK : _SM_Name(SM_Pos,0)= "SM_CYMENUCHECK" : _SM_Name(SM_Pos,1)= "The height of the default menu check-mark bitmap, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYMENUSIZE : _SM_Name(SM_Pos,0)= "SM_CYMENUSIZE" : _SM_Name(SM_Pos,1)= "The height of menu bar buttons, such as the child window close button that is used in the multiple document interface, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYMIN : _SM_Name(SM_Pos,0)= "SM_CYMIN" : _SM_Name(SM_Pos,1)= "The minimum height of a window, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYMINIMIZED : _SM_Name(SM_Pos,0)= "SM_CYMINIMIZED" : _SM_Name(SM_Pos,1)= "The height of a minimized window, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYMINSPACING : _SM_Name(SM_Pos,0)= "SM_CYMINSPACING" : _SM_Name(SM_Pos,1)= "The height of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged. This value is always greater than or equal to #SM_CYMINIMIZED." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYMINTRACK : _SM_Name(SM_Pos,0)= "SM_CYMINTRACK" : _SM_Name(SM_Pos,1)= "The minimum tracking height of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYSCREEN : _SM_Name(SM_Pos,0)= "SM_CYSCREEN" : _SM_Name(SM_Pos,1)= "The height of the screen of the primary display monitor, in pixels. This is the same value obtained by calling GetDeviceCaps as follows: GetDeviceCaps( hdcPrimaryMonitor, VERTRES)." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYSIZE : _SM_Name(SM_Pos,0)= "SM_CYSIZE" : _SM_Name(SM_Pos,1)= "The height of a button in a window caption or title bar, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYSIZEFRAME : _SM_Name(SM_Pos,0)= "SM_CYSIZEFRAME" : _SM_Name(SM_Pos,1)= "The thickness of the sizing border around the perimeter of a window that can be resized, in pixels. #SM_CXSIZEFRAME is the width of the horizontal border, and #SM_CYSIZEFRAME is the height of the vertical border."+Chr(13)+"This value is the same as #SM_CYFRAME." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYSMCAPTION : _SM_Name(SM_Pos,0)= "SM_CYSMCAPTION" : _SM_Name(SM_Pos,1)= "The height of a small caption, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYSMICON : _SM_Name(SM_Pos,0)= "SM_CYSMICON" : _SM_Name(SM_Pos,1)= "The recommended height of a small icon, in pixels. Small icons typically appear in window captions and in small icon view." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYSMSIZE : _SM_Name(SM_Pos,0)= "SM_CYSMSIZE" : _SM_Name(SM_Pos,1)= "The height of small caption buttons, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYVIRTUALSCREEN : _SM_Name(SM_Pos,0)= "SM_CYVIRTUALSCREEN" : _SM_Name(SM_Pos,1)= "The height of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors. The #SM_YVIRTUALSCREEN metric is the coordinates for the top of the virtual screen." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYVSCROLL : _SM_Name(SM_Pos,0)= "SM_CYVSCROLL" : _SM_Name(SM_Pos,1)= "The height of the arrow bitmap on a vertical scroll bar, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_CYVTHUMB : _SM_Name(SM_Pos,0)= "SM_CYVTHUMB" : _SM_Name(SM_Pos,1)= "The height of the thumb box in a vertical scroll bar, in pixels." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_DBCSENABLED : _SM_Name(SM_Pos,0)= "SM_DBCSENABLED" : _SM_Name(SM_Pos,1)= "Nonzero if User32.dll supports DBCS; otherwise, 0." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_DEBUG : _SM_Name(SM_Pos,0)= "SM_DEBUG" : _SM_Name(SM_Pos,1)= "Nonzero if the debug version of User.exe is installed; otherwise, 0." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_DIGITIZER : _SM_Name(SM_Pos,0)= "SM_DIGITIZER" : _SM_Name(SM_Pos,1)= "Nonzero if the current operating system is Windows 7 or Windows Server 2008 R2 and the Tablet PC Input service is started; otherwise, 0. The return value is a bit mask that specifies the type of digitizer input supported by the device. For more information, see Remarks."+Chr(13)+"Windows Server 2008, Windows Vista, and Windows XP/2000:  This value is not supported." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_IMMENABLED : _SM_Name(SM_Pos,0)= "SM_IMMENABLED" : _SM_Name(SM_Pos,1)= "Nonzero if Input Method Manager/Input Method Editor features are enabled; otherwise, 0."+Chr(13)+"#SM_IMMENABLED indicates whether the system is ready to use a Unicode-based IME on a Unicode application. To ensure that a language-dependent IME works, check #SM_DBCSENABLED and the system ANSI code page. Otherwise the ANSI-to-Unicode conversion may not be performed correctly, or some components like fonts or registry settings may not be present." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_MAXIMUMTOUCHES : _SM_Name(SM_Pos,0)= "SM_MAXIMUMTOUCHES" : _SM_Name(SM_Pos,1)= "Nonzero if there are digitizers in the system; otherwise, 0."+Chr(13)+"#SM_MAXIMUMTOUCHES returns the aggregate maximum of the maximum number of contacts supported by every digitizer in the system. If the system has only single-touch digitizers, the return value is 1. If the system has multi-touch digitizers, the return value is the number of simultaneous contacts the hardware can provide."+Chr(13)+"Windows Server 2008, Windows Vista, and Windows XP/2000:  This value is not supported." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_MEDIACENTER : _SM_Name(SM_Pos,0)= "SM_MEDIACENTER" : _SM_Name(SM_Pos,1)= "Nonzero if the current operating system is the Windows XP, Media Center Edition, 0 if not." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_MENUDROPALIGNMENT : _SM_Name(SM_Pos,0)= "SM_MENUDROPALIGNMENT" : _SM_Name(SM_Pos,1)= "Nonzero if drop-down menus are right-aligned with the corresponding menu-bar item; 0 if the menus are left-aligned." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_MIDEASTENABLED : _SM_Name(SM_Pos,0)= "SM_MIDEASTENABLED" : _SM_Name(SM_Pos,1)= "Nonzero if the system is enabled for Hebrew and Arabic languages, 0 if not." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_MOUSEPRESENT : _SM_Name(SM_Pos,0)= "SM_MOUSEPRESENT" : _SM_Name(SM_Pos,1)= "Nonzero if a mouse is installed; otherwise, 0. This value is rarely zero, because of support for virtual mice and because some systems detect the presence of the port instead of the presence of a mouse." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_MOUSEHORIZONTALWHEELPRESENT : _SM_Name(SM_Pos,0)= "SM_MOUSEHORIZONTALWHEELPRESENT" : _SM_Name(SM_Pos,1)= "Nonzero if a mouse with a horizontal scroll wheel is installed; otherwise 0." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_MOUSEWHEELPRESENT : _SM_Name(SM_Pos,0)= "SM_MOUSEWHEELPRESENT" : _SM_Name(SM_Pos,1)= "Nonzero if a mouse with a vertical scroll wheel is installed; otherwise 0." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_NETWORK : _SM_Name(SM_Pos,0)= "SM_NETWORK" : _SM_Name(SM_Pos,1)= "The least significant bit is set if a network is present; otherwise, it is cleared. The other bits are reserved for future use." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_PENWINDOWS : _SM_Name(SM_Pos,0)= "SM_PENWINDOWS" : _SM_Name(SM_Pos,1)= "Nonzero if the Microsoft Windows for Pen computing extensions are installed; zero otherwise." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_REMOTECONTROL	 : _SM_Name(SM_Pos,0)= "SM_REMOTECONTROL" : _SM_Name(SM_Pos,1)= "This system metric is used in a Terminal Services environment. Its value is nonzero if the current session is remotely controlled; otherwise, 0." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_REMOTESESSION	 : _SM_Name(SM_Pos,0)= "SM_REMOTESESSION" : _SM_Name(SM_Pos,1)= "This system metric is used in a Terminal Services environment. If the calling process is associated with a Terminal Services client session, the return value is nonzero. If the calling process is associated with the Terminal Services console session, the return value is 0."+Chr(13)+"Windows Server 2003 and Windows XP:  The console session is not necessarily the physical console. For more information, see WTSGetActiveConsoleSessionId." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_SAMEDISPLAYFORMAT : _SM_Name(SM_Pos,0)= "SM_SAMEDISPLAYFORMAT" : _SM_Name(SM_Pos,1)= "Nonzero if all the display monitors have the same color format, otherwise, 0. Two displays can have the same bit depth, but different color formats. For example, the red, green, and blue pixels can be encoded with different numbers of bits, or those bits can be located in different places in a pixel color value." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_SECURE : _SM_Name(SM_Pos,0)= "SM_SECURE" : _SM_Name(SM_Pos,1)= "This system metric should be ignored; it always returns 0." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_SERVERR2 : _SM_Name(SM_Pos,0)= "SM_SERVERR2" : _SM_Name(SM_Pos,1)= "The build number if the system is Windows Server 2003 R2; otherwise, 0." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_SHOWSOUNDS : _SM_Name(SM_Pos,0)= "SM_SHOWSOUNDS" : _SM_Name(SM_Pos,1)= "Nonzero if the user requires an application to present information visually in situations where it would otherwise present the information only in audible form; otherwise, 0." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_SHUTTINGDOWN	 : _SM_Name(SM_Pos,0)= "SM_SHUTTINGDOWN" : _SM_Name(SM_Pos,1)= "Nonzero if the current session is shutting down; otherwise, 0."+Chr(13)+"Windows 2000:  This value is not supported." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_SLOWMACHINE : _SM_Name(SM_Pos,0)= "SM_SLOWMACHINE" : _SM_Name(SM_Pos,1)= "Nonzero if the computer has a low-end (slow) processor; otherwise, 0." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_STARTER : _SM_Name(SM_Pos,0)= "SM_STARTER" : _SM_Name(SM_Pos,1)= "Nonzero if the current operating system is Windows XP Starter Edition; otherwise, 0." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_SWAPBUTTON : _SM_Name(SM_Pos,0)= "SM_SWAPBUTTON" : _SM_Name(SM_Pos,1)= "Nonzero if the meanings of the left and right mouse buttons are swapped; otherwise, 0." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_TABLETPC : _SM_Name(SM_Pos,0)= "SM_TABLETPC" : _SM_Name(SM_Pos,1)= "Nonzero if the current operating system is the Windows XP Tablet PC edition or if the current operating system is Windows Vista or Windows 7 and the Tablet PC Input service is started; otherwise, 0. The #SM_DIGITIZER setting indicates the type of digitizer input supported by a device running Windows 7 or Windows Server 2008 R2. For more information, see Remarks." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_XVIRTUALSCREEN : _SM_Name(SM_Pos,0)= "SM_XVIRTUALSCREEN" : _SM_Name(SM_Pos,1)= "The coordinates for the left side of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. The #SM_CXVIRTUALSCREEN metric is the width of the virtual screen." : SM_Pos+1
  _SM_No(SM_Pos)= #SM_YVIRTUALSCREEN : _SM_Name(SM_Pos,0)= "SM_YVIRTUALSCREEN" : _SM_Name(SM_Pos,1)= "The coordinates for the top of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. The #SM_CYVIRTUALSCREEN metric is the height of the virtual screen. "
EndProcedure

Procedure _SM_FillTable()
  Protected SM_Pos.l, SM_ID$, SM_NAME$, SM_INFO$
  For SM_Pos = 0 To #SM_ENTRYCOUNT
    SM_ID$   = "$"+RSet(Hex(_SM_No(SM_Pos)),4,"0")+Chr(10)+"("+RSet(Str(_SM_No(SM_Pos)),4,"0")+")"+Chr(10)
    SM_NAME$ = _SM_Name(SM_Pos,0)+Chr(10)
    SM_INFO$ = Str(GetSystemMetrics_(_SM_No(SM_Pos)))+Chr(10)+Left(_SM_Name(SM_Pos,1),50)+"..."
    AddGadgetItem(_SM_TableNo,-1,SM_ID$+SM_NAME$+SM_INFO$)
  Next 
EndProcedure

Procedure _SM_InitTable()
  Protected SM_Pos.l, SM_Flags.l
  SM_Flags = #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#LVS_NOCOLUMNHEADER
  _SM_TableNo = ListIconGadget(#PB_Any,0,0,0,0,"",0,SM_Flags)
  _SM_TableID = GadgetID(_SM_TableNo)
  For SM_Pos = 1 To 4
    AddGadgetColumn(_SM_TableNo,0,"",0)
  Next
  _SM_FillTable()
  SetGadgetState(_SM_TableNo,0) 
EndProcedure

Procedure _SM_InitInfo()
  Protected SM_Flags.l
  SM_Flags = #PB_Editor_ReadOnly
  _SM_InfoNo = EditorGadget(#PB_Any,0,0,0,0,SM_Flags)
  _SM_InfoID = GadgetID(_SM_InfoNo)
  SendMessage_(_SM_InfoID, #EM_SETTARGETDEVICE, 0, 0)
  SendMessage_(_SM_InfoID, #EM_SETMARGINS, #EC_LEFTMARGIN, 5)
  SendMessage_(_SM_InfoID, #EM_SETMARGINS, #EC_RIGHTMARGIN, 5)
EndProcedure

Procedure _SM_InitButtons()
  _SM_ButtonInsertCodeNo     = ButtonGadget(#PB_Any,0,0,0,0,"jaPBe: insert code")
  _SM_ButtonInsertCodeID     = GadgetID(_SM_ButtonInsertCodeNo)
  _SM_ButtonInsertConstantNo = ButtonGadget(#PB_Any,0,0,0,0,"jaPBe: insert constant")
  _SM_ButtonInsertConstantID = GadgetID(_SM_ButtonInsertConstantNo)
  _SM_ButtonInsertValueNo    = ButtonGadget(#PB_Any,0,0,0,0,"jaPBe: insert value")
  _SM_ButtonInsertValueID    = GadgetID(_SM_ButtonInsertValueNo)
  _SM_CheckBoxjaPBeNo        = CheckBoxGadget(#PB_Any,0,0,0,0,"copy code to clipBoard")
  _SM_CheckBoxjaPBeID        = GadgetID(_SM_CheckBoxjaPBeNo)
  _SM_ButtonQuitNo           = ButtonGadget(#PB_Any,0,0,0,0,"Quit")
  _SM_ButtonQuitID           = GadgetID(_SM_ButtonQuitNo)
EndProcedure

Procedure.l _SM_ButtonWidth(SM_ButtonNo.l)
  Protected SM_ButtonWidth.l
  StartDrawing(WindowOutput(_SM_MainWIndowNo))
    DrawingFont(_SM_FontID)
    If SM_ButtonNo
      SM_ButtonWidth = TextWidth(GetGadgetText(SM_ButtonNo))
    Else
      SM_ButtonWidth = TextWidth("copy code to clipBoard") + GetSystemMetrics_(#SM_CXICON)
    EndIf
  StopDrawing()
  ProcedureReturn SM_ButtonWidth + GetSystemMetrics_(#SM_CXDLGFRAME)*2 + GetSystemMetrics_(#SM_CXFRAME)*2
EndProcedure

Procedure _SM_Resize()
  Protected SM_TableWidth.l, SM_TableHeight.l, SM_InfoWidth.l, SM_InfoHeight.l, SM_WindowX.l, SM_WindowY.l, SM_WindowHeight.l, SM_ButtonY.l, SM_ButtonX.l, SM_ButtonWidth.l
  SM_TableWidth   = _SM_ColumnAutoSize(GadgetID(_SM_TableNo))+GetSystemMetrics_(#SM_CXVSCROLL)+GetSystemMetrics_(#SM_CXFRAME)
  SM_TableHeight  = (SendMessage_(_SM_TableID, #LVM_GETITEMSPACING, #True, 0) >> 16) * 20 + GetSystemMetrics_(#SM_CYFRAME)
  SM_InfoWidth    = SM_TableWidth
  SM_InfoHeight   = SM_TableHeight >> 2
  SM_WindowHeight = SM_TableHeight+SM_InfoHeight+GetSystemMetrics_(#SM_CYFRAME)*3+GetSystemMetrics_(#SM_CYMENU)
  SM_WindowX      = (GetSystemMetrics_(#SM_CXFULLSCREEN)-SM_TableWidth-GetSystemMetrics_(#SM_CYFRAME)*2)>>1
  SM_WindowY      = (GetSystemMetrics_(#SM_CYFULLSCREEN)-SM_WindowHeight-GetSystemMetrics_(#SM_CYFRAME)*2)>>1
  SM_ButtonX      = GetSystemMetrics_(#SM_CXFRAME)
  SM_ButtonY      = SM_WindowHeight-(GetSystemMetrics_(#SM_CYFRAME)+GetSystemMetrics_(#SM_CYMENU))
  ResizeGadget(_SM_TableNo,#PB_Ignore,#PB_Ignore,SM_TableWidth,SM_TableHeight)
  ResizeGadget(_SM_InfoNo,#PB_Ignore,SM_TableHeight+GetSystemMetrics_(#SM_CXFRAME),SM_InfoWidth,SM_InfoHeight)
  SM_ButtonWidth = _SM_ButtonWidth(_SM_ButtonInsertCodeNo)
  ResizeGadget(_SM_ButtonInsertCodeNo, SM_ButtonX, SM_ButtonY, SM_ButtonWidth, GetSystemMetrics_(#SM_CYMENU))
  DisableGadget(_SM_ButtonInsertCodeNo, jaPBe_Found!1) 
  SM_ButtonX + SM_ButtonWidth + GetSystemMetrics_(#SM_CXFRAME)
  SM_ButtonWidth = _SM_ButtonWidth(_SM_ButtonInsertConstantNo)
  ResizeGadget(_SM_ButtonInsertConstantNo, SM_ButtonX, SM_ButtonY, SM_ButtonWidth, GetSystemMetrics_(#SM_CYMENU))
  DisableGadget(_SM_ButtonInsertConstantNo, jaPBe_Found!1) 
  SM_ButtonX + SM_ButtonWidth + GetSystemMetrics_(#SM_CXFRAME)
  SM_ButtonWidth = _SM_ButtonWidth(_SM_ButtonInsertValueNo)
  ResizeGadget(_SM_ButtonInsertValueNo, SM_ButtonX, SM_ButtonY, SM_ButtonWidth, GetSystemMetrics_(#SM_CYMENU))
  DisableGadget(_SM_ButtonInsertValueNo, jaPBe_Found!1) 
  SM_ButtonX + SM_ButtonWidth + GetSystemMetrics_(#SM_CXFRAME)
  SM_ButtonWidth =  _SM_ButtonWidth(0)
  ResizeGadget(_SM_CheckBoxjaPBeNo, SM_ButtonX, SM_ButtonY, SM_ButtonWidth, GetSystemMetrics_(#SM_CYMENU))
  SetGadgetState(_SM_CheckBoxjaPBeNo, jaPBe_Found!1) 
  SM_ButtonWidth = _SM_ButtonWidth(_SM_ButtonQuitNo)
  SM_ButtonX = SM_TableWidth - SM_ButtonWidth - GetSystemMetrics_(#SM_CXFRAME)
  ResizeGadget(_SM_ButtonQuitNo, SM_ButtonX, SM_ButtonY, SM_ButtonWidth, GetSystemMetrics_(#SM_CYMENU))
  ResizeWindow(_SM_MainWIndowNo,SM_WindowX,SM_WindowY,SM_TableWidth,SM_WindowHeight)
  SetActiveGadget(_SM_TableNo)
  SetGadgetText(_SM_InfoNo,_SM_Name(GetGadgetState(_SM_TableNo),1))
EndProcedure

Procedure _SM_Send(what.l=1)
  Protected  SM_Pos.l, CB_Text$
  SM_Pos = GetGadgetState(_SM_TableNo)
  Select what
    Case #SM_SendCode
      CB_Text$ = "GetSystemMetrics_(#"+_SM_Name(SM_Pos,0)+")"
    Case #SM_SendConstant
      CB_Text$ = "#"+_SM_Name(SM_Pos,0)
    Case #SM_SendValue
      CB_Text$ = Str(GetSystemMetrics_(_SM_No(SM_Pos)))
    Default
      CB_Text$ = ""
  EndSelect
  If jaPBe_Found
    SendDataS(jaPBe_Handle,#WMCD_InsertText,CB_Text$)
    If GetGadgetState(_SM_CheckBoxjaPBeNo)
      SetClipboardText(CB_Text$)
    EndIf  
  EndIf 
EndProcedure

Procedure DisplaySystemMetrics()
  Protected SM_Event.l, SM_Pos.l, SM_Flags.l, CB_Text$
  SM_Parameter$ = ProgramParameter()
  SM_Flags = #PB_Window_SystemMenu
  _SM_MainWIndowNo = OpenWindow(#PB_Any,0,0,0,0,"SystemMetrics",SM_Flags)
  If _SM_MainWIndowNo
    _SM_MainWIndowID = WindowID(_SM_MainWIndowNo)
    StickyWindow(_SM_MainWIndowNo, #True)
    _SM_Init()
    _SM_InitTable()
    _SM_InitInfo()
    _SM_InitButtons()
    SetWindowCallback(@Callback())
    If SM_Parameter$="jaPBe"
      jaPBe_Found    = #True
      jaPBe_Handle   = Val(ProgramParameter())
      jaPBe_Version$ = ProgramParameter()
      PostMessage_(jaPBe_Handle,#mywm_plugin_EnablejaPBe,0,_SM_MainWIndowID)
      SetWindowTitle(_SM_MainWIndowNo, GetWindowTitle(_SM_MainWIndowNo)+" plugin")
    EndIf 
    _SM_Resize() 
    Repeat
      SM_Event = WaitWindowEvent()
      Select SM_Event
        Case #PB_Event_Gadget
          Select EventGadget()
            Case _SM_ButtonInsertCodeNo     : _SM_Send(#SM_SendCode)
            Case _SM_ButtonInsertConstantNo : _SM_Send(#SM_SendConstant)
            Case _SM_ButtonInsertValueNo    : _SM_Send(#SM_SendValue)
            Case _SM_ButtonQuitNo           : SM_Event = #PB_Event_CloseWindow
            Case _SM_TableNo 
              SM_Pos = GetGadgetState(_SM_TableNo)
              SetGadgetText(_SM_InfoNo,_SM_Name(SM_Pos,1))
              If GetGadgetState(_SM_CheckBoxjaPBeNo)
                SetClipboardText("GetSystemMetrics_(#"+_SM_Name(SM_Pos,0)+")")
              EndIf 
          EndSelect
      EndSelect
    Until SM_Event = #PB_Event_CloseWindow
    If jaPBe_Found
      PostMessage_(jaPBe_Handle,#mywm_Plugin_Cancel,0,WindowID(1))
    EndIf
  EndIf
  SetClipboardText(_SM_ClipBoard$)
EndProcedure

DisplaySystemMetrics()

End
standalone: as long as the prog is running the GetSystemMetrics-Code of the selected row will be copied to the clipboard. Quit will restore the clipboard.

jaPBe plugin: you will see :wink:

Have fun!

Posted: Wed Apr 08, 2009 7:51 am
by gnozal
Good idea !

May I add a compiled version to the next jaPBe release ?

EDIT : here is the modified code.

Code: Select all

; ********************** 
; DisplaySystemMetrics 
; jaPBe plugin & standalone 
; 2009-04-08 sverson 
; ********************** 

EnableExplicit 

#SM_DIGITIZER              = 94 
#SM_MAXIMUMTOUCHES         = 95 
#SM_ENTRYCOUNT             = 92 
#SM_SendCode               = 1 
#SM_SendConstant           = 2 
#SM_SendValue              = 3 
#mywm_Plugin_Cancel        = #WM_USER+18 
#mywm_plugin_EnablejaPBe   = #WM_USER+20 
#WMCD_InsertText           = 2 
#wmcd_Fatal_Error          = 6 
#wmcd_Compilation_Finished = 10 

Global Dim _SM_No.l(#SM_ENTRYCOUNT) 
Global Dim _SM_Name.s(#SM_ENTRYCOUNT,1) 
Global _SM_TableNo.l, _SM_TableID.l, _SM_InfoNo.l, _SM_InfoID.l 
Global _SM_ButtonInsertCodeNo.l, _SM_ButtonInsertCodeID.l, _SM_ButtonInsertConstantNo.l, _SM_ButtonInsertConstantID.l, _SM_ButtonInsertValueNo.l, _SM_ButtonInsertValueID.l 
Global _SM_ButtonQuitNo.l, _SM_ButtonQuitID.l, _SM_CheckBoxjaPBeNo.l, _SM_CheckBoxjaPBeID.l 
Global _SM_MainWIndowNo.l, _SM_MainWIndowID.l, _SM_EditorHwnd.l=0 
Global _SM_FontID.l = GetGadgetFont(#PB_Default) 
Global _SM_ClipBoard$ = GetClipboardText() 
Global jaPBe_Handle.l, jaPBe_Version$, jaPBe_CompilerMsg.s, jaPBe_CompilerType.l, jaPBe_Selection.l, jaPBe_CurrentWord.l, jaPBe_CompleteText.l, jaPBe_CurrentLine.l, SM_Parameter$, jaPBe_Found.b=#False 

Procedure Callback(WindowId, message, wParam, lParam) 
  Protected result = #PB_ProcessPureBasicEvents 
  Protected *cd.COPYDATASTRUCT 
  If message=#WM_COPYDATA 
    *cd.COPYDATASTRUCT=lParam 
    result=#False 
    If wParam=jaPBe_Handle 
      Select *cd\dwData 
        Case $FFFFFFFF 
        Default 
          If *cd\dwData>=#wmcd_Fatal_Error And *cd\dwData<=#wmcd_Compilation_Finished 
            jaPBe_CompilerMsg=PeekS(*cd\lpData,*cd\cbData) 
            If jaPBe_CompilerMsg=Chr(255) 
              jaPBe_CompilerMsg="" 
            EndIf 
            jaPBe_CompilerType=*cd\dwData 
            result=#True 
          EndIf 
      EndSelect 
    Else 
      MessageRequester("jaPBe-Plugin","I got a message NOT from jaPBe!") 
    EndIf 
  EndIf 
  ProcedureReturn result 
EndProcedure 

Procedure SendDataS(ziel,Type,Message$) 
  Protected cd.COPYDATASTRUCT 
  cd\dwData=Type 
  cd\cbData=Len(Message$)+1 
  cd\lpData=@Message$ 
  ProcedureReturn SendMessage_(ziel,#WM_COPYDATA,WindowID(1),cd) 
EndProcedure 

Procedure.l _SM_ColumnAutoSize(GadgetID.l) 
  Protected AktColumn.l, ColumnCount.l, TableWidth.l=0 
  ColumnCount = SendMessage_(SendMessage_(GadgetID,#LVM_GETHEADER,0,0),#HDM_GETITEMCOUNT,#Null,#Null)-1 
  For AktColumn=0 To ColumnCount 
    SendMessage_(GadgetID,#LVM_SETCOLUMNWIDTH,AktColumn,#LVSCW_AUTOSIZE) 
    TableWidth + SendMessage_(GadgetID, #LVM_GETCOLUMNWIDTH, AktColumn, 0) 
  Next 
  ProcedureReturn TableWidth 
EndProcedure 

Procedure _SM_Init() 
  Protected SM_Pos.l =0 
  _SM_No(SM_Pos)= #SM_ARRANGE : _SM_Name(SM_Pos,0)= "SM_ARRANGE" : _SM_Name(SM_Pos,1)= "The flags that specify how the system arranged minimized windows." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CLEANBOOT : _SM_Name(SM_Pos,0)= "SM_CLEANBOOT" : _SM_Name(SM_Pos,1)= "The value that specifies how the system is started:"+Chr(13)+"  * 0 Normal boot"+Chr(13)+"  * 1 Fail-safe boot"+Chr(13)+"  * 2 Fail-safe with network boot"+Chr(13)+"A fail-safe boot (also called SafeBoot, Safe Mode, or Clean Boot) bypasses the user startup files." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CMONITORS : _SM_Name(SM_Pos,0)= "SM_CMONITORS" : _SM_Name(SM_Pos,1)= "The number of display monitors on a desktop." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CMOUSEBUTTONS : _SM_Name(SM_Pos,0)= "SM_CMOUSEBUTTONS" : _SM_Name(SM_Pos,1)= "The number of buttons on a mouse, or zero if no mouse is installed." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXBORDER : _SM_Name(SM_Pos,0)= "SM_CXBORDER" : _SM_Name(SM_Pos,1)= "The width of a window border, in pixels. This is equivalent to the #SM_CXEDGE value for windows with the 3-D look." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXCURSOR : _SM_Name(SM_Pos,0)= "SM_CXCURSOR" : _SM_Name(SM_Pos,1)= "The width of a cursor, in pixels. The system cannot create cursors of other sizes." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXDLGFRAME : _SM_Name(SM_Pos,0)= "SM_CXDLGFRAME" : _SM_Name(SM_Pos,1)= "This value is the same as #SM_CXFIXEDFRAME." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXDOUBLECLK : _SM_Name(SM_Pos,0)= "SM_CXDOUBLECLK" : _SM_Name(SM_Pos,1)= "The width of the rectangle around the location of a first click in a double-click sequence, in pixels. The second click must occur within the rectangle that is defined by #SM_CXDOUBLECLK and #SM_CYDOUBLECLK for the system to consider the two clicks a double-click. The two clicks must also occur within a specified time."+Chr(13)+"To set the width of the double-click rectangle, call SystemParametersInfo with SPI_SETDOUBLECLKWIDTH." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXDRAG : _SM_Name(SM_Pos,0)= "SM_CXDRAG" : _SM_Name(SM_Pos,1)= "The number of pixels on either side of a mouse-down point that the mouse pointer can move before a drag operation begins. This allows the user to click and release the mouse button easily without unintentionally starting a drag operation. If this value is negative, it is subtracted from the left of the mouse-down point and added to the right of it." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXEDGE : _SM_Name(SM_Pos,0)= "SM_CXEDGE" : _SM_Name(SM_Pos,1)= "The width of a 3-D border, in pixels. This metric is the 3-D counterpart of #SM_CXBORDER." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXFIXEDFRAME : _SM_Name(SM_Pos,0)= "SM_CXFIXEDFRAME" : _SM_Name(SM_Pos,1)= "The thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels. #SM_CXFIXEDFRAME is the height of the horizontal border, and #SM_CYFIXEDFRAME is the width of the vertical border."+Chr(13)+"This value is the same as #SM_CXDLGFRAME." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXFOCUSBORDER : _SM_Name(SM_Pos,0)= "SM_CXFOCUSBORDER" : _SM_Name(SM_Pos,1)= "The width of the left and right edges of the focus rectangle that the DrawFocusRect draws. This value is in pixels."+Chr(13)+"Windows 2000:  This value is not supported." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXFRAME : _SM_Name(SM_Pos,0)= "SM_CXFRAME" : _SM_Name(SM_Pos,1)= "This value is the same as #SM_CXSIZEFRAME." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXFULLSCREEN : _SM_Name(SM_Pos,0)= "SM_CXFULLSCREEN" : _SM_Name(SM_Pos,1)= "The width of the client area for a full-screen window on the primary display monitor, in pixels. To get the coordinates of the portion of the screen that is not obscured by the system taskbar or by application desktop toolbars, call the SystemParametersInfo function with the SPI_GETWORKAREA value." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXHSCROLL : _SM_Name(SM_Pos,0)= "SM_CXHSCROLL" : _SM_Name(SM_Pos,1)= "The width of the arrow bitmap on a horizontal scroll bar, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXHTHUMB : _SM_Name(SM_Pos,0)= "SM_CXHTHUMB" : _SM_Name(SM_Pos,1)= "The width of the thumb box in a horizontal scroll bar, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXICON : _SM_Name(SM_Pos,0)= "SM_CXICON" : _SM_Name(SM_Pos,1)= "The default width of an icon, in pixels. The LoadIcon function can load only icons with the dimensions that #SM_CXICON and #SM_CYICON specifies." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXICONSPACING : _SM_Name(SM_Pos,0)= "SM_CXICONSPACING" : _SM_Name(SM_Pos,1)= "The width of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of size #SM_CXICONSPACING by #SM_CYICONSPACING when arranged. This value is always greater than or equal to #SM_CXICON." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXMAXIMIZED : _SM_Name(SM_Pos,0)= "SM_CXMAXIMIZED" : _SM_Name(SM_Pos,1)= "The default width, in pixels, of a maximized top-level window on the primary display monitor." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXMAXTRACK : _SM_Name(SM_Pos,0)= "SM_CXMAXTRACK" : _SM_Name(SM_Pos,1)= "The default maximum width of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXMENUCHECK : _SM_Name(SM_Pos,0)= "SM_CXMENUCHECK" : _SM_Name(SM_Pos,1)= "The width of the default menu check-mark bitmap, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXMENUSIZE : _SM_Name(SM_Pos,0)= "SM_CXMENUSIZE" : _SM_Name(SM_Pos,1)= "The width of menu bar buttons, such as the child window close button that is used in the multiple document interface, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXMIN : _SM_Name(SM_Pos,0)= "SM_CXMIN" : _SM_Name(SM_Pos,1)= "The minimum width of a window, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXMINIMIZED : _SM_Name(SM_Pos,0)= "SM_CXMINIMIZED" : _SM_Name(SM_Pos,1)= "The width of a minimized window, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXMINSPACING : _SM_Name(SM_Pos,0)= "SM_CXMINSPACING" : _SM_Name(SM_Pos,1)= "The width of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged. This value is always greater than or equal to #SM_CXMINIMIZED." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXMINTRACK : _SM_Name(SM_Pos,0)= "SM_CXMINTRACK" : _SM_Name(SM_Pos,1)= "The minimum tracking width of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXPADDEDBORDER : _SM_Name(SM_Pos,0)= "SM_CXPADDEDBORDER" : _SM_Name(SM_Pos,1)= "The amount of border padding for captioned windows, in pixels."+Chr(13)+"Windows XP/2000:  This value is not supported." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXSCREEN : _SM_Name(SM_Pos,0)= "SM_CXSCREEN" : _SM_Name(SM_Pos,1)= "The width of the screen of the primary display monitor, in pixels. This is the same value obtained by calling GetDeviceCaps as follows: GetDeviceCaps( hdcPrimaryMonitor, HORZRES)." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXSIZE : _SM_Name(SM_Pos,0)= "SM_CXSIZE" : _SM_Name(SM_Pos,1)= "The width of a button in a window caption or title bar, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXSIZEFRAME : _SM_Name(SM_Pos,0)= "SM_CXSIZEFRAME" : _SM_Name(SM_Pos,1)= "The thickness of the sizing border around the perimeter of a window that can be resized, in pixels. #SM_CXSIZEFRAME is the width of the horizontal border, and #SM_CYSIZEFRAME is the height of the vertical border."+Chr(13)+"This value is the same as #SM_CXFRAME." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXSMICON : _SM_Name(SM_Pos,0)= "SM_CXSMICON" : _SM_Name(SM_Pos,1)= "The recommended width of a small icon, in pixels. Small icons typically appear in window captions and in small icon view." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXSMSIZE : _SM_Name(SM_Pos,0)= "SM_CXSMSIZE" : _SM_Name(SM_Pos,1)= "The width of small caption buttons, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXVIRTUALSCREEN : _SM_Name(SM_Pos,0)= "SM_CXVIRTUALSCREEN" : _SM_Name(SM_Pos,1)= "The width of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors. The #SM_XVIRTUALSCREEN metric is the coordinates for the left side of the virtual screen." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CXVSCROLL : _SM_Name(SM_Pos,0)= "SM_CXVSCROLL" : _SM_Name(SM_Pos,1)= "The width of a vertical scroll bar, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYBORDER : _SM_Name(SM_Pos,0)= "SM_CYBORDER" : _SM_Name(SM_Pos,1)= "The height of a window border, in pixels. This is equivalent to the #SM_CYEDGE value for windows with the 3-D look." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYCAPTION : _SM_Name(SM_Pos,0)= "SM_CYCAPTION" : _SM_Name(SM_Pos,1)= "The height of a caption area, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYCURSOR : _SM_Name(SM_Pos,0)= "SM_CYCURSOR" : _SM_Name(SM_Pos,1)= "The height of a cursor, in pixels. The system cannot create cursors of other sizes." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYDLGFRAME : _SM_Name(SM_Pos,0)= "SM_CYDLGFRAME" : _SM_Name(SM_Pos,1)= "This value is the same as #SM_CYFIXEDFRAME." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYDOUBLECLK : _SM_Name(SM_Pos,0)= "SM_CYDOUBLECLK" : _SM_Name(SM_Pos,1)= "The height of the rectangle around the location of a first click in a double-click sequence, in pixels. The second click must occur within the rectangle defined by #SM_CXDOUBLECLK and #SM_CYDOUBLECLK for the system to consider the two clicks a double-click. The two clicks must also occur within a specified time."+Chr(13)+"To set the height of the double-click rectangle, call SystemParametersInfo with SPI_SETDOUBLECLKHEIGHT." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYDRAG : _SM_Name(SM_Pos,0)= "SM_CYDRAG" : _SM_Name(SM_Pos,1)= "The number of pixels above and below a mouse-down point that the mouse pointer can move before a drag operation begins. This allows the user to click and release the mouse button easily without unintentionally starting a drag operation. If this value is negative, it is subtracted from above the mouse-down point and added below it." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYEDGE : _SM_Name(SM_Pos,0)= "SM_CYEDGE" : _SM_Name(SM_Pos,1)= "The height of a 3-D border, in pixels. This is the 3-D counterpart of #SM_CYBORDER." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYFIXEDFRAME : _SM_Name(SM_Pos,0)= "SM_CYFIXEDFRAME" : _SM_Name(SM_Pos,1)= "The thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels. #SM_CXFIXEDFRAME is the height of the horizontal border, and #SM_CYFIXEDFRAME is the width of the vertical border."+Chr(13)+"This value is the same as #SM_CYDLGFRAME." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYFOCUSBORDER : _SM_Name(SM_Pos,0)= "SM_CYFOCUSBORDER" : _SM_Name(SM_Pos,1)= "The height of the top and bottom edges of the focus rectangle drawn by DrawFocusRect. This value is in pixels."+Chr(13)+"Windows 2000:  This value is not supported." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYFRAME : _SM_Name(SM_Pos,0)= "SM_CYFRAME" : _SM_Name(SM_Pos,1)= "This value is the same as #SM_CYSIZEFRAME." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYFULLSCREEN : _SM_Name(SM_Pos,0)= "SM_CYFULLSCREEN" : _SM_Name(SM_Pos,1)= "The height of the client area for a full-screen window on the primary display monitor, in pixels. To get the coordinates of the portion of the screen not obscured by the system taskbar or by application desktop toolbars, call the SystemParametersInfo function with the SPI_GETWORKAREA value." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYHSCROLL : _SM_Name(SM_Pos,0)= "SM_CYHSCROLL" : _SM_Name(SM_Pos,1)= "The height of a horizontal scroll bar, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYICON : _SM_Name(SM_Pos,0)= "SM_CYICON" : _SM_Name(SM_Pos,1)= "The default height of an icon, in pixels. The LoadIcon function can load only icons with the dimensions #SM_CXICON and #SM_CYICON." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYICONSPACING : _SM_Name(SM_Pos,0)= "SM_CYICONSPACING" : _SM_Name(SM_Pos,1)= "The height of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of size #SM_CXICONSPACING by #SM_CYICONSPACING when arranged. This value is always greater than or equal to #SM_CYICON." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYKANJIWINDOW : _SM_Name(SM_Pos,0)= "SM_CYKANJIWINDOW" : _SM_Name(SM_Pos,1)= "For double byte character set versions of the system, this is the height of the Kanji window at the bottom of the screen, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYMAXIMIZED : _SM_Name(SM_Pos,0)= "SM_CYMAXIMIZED" : _SM_Name(SM_Pos,1)= "The default height, in pixels, of a maximized top-level window on the primary display monitor." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYMAXTRACK : _SM_Name(SM_Pos,0)= "SM_CYMAXTRACK" : _SM_Name(SM_Pos,1)= "The default maximum height of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYMENU : _SM_Name(SM_Pos,0)= "SM_CYMENU" : _SM_Name(SM_Pos,1)= "The height of a single-line menu bar, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYMENUCHECK : _SM_Name(SM_Pos,0)= "SM_CYMENUCHECK" : _SM_Name(SM_Pos,1)= "The height of the default menu check-mark bitmap, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYMENUSIZE : _SM_Name(SM_Pos,0)= "SM_CYMENUSIZE" : _SM_Name(SM_Pos,1)= "The height of menu bar buttons, such as the child window close button that is used in the multiple document interface, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYMIN : _SM_Name(SM_Pos,0)= "SM_CYMIN" : _SM_Name(SM_Pos,1)= "The minimum height of a window, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYMINIMIZED : _SM_Name(SM_Pos,0)= "SM_CYMINIMIZED" : _SM_Name(SM_Pos,1)= "The height of a minimized window, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYMINSPACING : _SM_Name(SM_Pos,0)= "SM_CYMINSPACING" : _SM_Name(SM_Pos,1)= "The height of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged. This value is always greater than or equal to #SM_CYMINIMIZED." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYMINTRACK : _SM_Name(SM_Pos,0)= "SM_CYMINTRACK" : _SM_Name(SM_Pos,1)= "The minimum tracking height of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions. A window can override this value by processing the WM_GETMINMAXINFO message." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYSCREEN : _SM_Name(SM_Pos,0)= "SM_CYSCREEN" : _SM_Name(SM_Pos,1)= "The height of the screen of the primary display monitor, in pixels. This is the same value obtained by calling GetDeviceCaps as follows: GetDeviceCaps( hdcPrimaryMonitor, VERTRES)." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYSIZE : _SM_Name(SM_Pos,0)= "SM_CYSIZE" : _SM_Name(SM_Pos,1)= "The height of a button in a window caption or title bar, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYSIZEFRAME : _SM_Name(SM_Pos,0)= "SM_CYSIZEFRAME" : _SM_Name(SM_Pos,1)= "The thickness of the sizing border around the perimeter of a window that can be resized, in pixels. #SM_CXSIZEFRAME is the width of the horizontal border, and #SM_CYSIZEFRAME is the height of the vertical border."+Chr(13)+"This value is the same as #SM_CYFRAME." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYSMCAPTION : _SM_Name(SM_Pos,0)= "SM_CYSMCAPTION" : _SM_Name(SM_Pos,1)= "The height of a small caption, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYSMICON : _SM_Name(SM_Pos,0)= "SM_CYSMICON" : _SM_Name(SM_Pos,1)= "The recommended height of a small icon, in pixels. Small icons typically appear in window captions and in small icon view." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYSMSIZE : _SM_Name(SM_Pos,0)= "SM_CYSMSIZE" : _SM_Name(SM_Pos,1)= "The height of small caption buttons, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYVIRTUALSCREEN : _SM_Name(SM_Pos,0)= "SM_CYVIRTUALSCREEN" : _SM_Name(SM_Pos,1)= "The height of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors. The #SM_YVIRTUALSCREEN metric is the coordinates for the top of the virtual screen." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYVSCROLL : _SM_Name(SM_Pos,0)= "SM_CYVSCROLL" : _SM_Name(SM_Pos,1)= "The height of the arrow bitmap on a vertical scroll bar, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_CYVTHUMB : _SM_Name(SM_Pos,0)= "SM_CYVTHUMB" : _SM_Name(SM_Pos,1)= "The height of the thumb box in a vertical scroll bar, in pixels." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_DBCSENABLED : _SM_Name(SM_Pos,0)= "SM_DBCSENABLED" : _SM_Name(SM_Pos,1)= "Nonzero if User32.dll supports DBCS; otherwise, 0." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_DEBUG : _SM_Name(SM_Pos,0)= "SM_DEBUG" : _SM_Name(SM_Pos,1)= "Nonzero if the debug version of User.exe is installed; otherwise, 0." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_DIGITIZER : _SM_Name(SM_Pos,0)= "SM_DIGITIZER" : _SM_Name(SM_Pos,1)= "Nonzero if the current operating system is Windows 7 or Windows Server 2008 R2 and the Tablet PC Input service is started; otherwise, 0. The return value is a bit mask that specifies the type of digitizer input supported by the device."+Chr(13)+"Windows Server 2008, Windows Vista, and Windows XP/2000:  This value is not supported." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_IMMENABLED : _SM_Name(SM_Pos,0)= "SM_IMMENABLED" : _SM_Name(SM_Pos,1)= "Nonzero if Input Method Manager/Input Method Editor features are enabled; otherwise, 0."+Chr(13)+"#SM_IMMENABLED indicates whether the system is ready to use a Unicode-based IME on a Unicode application. To ensure that a language-dependent IME works, check #SM_DBCSENABLED and the system ANSI code page. Otherwise the ANSI-to-Unicode conversion may not be performed correctly, or some components like fonts or registry settings may not be present." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_MAXIMUMTOUCHES : _SM_Name(SM_Pos,0)= "SM_MAXIMUMTOUCHES" : _SM_Name(SM_Pos,1)= "Nonzero if there are digitizers in the system; otherwise, 0."+Chr(13)+"#SM_MAXIMUMTOUCHES returns the aggregate maximum of the maximum number of contacts supported by every digitizer in the system. If the system has only single-touch digitizers, the return value is 1. If the system has multi-touch digitizers, the return value is the number of simultaneous contacts the hardware can provide."+Chr(13)+"Windows Server 2008, Windows Vista, and Windows XP/2000:  This value is not supported." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_MEDIACENTER : _SM_Name(SM_Pos,0)= "SM_MEDIACENTER" : _SM_Name(SM_Pos,1)= "Nonzero if the current operating system is the Windows XP, Media Center Edition, 0 if not." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_MENUDROPALIGNMENT : _SM_Name(SM_Pos,0)= "SM_MENUDROPALIGNMENT" : _SM_Name(SM_Pos,1)= "Nonzero if drop-down menus are right-aligned with the corresponding menu-bar item; 0 if the menus are left-aligned." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_MIDEASTENABLED : _SM_Name(SM_Pos,0)= "SM_MIDEASTENABLED" : _SM_Name(SM_Pos,1)= "Nonzero if the system is enabled for Hebrew and Arabic languages, 0 if not." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_MOUSEPRESENT : _SM_Name(SM_Pos,0)= "SM_MOUSEPRESENT" : _SM_Name(SM_Pos,1)= "Nonzero if a mouse is installed; otherwise, 0. This value is rarely zero, because of support for virtual mice and because some systems detect the presence of the port instead of the presence of a mouse." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_MOUSEHORIZONTALWHEELPRESENT : _SM_Name(SM_Pos,0)= "SM_MOUSEHORIZONTALWHEELPRESENT" : _SM_Name(SM_Pos,1)= "Nonzero if a mouse with a horizontal scroll wheel is installed; otherwise 0." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_MOUSEWHEELPRESENT : _SM_Name(SM_Pos,0)= "SM_MOUSEWHEELPRESENT" : _SM_Name(SM_Pos,1)= "Nonzero if a mouse with a vertical scroll wheel is installed; otherwise 0." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_NETWORK : _SM_Name(SM_Pos,0)= "SM_NETWORK" : _SM_Name(SM_Pos,1)= "The least significant bit is set if a network is present; otherwise, it is cleared. The other bits are reserved for future use." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_PENWINDOWS : _SM_Name(SM_Pos,0)= "SM_PENWINDOWS" : _SM_Name(SM_Pos,1)= "Nonzero if the Microsoft Windows for Pen computing extensions are installed; zero otherwise." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_REMOTECONTROL    : _SM_Name(SM_Pos,0)= "SM_REMOTECONTROL" : _SM_Name(SM_Pos,1)= "This system metric is used in a Terminal Services environment. Its value is nonzero if the current session is remotely controlled; otherwise, 0." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_REMOTESESSION    : _SM_Name(SM_Pos,0)= "SM_REMOTESESSION" : _SM_Name(SM_Pos,1)= "This system metric is used in a Terminal Services environment. If the calling process is associated with a Terminal Services client session, the return value is nonzero. If the calling process is associated with the Terminal Services console session, the return value is 0."+Chr(13)+"Windows Server 2003 and Windows XP:  The console session is not necessarily the physical console. For more information, see WTSGetActiveConsoleSessionId." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_SAMEDISPLAYFORMAT : _SM_Name(SM_Pos,0)= "SM_SAMEDISPLAYFORMAT" : _SM_Name(SM_Pos,1)= "Nonzero if all the display monitors have the same color format, otherwise, 0. Two displays can have the same bit depth, but different color formats. For example, the red, green, and blue pixels can be encoded with different numbers of bits, or those bits can be located in different places in a pixel color value." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_SECURE : _SM_Name(SM_Pos,0)= "SM_SECURE" : _SM_Name(SM_Pos,1)= "This system metric should be ignored; it always returns 0." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_SERVERR2 : _SM_Name(SM_Pos,0)= "SM_SERVERR2" : _SM_Name(SM_Pos,1)= "The build number if the system is Windows Server 2003 R2; otherwise, 0." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_SHOWSOUNDS : _SM_Name(SM_Pos,0)= "SM_SHOWSOUNDS" : _SM_Name(SM_Pos,1)= "Nonzero if the user requires an application to present information visually in situations where it would otherwise present the information only in audible form; otherwise, 0." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_SHUTTINGDOWN    : _SM_Name(SM_Pos,0)= "SM_SHUTTINGDOWN" : _SM_Name(SM_Pos,1)= "Nonzero if the current session is shutting down; otherwise, 0."+Chr(13)+"Windows 2000:  This value is not supported." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_SLOWMACHINE : _SM_Name(SM_Pos,0)= "SM_SLOWMACHINE" : _SM_Name(SM_Pos,1)= "Nonzero if the computer has a low-end (slow) processor; otherwise, 0." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_STARTER : _SM_Name(SM_Pos,0)= "SM_STARTER" : _SM_Name(SM_Pos,1)= "Nonzero if the current operating system is Windows XP Starter Edition; otherwise, 0." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_SWAPBUTTON : _SM_Name(SM_Pos,0)= "SM_SWAPBUTTON" : _SM_Name(SM_Pos,1)= "Nonzero if the meanings of the left and right mouse buttons are swapped; otherwise, 0." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_TABLETPC : _SM_Name(SM_Pos,0)= "SM_TABLETPC" : _SM_Name(SM_Pos,1)= "Nonzero if the current operating system is the Windows XP Tablet PC edition or if the current operating system is Windows Vista or Windows 7 and the Tablet PC Input service is started; otherwise, 0. The #SM_DIGITIZER setting indicates the type of digitizer input supported by a device running Windows 7 or Windows Server 2008 R2." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_XVIRTUALSCREEN : _SM_Name(SM_Pos,0)= "SM_XVIRTUALSCREEN" : _SM_Name(SM_Pos,1)= "The coordinates for the left side of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. The #SM_CXVIRTUALSCREEN metric is the width of the virtual screen." : SM_Pos+1 
  _SM_No(SM_Pos)= #SM_YVIRTUALSCREEN : _SM_Name(SM_Pos,0)= "SM_YVIRTUALSCREEN" : _SM_Name(SM_Pos,1)= "The coordinates for the top of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. The #SM_CYVIRTUALSCREEN metric is the height of the virtual screen. " 
EndProcedure 

Procedure _SM_FillTable() 
  Protected SM_Pos.l, SM_ID$, SM_NAME$, SM_INFO$ 
  For SM_Pos = 0 To #SM_ENTRYCOUNT 
    SM_ID$   = "$"+RSet(Hex(_SM_No(SM_Pos)),4,"0")+Chr(10)+"("+RSet(Str(_SM_No(SM_Pos)),4,"0")+")"+Chr(10) 
    SM_NAME$ = _SM_Name(SM_Pos,0)+Chr(10) 
    SM_INFO$ = Str(GetSystemMetrics_(_SM_No(SM_Pos)))+Chr(10)+Left(_SM_Name(SM_Pos,1),50)+"..." 
    AddGadgetItem(_SM_TableNo,-1,SM_ID$+SM_NAME$+SM_INFO$) 
  Next 
EndProcedure 

Procedure _SM_InitTable() 
  Protected SM_Pos.l, SM_Flags.l 
  SM_Flags = #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#LVS_NOCOLUMNHEADER 
  _SM_TableNo = ListIconGadget(#PB_Any,0,0,0,0,"",0,SM_Flags) 
  _SM_TableID = GadgetID(_SM_TableNo) 
  For SM_Pos = 1 To 4 
    AddGadgetColumn(_SM_TableNo,0,"",0) 
  Next 
  _SM_FillTable() 
  SetGadgetState(_SM_TableNo,0) 
EndProcedure 

Procedure _SM_InitInfo() 
  Protected SM_Flags.l 
  SM_Flags = #PB_Editor_ReadOnly 
  _SM_InfoNo = EditorGadget(#PB_Any,0,0,0,0,SM_Flags) 
  _SM_InfoID = GadgetID(_SM_InfoNo) 
  SendMessage_(_SM_InfoID, #EM_SETTARGETDEVICE, 0, 0) 
  SendMessage_(_SM_InfoID, #EM_SETMARGINS, #EC_LEFTMARGIN, 5) 
  SendMessage_(_SM_InfoID, #EM_SETMARGINS, #EC_RIGHTMARGIN, 5) 
EndProcedure 

Procedure _SM_InitButtons() 
  _SM_ButtonInsertCodeNo     = ButtonGadget(#PB_Any,0,0,0,0,"jaPBe: insert code") 
  _SM_ButtonInsertCodeID     = GadgetID(_SM_ButtonInsertCodeNo) 
  _SM_ButtonInsertConstantNo = ButtonGadget(#PB_Any,0,0,0,0,"jaPBe: insert constant") 
  _SM_ButtonInsertConstantID = GadgetID(_SM_ButtonInsertConstantNo) 
  _SM_ButtonInsertValueNo    = ButtonGadget(#PB_Any,0,0,0,0,"jaPBe: insert value") 
  _SM_ButtonInsertValueID    = GadgetID(_SM_ButtonInsertValueNo) 
  _SM_CheckBoxjaPBeNo        = CheckBoxGadget(#PB_Any,0,0,0,0,"copy code to clipBoard") 
  _SM_CheckBoxjaPBeID        = GadgetID(_SM_CheckBoxjaPBeNo) 
  _SM_ButtonQuitNo           = ButtonGadget(#PB_Any,0,0,0,0,"Quit") 
  _SM_ButtonQuitID           = GadgetID(_SM_ButtonQuitNo) 
EndProcedure 

Procedure.l _SM_ButtonWidth(SM_ButtonNo.l) 
  Protected SM_ButtonWidth.l 
  StartDrawing(WindowOutput(_SM_MainWIndowNo)) 
    DrawingFont(_SM_FontID) 
    If SM_ButtonNo 
      SM_ButtonWidth = TextWidth(GetGadgetText(SM_ButtonNo)) 
    Else 
      SM_ButtonWidth = TextWidth("copy code to clipBoard") + GetSystemMetrics_(#SM_CXICON) 
    EndIf 
  StopDrawing() 
  ProcedureReturn SM_ButtonWidth + GetSystemMetrics_(#SM_CXDLGFRAME)*2 + GetSystemMetrics_(#SM_CXFRAME)*2 
EndProcedure 

Procedure _SM_Resize() 
  Protected SM_TableWidth.l, SM_TableHeight.l, SM_InfoWidth.l, SM_InfoHeight.l, SM_WindowX.l, SM_WindowY.l, SM_WindowHeight.l, SM_ButtonY.l, SM_ButtonX.l, SM_ButtonWidth.l 
  SM_TableWidth   = _SM_ColumnAutoSize(GadgetID(_SM_TableNo))+GetSystemMetrics_(#SM_CXVSCROLL)+GetSystemMetrics_(#SM_CXFRAME) 
  SM_TableHeight  = (SendMessage_(_SM_TableID, #LVM_GETITEMSPACING, #True, 0) >> 16) * 20 + GetSystemMetrics_(#SM_CYFRAME) 
  SM_InfoWidth    = SM_TableWidth 
  SM_InfoHeight   = SM_TableHeight >> 2 
  SM_WindowHeight = SM_TableHeight+SM_InfoHeight+GetSystemMetrics_(#SM_CYFRAME)*3+GetSystemMetrics_(#SM_CYMENU) 
  SM_WindowX      = (GetSystemMetrics_(#SM_CXFULLSCREEN)-SM_TableWidth-GetSystemMetrics_(#SM_CYFRAME)*2)>>1 
  SM_WindowY      = (GetSystemMetrics_(#SM_CYFULLSCREEN)-SM_WindowHeight-GetSystemMetrics_(#SM_CYFRAME)*2)>>1 
  SM_ButtonX      = GetSystemMetrics_(#SM_CXFRAME) 
  SM_ButtonY      = SM_WindowHeight-(GetSystemMetrics_(#SM_CYFRAME)+GetSystemMetrics_(#SM_CYMENU)) 
  ResizeGadget(_SM_TableNo,#PB_Ignore,#PB_Ignore,SM_TableWidth,SM_TableHeight) 
  ResizeGadget(_SM_InfoNo,#PB_Ignore,SM_TableHeight+GetSystemMetrics_(#SM_CXFRAME),SM_InfoWidth,SM_InfoHeight) 
  SM_ButtonWidth = _SM_ButtonWidth(_SM_ButtonInsertCodeNo) 
  ResizeGadget(_SM_ButtonInsertCodeNo, SM_ButtonX, SM_ButtonY, SM_ButtonWidth, GetSystemMetrics_(#SM_CYMENU)) 
  DisableGadget(_SM_ButtonInsertCodeNo, jaPBe_Found!1) 
  SM_ButtonX + SM_ButtonWidth + GetSystemMetrics_(#SM_CXFRAME) 
  SM_ButtonWidth = _SM_ButtonWidth(_SM_ButtonInsertConstantNo) 
  ResizeGadget(_SM_ButtonInsertConstantNo, SM_ButtonX, SM_ButtonY, SM_ButtonWidth, GetSystemMetrics_(#SM_CYMENU)) 
  DisableGadget(_SM_ButtonInsertConstantNo, jaPBe_Found!1) 
  SM_ButtonX + SM_ButtonWidth + GetSystemMetrics_(#SM_CXFRAME) 
  SM_ButtonWidth = _SM_ButtonWidth(_SM_ButtonInsertValueNo) 
  ResizeGadget(_SM_ButtonInsertValueNo, SM_ButtonX, SM_ButtonY, SM_ButtonWidth, GetSystemMetrics_(#SM_CYMENU)) 
  DisableGadget(_SM_ButtonInsertValueNo, jaPBe_Found!1) 
  SM_ButtonX + SM_ButtonWidth + GetSystemMetrics_(#SM_CXFRAME) 
  SM_ButtonWidth =  _SM_ButtonWidth(0) 
  ResizeGadget(_SM_CheckBoxjaPBeNo, SM_ButtonX, SM_ButtonY, SM_ButtonWidth, GetSystemMetrics_(#SM_CYMENU)) 
  SetGadgetState(_SM_CheckBoxjaPBeNo, jaPBe_Found!1) 
  SM_ButtonWidth = _SM_ButtonWidth(_SM_ButtonQuitNo) 
  SM_ButtonX = SM_TableWidth - SM_ButtonWidth - GetSystemMetrics_(#SM_CXFRAME) 
  ResizeGadget(_SM_ButtonQuitNo, SM_ButtonX, SM_ButtonY, SM_ButtonWidth, GetSystemMetrics_(#SM_CYMENU)) 
  ResizeWindow(_SM_MainWIndowNo,SM_WindowX,SM_WindowY,SM_TableWidth,SM_WindowHeight) 
  SetActiveGadget(_SM_TableNo) 
  SetGadgetText(_SM_InfoNo,_SM_Name(GetGadgetState(_SM_TableNo),1)) 
EndProcedure 

Procedure _SM_Send(what.l=1) 
  Protected  SM_Pos.l, CB_Text$ 
  SM_Pos = GetGadgetState(_SM_TableNo) 
  Select what 
    Case #SM_SendCode 
      CB_Text$ = "GetSystemMetrics_(#"+_SM_Name(SM_Pos,0)+")" 
    Case #SM_SendConstant 
      CB_Text$ = "#"+_SM_Name(SM_Pos,0) 
    Case #SM_SendValue 
      CB_Text$ = Str(GetSystemMetrics_(_SM_No(SM_Pos))) 
    Default 
      CB_Text$ = "" 
  EndSelect 
  If jaPBe_Found 
    SendDataS(jaPBe_Handle,#WMCD_InsertText,CB_Text$) 
    If GetGadgetState(_SM_CheckBoxjaPBeNo) 
      SetClipboardText(CB_Text$) 
    EndIf  
  EndIf 
EndProcedure 

Procedure DisplaySystemMetrics() 
  Protected SM_Event.l, SM_Pos.l, SM_Flags.l, CB_Text$ 
  SM_Parameter$ = ProgramParameter() 
  SM_Flags = #PB_Window_SystemMenu | #PB_Window_Invisible
  _SM_MainWIndowNo = OpenWindow(#PB_Any,0,0,0,0,"SystemMetrics",SM_Flags) 
  If _SM_MainWIndowNo 
    _SM_MainWIndowID = WindowID(_SM_MainWIndowNo) 
    StickyWindow(_SM_MainWIndowNo, #True) 
    _SM_Init() 
    _SM_InitTable() 
    _SM_InitInfo() 
    _SM_InitButtons() 
    HideWindow(_SM_MainWIndowNo, #False)
    SetWindowCallback(@Callback()) 
    If SM_Parameter$="jaPBe" 
      jaPBe_Found    = #True 
      jaPBe_Handle   = Val(ProgramParameter()) 
      jaPBe_Version$ = ProgramParameter() 
      PostMessage_(jaPBe_Handle,#mywm_plugin_EnablejaPBe,0,_SM_MainWIndowID) 
      SetWindowTitle(_SM_MainWIndowNo, GetWindowTitle(_SM_MainWIndowNo)+" plugin") 
    EndIf 
    _SM_Resize() 
    Repeat 
      SM_Event = WaitWindowEvent() 
      Select SM_Event 
        Case #PB_Event_Gadget 
          Select EventGadget() 
            Case _SM_ButtonInsertCodeNo     : _SM_Send(#SM_SendCode) 
            Case _SM_ButtonInsertConstantNo : _SM_Send(#SM_SendConstant) 
            Case _SM_ButtonInsertValueNo    : _SM_Send(#SM_SendValue) 
            Case _SM_ButtonQuitNo           : SM_Event = #PB_Event_CloseWindow 
            Case _SM_TableNo 
              SM_Pos = GetGadgetState(_SM_TableNo) 
              SetGadgetText(_SM_InfoNo,_SM_Name(SM_Pos,1)) 
              If GetGadgetState(_SM_CheckBoxjaPBeNo) 
                SetClipboardText("GetSystemMetrics_(#"+_SM_Name(SM_Pos,0)+")") 
              EndIf 
          EndSelect 
      EndSelect 
    Until SM_Event = #PB_Event_CloseWindow 
    If jaPBe_Found 
      PostMessage_(jaPBe_Handle,#mywm_Plugin_Cancel,0,WindowID(1)) 
    EndIf 
  EndIf 
  SetClipboardText(_SM_ClipBoard$) 
EndProcedure 

DisplaySystemMetrics() 

End

Posted: Wed Apr 08, 2009 6:05 pm
by sverson
gnozal wrote:May I add a compiled version to the next jaPBe release ?
Of couse - if you like it. :wink: