CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2014
    Posts
    4

    controlling some file by C-programme

    Hi!
    I need to open a pdf file (I used system("file_name.pdf"), and it worked). Next is that I want to copy complete content of the file (I want to execute ctrl+a). I want to give this command through my C program, then I will get the content of the windows clipboard having all the copied content.
    Please help me regarding this. (C/C++/VC, all solutions acceptable)
    Thank you in advance.

    #include <stdlib.h>
    #include <stdio.h>

    int main(){
    /* opening a file */
    system("results.pdf");

    ///////////////////////////////////////////////////////
    /////copy the content in file (execute ctrl+a)/////
    ////// ------------------------------------- ////
    ///////////////////////////////////////////////////////

    return 0;
    }

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: controlling some file by C-programme

    Why do you need to "get the content of the windows clipboard having all the copied content"? What are you going to do with it?
    What if the file would be very big and your ctrl+a failed?
    ...
    So what is the main goal of your "C-programme"?
    Victor Nijegorodov

  3. #3
    Join Date
    Aug 2014
    Posts
    4

    Re: controlling some file by C-programme

    Quote Originally Posted by VictorN View Post
    Why do you need to "get the content of the windows clipboard having all the copied content"? What are you going to do with it?
    What if the file would be very big and your ctrl+a failed?
    ...
    So what is the main goal of your "C-programme"?
    Actually I want to copy content of any file by my program. I have come to know a solution, I can send keyboard event to that file after opening it.

  4. #4
    Join Date
    Aug 2014
    Posts
    4

    Re: controlling some file by C-programme

    I have tried command prompt command also but failed in case of pdf.
    clip < file_name

    It does not copy pdf file's content.

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: controlling some file by C-programme

    If your orgram is about to run on Windows computers then why not using Windows API like CopyFile or CopyFileEx?
    Victor Nijegorodov

  6. #6
    Join Date
    Aug 2014
    Posts
    4

    Re: controlling some file by C-programme

    Thanks for the suggestion. I will definitely try it once my office is over.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured