Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create capture image (not use Capturetofile)

Status
Not open for further replies.

kls113

Aerospace
Nov 30, 2017
2
JP
I am trying to write a macro to

Step1.get capture image(like:tools>image>captures)
Step2.paste one for MSexcel sheet

I cant find solution for Step1.I tryed to use Sendkey Command but didn't.
I have found posts that show how to capture to file, do a screen shot through windows but those do not help.
I want to treat more higher resolution image by the setting like a CaptureOptions(in tools>image>captures).

Please help me with having a macro do a copy of an image and not a caturetofile.
 
Replies continue below

Recommended for you

Hello kls113,

My code has been for long time in VB.net.
I think this quality being equivalent high.
You can ref it.

-----------------------------------------------------------------

Imports INFITF
Imports MECMOD
Imports System.IO '---> Khai báo thư viện cho hàm xóa file Delete

Public Class Form1
Public ten_file As String = "C:\vbtemp\foto1.bmp"
Public Sub hienThifoto()
pibCapture.Image = Image.FromFile(ten_file)
End Sub

Private Sub btnCapNhat_Click(sender As Object, e As EventArgs) Handles btnCapNhat.Click
Dim CATIA As INFITF.Application
CATIA = GetObject(, "CATIA.Application")
If CATIA Is Nothing Then CATIA = CreateObject("CATIA.Application")
Dim view_hien_hanh As Viewer
view_hien_hanh = CATIA.ActiveWindow.ActiveViewer '--->Gán trạng thái màn hình active cho biến view_hien_hanh
view_hien_hanh.Update() '---> Update lại View
'view_hien_hanh.Reframe() '--->Đưa màn hình về Fit Mode
'---Xoa file foto1.bmp truoc khi gui ra picturebox
Call view_hien_hanh.CaptureToFile(CatCaptureFormat.catCaptureFormatBMP, ten_file)
CATIA.RefreshDisplay = True
Call hienThifoto()
End Sub

Private Sub btnXoaAnh_Click(sender As Object, e As EventArgs) Handles btnXoaAnh.Click
pibCapture.Image = Nothing
'System.IO.File.Delete(ten_file)
End Sub
End Class

2017-11-30_22_17_29-PowerPoint_Slide_Show_-_004_CapNhatTrangThaiManHInh.pptx_ox8ok6.png



Enjoy!


CATIAketnoi
Engineering Connecting and Collaboration
-------------------------
 
Hi dung nguyen!
Thanks for your code, but I'd like to set any resolution(ex.W:2500px H:1800px), do you have any solution?
For images output as standard function(Capturetofile), the resolution is not sufficient to read many text, so I'd like to know the manual setting method please.
 
Hi
i recreated this macro, and make it more simple, i figure it out that this macro get dimension from your screen
so if you have big screen you will got bigger picture.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top