Menu Status on MDI Forms with Spyworks-VB

Menu Status on MDI Forms with Spyworks-VB

Many features of SBCEasy (a tool that comes with Desaware’s SpyWorks-VB)work only on its container, and because it cannot be placed on a MDI Parentform, the MenuSelect event does not work on MDI forms. Fortunately, itis quite easy to use SBC.VBX to implement the same functionality.
First, create MDI Parent and MDI Child windows and place a PictureBoxcontrol onto the MDI Parent. Place an SBC SubClass control on top of thatPictureBox. In the Parent’s Load event, set the window to be subclassed:

 SubClass1.HwndParam = MDIForm1.hWnd 

Adjust the SubClass control’s Message property to intercept WM_MENUSELECT.Then, in the SubClass control’s WndMessage event, get the caption of theselected menu item with this code:

 Sub SubClass1_WndMessage (wnd As Integer, _ msg As Integer, wp As Integer, lp As Long, _ retval As Long, nodef As Integer) Dim id%, di% Dim hmenu%, menuflags% Dim menustring$ dwDWORDto2Integers lp, menuflags%, hmenu% id% = wp ' Ignore bitmaps, popups and system menu for now If menuflags And (MF_BITMAP Or MF_POPUP Or _ MF_SYSMENU) Then Form1.Label1.Caption = "" Exit Sub End If menustring$ = String$(32, 0) ' Get the string di% = GetMenuString(hmenu%, id%, menustring$, _ 31, MF_BYCOMMAND) ' Strip off anything past the null termination menustring$ = dwGetStringFromLPSTR$(menustring$) ' This menu string can be used as you wish (for ' example, to update status bars) End Sub 
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of