Home > Software engineering >  'DynamicWrapper' ActiveX components can't create the object.
'DynamicWrapper' ActiveX components can't create the object.

Time:09-19

Want to realize remote desktop to the server timing operation a printer, automatic emptying the log and restart
See the VBS sendkeys, but remote desktop disconnect after failure,
Later said Postmessage can study for a few days, but the first sentence is an error, but the author says it is no problem, solving? Appreciate,,,,
PS: the Server version is Windows Server 2003

People said no problem but with tablet VBS file open the second sentence is error script is as follows:
Error message:
Windows Scripr Host
ActiveX components can't create objects: 'DynamicWrapper
''==========================================================================
'
'the VBScript Source File - Created with SAPIEN Technologies PrimalScript 4.0
'
'NAME:
'
'the AUTHOR: Microsoft, Microsoft
'the DATE: 2014/8/10
'
COMMENT:
''
'===================to define variables, register API object==================================
Dim UserWrap, hWnd

The Set UserWrap=CreateObject (" DynamicWrapper ")
Set the ws=WScript. CreateObject (" WScript. Shell ")

WScript. Sleep 500

Ws. Run calc, 0

WScript. Sleep 500

'Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal HWND As Long, ByVal nCmdShow As Long) As Long
UserWrap. Register "USER32. DLL", "ShowWindow", "I=" hl, f="s", "R=l"

'Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

UserWrap. Register "USER32. DLL", "FindWindow", "I=ss", "f=s", "R=l"

'Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos (ByVal HWND As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

UserWrap. Register "USER32. DLL", "SetWindowPos", "I=Hllllll", "f=s", "R=l"

'Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal HWND As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
UserWrap. Register "USER32. DLL", "PostMessage", "I=HLLS", "f=s", "R=l"

'Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal HWND As Long, ByVal lpString As String) As Long
UserWrap. Register "USER32. DLL", "SetWindowText", "I=Hs", "f=s", "R=l"

'Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
UserWrap. Register "USER32. DLL", "FindWindowEx", "I=LLSS", "f=s", "R=l"

'Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long

UserWrap. Register "USER32. DLL", "SetCursorPos", "I=ll", "f=s", "R=l"

'===================looking for control or a window handle===============================


HWnd=UserWrap. FindWindow (vbNullString, "calculator")
'hWnd=UserWrap. FindWindow (" kugou_ui vbNullString)

HWnd1=UserWrap. FindWindowEx (hWnd, 0, vbNullString, Edit)

'UserWrap. ShowWindow hWnd, SW_HIDE

'UserWrap. SetWindowText hWnd, "hello world"

MsgBox hWnd
MsgBox hWnd1

'UserWrap. SetWindowPos hWnd, 1, 0, 0, 0, 0, 3

'MsgBox "move the mouse to the top left corner"


'UserWrap. SetCursorPos 0, 0


'=================constants defined system===========================

Private Const WM_KEYDOWN=& amp; H100
Private Const wm_keyup=& amp; H101
Private Const WM_CHAR=& amp; H102
Public Const WM_SYSKEYDOWN=& amp; H104
Public Const WM_SYSKEYUP=& amp; H105



'=================send F1 key=====================
UserWrap. PostMessage hWnd, WM_KEYDOWN, 112, 0

'=================1002========================
UserWrap. PostMessage hWnd, WM_KEYDOWN, 97, 0
UserWrap. PostMessage hWnd, WM_KEYDOWN, 96, 0
UserWrap. PostMessage hWnd, WM_KEYDOWN, 96, 0
UserWrap. PostMessage hWnd, WM_KEYDOWN, 98, 0

CodePudding user response:

Problem solved?

CodePudding user response:

Registered DynamicWrapper corresponding DLL or OCX
  •  Tags:  
  • API
  • Related