Announcement

Collapse
No announcement yet.

Menu Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Steve Nelson
    replied
    That worked. Thanks, Kevin.

    Thanks.

    Leave a comment:


  • Kev Peel
    replied
    Try WM_SYSCOMMAND (it's handled a bit differently than the usual WM_COMMAND)

    Leave a comment:


  • Steve Nelson
    started a topic Menu Question

    Menu Question

    I've never been a menu guy, but I got excited when I saw that Eudora customized their
    Window Menu with extra choices. So I decided to try it.

    This runs fine and "MyString" appears in the Window Menu. But when I choose "MyString" I
    do not get the message box. What am I doing wrong? Thanks.

    Code:
    #REGISTER NONE
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "WIN32API.inc"
     
    %SRN_DIALOG = %WS_SYSMENU OR %WS_MINIMIZEBOX OR %WS_CAPTION
    %SRN_BUTTON = %BS_CENTER OR %BS_VCENTER OR %BS_MULTILINE OR %WS_BORDER OR %WS_TABSTOP
     
    GLOBAL hDlg AS DWORD  ' Main dialog's handle
     
    DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
    DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    DECLARE CALLBACK FUNCTION mubak()
     
    FUNCTION PBMAIN()
     
      LOCAL lRslt  AS LONG : LOCAL msg AS tagMsg : LOCAL Sysmenu AS LONG
     
      DIALOG NEW PIXELS, %HWND_DESKTOP, "Menu Test",  51, 111, 333, 333, %SRN_DIALOG, TO hDlg
      CONTROL ADD BUTTON  , hDlg, 9999, "Close"    , 222, 222,  70,  22, %SRN_BUTTON
     
      SysMenu = GETSYSTEMMENU( hDlg, %FALSE ) :  MENU ADD STRING, SysMenu, "-", 0, 0
      MENU ADD STRING, SysMenu, "MyString", 3333, %MF_ENABLED , CALL mubak()
      DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
    END FUNCTION
     
    CALLBACK FUNCTION ShowDIALOG1Proc() AS LONG
     
      SELECT CASE AS LONG CBMSG '0-0-0-0-0
        CASE %WM_INITDIALOG
     
        CASE %WM_NCACTIVATE
          STATIC hWndSaveFocus AS DWORD
          IF ISFALSE CBWPARAM THEN
            hWndSaveFocus = GetFocus()
          ELSEIF hWndSaveFocus THEN
            SetFocus(hWndSaveFocus) : hWndSaveFocus = 0
          END IF
     
        CASE %WM_COMMAND
          IF NOT CBCTLMSG = %BN_CLICKED THEN EXIT FUNCTION
          IF CBCTL=9999 THEN DIALOG END hDlg
     
      END SELECT
    END FUNCTION
     
    CALLBACK FUNCTION mubak() AS LONG
      MSGBOX "MyString"
    END FUNCTION
Working...
X