Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB5,VB6
Expertise: Intermediate
Jan 1, 2003



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Determine whether the VB IDE is the foreground process

At times you may need to verify that the VB IDE is the current process. This is necessary, for example, when you are notified that the user has presses a given hotkey and you want to ensure that this hotkey should be processed by your addin (if the VB IDE is the active process) or just ignored. Here's a simple routine that does the job: ' return True if the VBIDE is the foreground process ' ' This code only works inside a VB add-in and ' assumes that the VBInstance global variable holds ' a reference to the VBE root object Function VisualBasicIsActiveProcess() As Boolean Dim vbProcessID As Long Dim currProcessID As Long ' get ProcessID of Visual Basic GetWindowThreadProcessId VBInstance.MainWindow.hwnd, vbProcessID ' get processID of active Window GetWindowThreadProcessId GetForegroundWindow(), currProcessID ' return True if they match VisualBasicIsActiveProcess = (vbProcessID = currProcessID) End Function
Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date