Extern Object:

‘###################################################################################
‘UTILITY OBJECTS – E X T E R N
‘################################################################################### 
Description:

Declares references to external procedures which are stored with a dynamic-link library (DLL).   

Syntax:

Extern.Declare (RetType, MethodName, LibName, Alias [, ArgType(s)])  

Example:

'FindWindowA is a function in user32.dll. This function is used to find a window which is currently opened on Desktop. 
'This function takes two string inputs NativeClass & Title of the Window. 
'This will return a handler value of the identified window. 
'If it is returned 0 then there is no window found 

‘Getting the Handle for the Notepad Window
strHWND = Extern.FindWindow ("Notepad", vbNullString)  

‘Finding the Notepad Application Opened
If strHWND = 0 Then  

MsgBox "Notepad Application NOT Opened"  

Else 

MsgBox "Notepad Application Opened"  

End If
‘###################################################################################

No comments:

Post a Comment