Hi
I am trying to activate a program using its Windows Class Name. Here is the code. :
[code=vb]
Private Sub Command0_Click( )
Dim rVal As Integer
rVal = AppActivateClas s("SciCalc")
End Sub
Function AppActivateClas s(lpclassname$)
Dim hWnd As Integer 'the application's window handle
Dim dummy As Integer 'Dummy variable
'Get the Window Handle
hWnd = alias_FindWindo w("lpclassname$ ", 0&)
'Activate the Application
dummy = alias_SetActive Window(hWnd)
dummy = alias_ShowWindo w(hWnd, SW_SHOW)
'Return True if Application Running, or False if not.
AppActivateClas s = hWnd
End Function
[/code]
In module:
[code=vb]
Declare Function alias_ShowWindo w Lib "User" Alias "ShowWindow " _
(ByVal hWnd As Integer, ByVal nCmdShow As Integer) As Integer
Declare Function alias_FindWindo w Lib "User" Alias "FindWindow " _
(ByVal lpclassname As String, ByVal lpCaption As Any) As Integer
Declare Function alias_SetActive Window Lib "User" Alias _
"SetActiveWindo w" (ByVal hWnd As Integer) As Integer
Const SW_SHOW = 9
[/code]
I am keep getting error 53: File not Found 'User'
I have no idea what this error means and what file error has to do with this program?
Any ideas?
Thanks
Qi
I am trying to activate a program using its Windows Class Name. Here is the code. :
[code=vb]
Private Sub Command0_Click( )
Dim rVal As Integer
rVal = AppActivateClas s("SciCalc")
End Sub
Function AppActivateClas s(lpclassname$)
Dim hWnd As Integer 'the application's window handle
Dim dummy As Integer 'Dummy variable
'Get the Window Handle
hWnd = alias_FindWindo w("lpclassname$ ", 0&)
'Activate the Application
dummy = alias_SetActive Window(hWnd)
dummy = alias_ShowWindo w(hWnd, SW_SHOW)
'Return True if Application Running, or False if not.
AppActivateClas s = hWnd
End Function
[/code]
In module:
[code=vb]
Declare Function alias_ShowWindo w Lib "User" Alias "ShowWindow " _
(ByVal hWnd As Integer, ByVal nCmdShow As Integer) As Integer
Declare Function alias_FindWindo w Lib "User" Alias "FindWindow " _
(ByVal lpclassname As String, ByVal lpCaption As Any) As Integer
Declare Function alias_SetActive Window Lib "User" Alias _
"SetActiveWindo w" (ByVal hWnd As Integer) As Integer
Const SW_SHOW = 9
[/code]
I am keep getting error 53: File not Found 'User'
I have no idea what this error means and what file error has to do with this program?
Any ideas?
Thanks
Qi
Comment