MessageBox From OLE Server Comes Up Behind The App

MessageBox From OLE Server Comes Up Behind The App

You have a VB4-based OLE Automation server that has no main UI, anddisplays forms that are parented into Excel in response to various automationcalls. Sometimes you need to display a message box instead of a form. Ifyou haven’t yet parented any forms into Excel, the message box frequentlyappears behind Excel.To make sure that the message box appears where the user can see it–ifall your forms are modal–the best way is to compile the VB4 OLE Automationserver as an in-process server (DLL). The server becomes part of Excel’sprocess space, and all forms and message boxes are automatically parentedas you would expect them to be.If your forms are modeless, you cannot use the DLL approach. Your OLEAutomation server must be an EXE. The following workaround should do thetrick.Create a hidden, modeless form and use SetParent to make it a childof Excel’s main window. Make this the first thing you do when Excel getsan instance of your object. Create a Public (visible throughout your project,but not outside) method for the hidden modeless form. The Public methodtakes the same parameters as a message box, and its job is to call MsgBoxwith those parameters. When your server needs to display a message boxwhen no other form is parented to Excel, call this method. Excel shouldnever hide the message box.

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

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes