Page 179 - DCAP408_WEB_PROGRAMMING
P. 179

Unit 10: Menus




          Dim  notepad  As  Long                                                                Notes
          notepad  =  FindWindow(“notepad”,  vbNullString)


          ‘  Add  our  menu  to  the  window  we  found  above
          Dim  notepadMenu  As  Long
          notepadMenu  =  GetMenu(notepad)
          Call  AppendMenu(notepadMenu,  MF_POPUP,  newMenu,  “Item  List”)


          ‘  Ensure  that  the  user  sees  the  new  menu  immediately
          Call  SendMessage(notepad,  WM_NCPAINT,  0&,  0&)

          Self Assessment

          Fill in the blank:
          14.  To make something happen when you click on an item you have to ......................... the
               menu.

          10.6 Creating Menu Containing Bitmaps and the System Menu


          10.6.1 Creating Menu  Containing Bitmaps

          Create Menu Bitmaps With VB6 API
          To create Menu Bitmaps With VB6 API, open the ‘create menu bitmap’ folder.

          From file, click new to create menu.
















          ’  VB6  API  Source  Code  Option  Explicit

          Private  Const  Color_Green  =  vbGreen
          Private  Declare  Function  GetMenu  Lib  “user32”  (ByVal  hwnd  As  Long)  As
          Long
          Private  Declare  Function  GetSubMenu  Lib  “user32”  (ByVal  hMenu  As  Long,
          ByVal  nPos  As  Long)  As  Long
          Private  Declare  Function  SetMenuItemBitmaps  Lib  “user32”  (ByVal  hMenu  As
          Long,  _
          ByVal  nPosition  As  Long,  ByVal  wFlags  As  Long,  ByVal  hBitmapUnchecked  As
          Long,  _




                                           LOVELY PROFESSIONAL UNIVERSITY                                   173
   174   175   176   177   178   179   180   181   182   183   184