Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


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

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.

 

 

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