با سلام
من يه برنامه دارم كه توي vb.net نوشتم. حالا مي خوام يه كد توش بذارم كه مانند babylon كلمه اي كه روي اون كليك مي كنم رو Capture كنه و مثلاً بذاره توي يه TextBox يا كپي كنه توي Clipboard.
البته از طريق WordCaptureX يه كد بدست آوردم كه فكر مي كنم كاملترين و مطمئن ترين كدي باشه كه بدست آوردم. ولي مشكل اينه كه وقتي كد رو مي ذارم توي برنامه ام، يك سري كدها رو ميگه "is not defined" بعضي رو هم ميگه "is not declared" و زيرشون زيگزاگ آبي مي كشه كه در زير به رنگ صورتي مشخص كردم. و از اونجايي كه من تسلط كافي ندارم، نمي تونم اين مشكل رو حل كنم. لطفاً راهنمايي كنيد (اين كد خيلي برام مهمه) - متشكرم :
Private
Sub StartMonitoring()
Dim color AsInteger
Dim wLineStyle As W_LINE_STYLE
Dim wKey As W_KEY
Dim wMouse As W_MOUSE
Dim dwHotkeyCursor AsInteger
Dim dwHotkeyCaret AsInteger
Dim dwHotkeySelectedText AsInteger
Dim dwIdleTime AsInteger
wKey = W_KEY.wmKeyNone
wMouse = W_MOUSE.wmMouseMiddle
m_wMonitor.LineStyle = wLineStyle
m_wMonitor.LineColor = color
m_wMonitor.Start(wKey, wMouse,
True)
EndSub
PrivateFunction PerformCapture(ByVal hwnd AsInteger, ByVal x1 AsInteger, ByVal y1 AsInteger, ByVal x2 AsInteger, ByVal y2 AsInteger) As WResult
Dim objInput As IWInput2 = ComFactory.Instance.NewWInput
Dim wOptions AsInteger = 0
' set the highlight word flag
wOptions = wOptions
Or W_CAPTURE_OPTIONS.wCaptureOptionsHighlightWords
' set the getContext flag
wOptions = wOptions
Or W_CAPTURE_OPTIONS.wCaptureOptionsGetContext
'set capture parameters
objInput.Hwnd = hWnd
objInput.StartX = x1
objInput.StartY = y1
objInput.EndX = x2
objInput.EndY = y2
objInput.Options = wOptions
' set the number of context words
objInput.ContextWordsLeft = 1
objInput.ContextWordsRight = 1
Dim objResult As WResult = m_wCapture.Capture(objInput)
'get the text from the capture
Dim strResult AsString = objResult.Text
'use OCR if native method fails
If strResult = String.Empty Then
wOptions = wOptions
Or W_CAPTURE_OPTIONS.wCaptureOptionsGetTessOCRText
objInput.OCRLanguage = "eng"
objInput.Options = wOptions
objResult = m_wCapture.Capture(objInput)
strResult = objResult.Text
EndIf
Return objResult
EndFunction