2011-04-20 4 views
2

필자는 Windows 용 (적어도 Win 7, Vista 및 Win XP도 가능) 글을 쓰고있는 새로운 응용 프로그램의 계획 단계에 있습니다. 또한, 그것을 준비 할 수 있다면, 나는 OS X (스노우 레오파드)에서 실행하는 응용 프로그램에 대한 사랑,하지만 이것은 요구 사항이 아닙니다..NET 프레임 워크에 저수준 멀티미디어 및 마우스 지원 기능이 있습니까?

어쨌든, 질문에. 생성되는

  • 캡처 모든 오디오 출력 (가능하다면, 또한 마우스 포인터를 표시) (초당 여러 프레임까지) 화면

    • 캡처 임의의 부위 : 응용 프로그램은 다음과 같은 작업을 수행하는 API 기능이 필요 사운드 카드
    • 는 (이동 클릭) 프로그래밍 방식으로 마우스를 조작
    이러한 요구 사항에 대한

    합니까 .NET이 API 기능? 그렇지 않다면, 좋은 대안이 무엇이겠습니까?


    . (참고 : 내 요구 사항에서, 응용 프로그램이 악성 코드가 될 수 있음을 보일 수는 그러나, 나는 그렇지 당신을 확신 - 그것은 미디어 소비를 간소화 매크로 기록/재생 장치의 일종 될 것입니다). 고마워, 모두들! :)

  • 답변

    1

    아니요. P/Invokes로이 작업을 수행 할 수 있습니다. 나는 그것을 한 적이 있기 때문에

    1

    그것 오랜만,하지만 난 당신이 위치에 마우스 커서를 이동할 수 있습니다 생각 :

    Cursor.Position = Drawing.Point(x, y) 
    

    당신은 확실히 화면을 캡처 할 수 있습니다 (당신이 스크린 샷을 의미 가정). 이것은 복사/붙여 넣기 엉망 약간이지만 :

    public class ScreenCapture : IDisposable 
    { 
    private string filePath = ""; 
    private Attachment attachment; 
    private Bitmap bitmap = new Bitmap(1, 1); 
    private MemoryStream imageStream = new MemoryStream(); 
    
    public ScreenCapture() { } 
    
    void IDisposable.Dispose() 
    { 
        Dispose(); 
    } 
    public void Dispose() 
    { 
        if (bitmap != null) 
        bitmap.Dispose(); 
        if (imageStream != null) 
        imageStream.Close(); 
    } 
    
    # region Property Methods 
    public string FilePath 
    { 
        get { return filePath; } 
    } 
    # endregion // Property Methods 
    
    # region Private Methods 
    /// <summary> 
    /// Capture the specified region into a bitmap object. 
    /// </summary> 
    /// <param name="sourcePoint">The point at the upper-left corner of the source rectangle.</param> 
    /// <param name="destinationPoint">The point at the upper-left corner of the destination rectangle.</param> 
    /// <param name="selectionRectangle">The size of the area to be transferred.</param> 
    private void CaptureRegionToBitmap(Point sourcePoint, Point destinationPoint, Rectangle selectionRectangle) 
    { 
        if (bitmap != null) 
        bitmap.Dispose(); 
    
        bitmap = new Bitmap(selectionRectangle.Width, selectionRectangle.Height); 
        using (Graphics g = Graphics.FromImage(bitmap)) 
        g.CopyFromScreen(sourcePoint, destinationPoint, selectionRectangle.Size); 
    } 
    # endregion // Private Methods 
    
    # region Public Methods 
    /// <summary> 
    /// Create an attachment to append to an email message. 
    /// </summary> 
    /// <returns>Returns an email attachment.</returns> 
    public Attachment GenerateAttachment() 
    { 
        return GenerateAttachment(""); 
    } 
    /// <summary> 
    /// Create an attachment from the generated bitmap to append to an email message. 
    /// </summary> 
    /// <param name="imageName">Provide a name for the attachment.</param> 
    /// <returns>Returns email attachment.</returns> 
    public Attachment GenerateAttachment(string imageName) 
    { 
        if (attachment != null) 
        attachment.Dispose(); 
    
        if (imageName == null || imageName.Trim() == "") 
        imageName = Core.LoginUserName.ToLower() + "_image.png"; 
    
        bitmap.Save(imageStream, ImageFormat.Png); 
        imageStream.Position = 0; 
        attachment = new Attachment(imageStream, imageName, "image/png"); 
        return attachment; 
    } 
    /// <summary> 
    /// Capture the entire screen to a Bitmap object stored in memory. 
    /// </summary> 
    public void CaptureFullScreen() 
    { 
        CaptureRegionToBitmap(new Point(0, 0), new Point(0, 0), SystemInformation.VirtualScreen); 
    } 
    /// <summary> 
    /// Save the generated bitmap to a physical file on disk. 
    /// </summary> 
    /// <param name="filePath"></param> 
    /// <returns>Returns True if save was successful; otherwise False.</returns> 
    public bool SaveToDisk(string filePath) 
    { 
        bool saveSuccessful = false; 
        try 
        { 
        bitmap.Save(filePath, ImageFormat.Png); 
        this.filePath = filePath; 
        saveSuccessful = true; 
        } 
        catch { } 
        return saveSuccessful; 
    } 
    # endregion // Public Methods 
    } 
    

    나는이 도구의 이름을 잊지하지만 Microsoft는 Windows 응용 프로그램과 상호 작용하는 UI 테스트/자동화 도구를 가지고 있으며, 그들이 탭 (장애인/장애인 사용자를위한) Windows 접근성을 프로그래밍 방식으로 모든 것과 상호 작용할 수 있습니다.

    도 관심의 대상이 될 수 있습니다 : 제가 알기로 UI Automation Fundamentals (MSDN)

    1

    는, 그러한 API가 없다. 그 외에 rally25rs의 대답은 그것이 존재한다고 말하는 것 같습니다.

    제 생각에는 Win32의 API를 사용하거나 .NET 리소스 액세스에 제약을받지 않기 때문에 원하는대로 성취 할 수있는 C/C++ 라이브러리를 개발할 수 있습니다. 제한, 내가 말할 수 있습니다.

    1

    .NET Framework에는이 기능에 대한 낮은 수준의 래퍼가 없습니다. 약간의 창의력, pinvoke 및 directsound로 낮은 수준의 기능을 구현할 수 있습니다. 나는 과거 C# 응용 프로그램에서 이러한 모든 작업을 수행했습니다. 이러한 링크는

    http://msdn.microsoft.com/en-us/library/ee416960%28v=vs.85%29.aspx

    http://www.pinvoke.net/default.aspx/user32/mouse_event.html

    http://www.pinvoke.net/default.aspx/user32/sendinput.html

    (DirectSound를 조금 통해 처음으로 가야 도전 주) 상당히 빨리 거기에 당신을 얻을합니다
    관련 문제