Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

URGENT:Print Screen of output in Turbo C

reemareema Posts: 3Member
hello ,
anybody can help me urgently plz.
i have already complete a simulation code using Turbo C.i'm now doing
the documentation for my project. i'd like to print screens of the output from turbo C and paste it in Paint or Word but the bottom PrintScreen SysRq in the keyboard doesn't do the job i want. so what shall i do?
anybody can help me plz.

THANX ALOT

REEMA

Comments

  • IDKIDK Posts: 1,784Member
    : hello ,
    : anybody can help me urgently plz.
    : i have already complete a simulation code using Turbo C.i'm now doing
    : the documentation for my project. i'd like to print screens of the output from turbo C and paste it in Paint or Word but the bottom PrintScreen SysRq in the keyboard doesn't do the job i want. so what shall i do?
    : anybody can help me plz.
    :
    : THANX ALOT
    :
    : REEMA
    :
    Do it the annoying and hard way:
    1. First take a picture of the screen with a analog camera.
    2. Then develop the fotograph.
    3. After that run it in youre scanner.
    4. And last run an OCR on it.

    This is annother way:
    1. Call the function doing what you want
    (it should be in some windows library I think)
    Or:
    1. Make a program that's reading screen memmory.


    [b]===============================[/b]
    El PROgrammador [b]Niklas Ulvinge[/b]

  • pseudocoderpseudocoder Posts: 681Member ✭✭✭
    : hello ,
    : anybody can help me urgently plz.
    : i have already complete a simulation code using Turbo C.i'm now doing
    : the documentation for my project. i'd like to print screens of the output from turbo C and paste it in Paint or Word but the bottom PrintScreen SysRq in the keyboard doesn't do the job i want. so what shall i do?
    : anybody can help me plz.
    :
    : THANX ALOT
    :
    : REEMA
    :

    Are you running under pure dos or from a dos window? If in a dos window, then try ALT + print screen, open paint, and hopefully select paste; if the dos window won't stay open after your program exits, then open a dos box first, and run the program from the command line.

    If it's under pure dos, then look for some sort of screen grab routine for dos. Print screen in pure dos sends output to the printer by default if I recall correctly, which wouldn't help you in this case.

  • Rana ishtiaqRana ishtiaq Posts: 19Member
    psucudocoder reply you very fine.
    if you use the your program in VC++ inviordment. then from the dos window u can get print.


  • prasunprasun Posts: 46Member
    : hello ,
    : anybody can help me urgently plz.
    : i have already complete a simulation code using Turbo C.i'm now doing
    : the documentation for my project. i'd like to print screens of the output from turbo C and paste it in Paint or Word but the bottom PrintScreen SysRq in the keyboard doesn't do the job i want. so what shall i do?
    : anybody can help me plz.
    :
    : THANX ALOT
    :
    : REEMA
    :
    once i had a similar problem so wat i did is..i run the program in win 98, while running iv pressed ALT+ENTER then comfortabally used print screen butten nd pasted it in paint......this is a shure way to get it work...

  • kuldhirkuldhir Posts: 1Member
    hi,
    you can use this cpp code in your program to
    capture output.

    //Here is a program to save a graphical o/p to bmp
    #include
    #include
    #include
    #include

    int SaveBMP16(char []);
    typedef unsigned char byte;
    typedef unsigned int word;
    typedef unsigned long dword;
    void main()
    {
    /* request auto detection */
    int gdriver;
    int gmode, errorcode;
    detectgraph(&gdriver,&gmode);
    /* initialize graphics and local variables */
    initgraph(&gdriver, &gmode, "c:\tc\bgi");

    errorcode = graphresult();
    if (errorcode != grOk) /* an error occurred */
    exit(1);


    int midx, midy,radius = 100;

    midx = getmaxx() / 2;
    midy = getmaxy() / 2;

    setcolor(getmaxcolor());

    /* draw the circle */
    circle(midx, midy, radius);

    /* clean up */
    SaveBMP16("Circle.Bmp");
    }

    struct BMP
    {

    // BitMap File Header
    byte bfType[2]; /* 1 2 must always be set to 'BM' to declare that this is a .bmp file.*/
    dword bfSize; /* 3 4 specifies the size of the file in bytes.*/
    word bfReserved1;// 7 2 must always set to zero. */
    word bfReserved2;// 9 2 must always be set to zero.
    dword bfOffset; // 11 4 specifies the offset from the beginning of the file to bitmap data.

    // BitMap Image Header
    dword biSize; // 15 4 specifies the size of the BitMap Header structure, in bytes.
    dword biWidth; // 19 4 specifies the width of image, in pixels.
    dword biHeight; // 23 4 specifies the height of image, in pixels.
    word biPlanes; // 27 2 specifies the number of planes of the target device,must be set to 0
    word biBitCount; // 29 2 specifies the number of bits per pixel.
    dword biCompression; //31 4 Specifies the type of compression, usually set to 0 - No Compres
    dword biSizeImage; // 35 4 specifies the size of the image data, in bytes. If there is no compression, it is valid to set this member to zero.
    dword biXPelsPerMeter; //39 4 specifies the the horizontal pixels per meter on the designated targer device, usually set to zero.
    dword biYPelsPerMeter; // 43 4 specifies the the vertical pixels per meter on the designated targer device, usually set to zero
    dword biClrUsed; // 47 4 specifies the number of colors used in bitmap, if set to 0 number of colors is calculated using the biBitCount member.
    dword biClrImportant; // 51 4 specifies the number of color that are 'important' for the bitmap, if set to zero, all colors are important.
    };


    int SaveBMP16(char file[])
    {
    int i=0, j=0, r, g, b;

    FILE *fp;
    BMP *bmp;

    bmp=(BMP *)malloc(54);

    bmp->bfType[0]='B';
    bmp->bfType[1]='M';
    bmp->bfSize=153718;
    bmp->bfReserved1=0;
    bmp->bfReserved2=0;
    bmp->bfOffset=118;
    bmp->biSize=40;
    bmp->biWidth=640;
    bmp->biHeight=480;
    bmp->biPlanes=1;
    bmp->biBitCount=4;
    bmp->biCompression=0;
    bmp->biSizeImage=153600; //Fixed Size ?
    bmp->biXPelsPerMeter=0;
    bmp->biYPelsPerMeter=0;
    bmp->biClrUsed=0;
    bmp->biClrImportant=0;

    fp=fopen(file, "wb");
    if(fp == NULL)
    {
    printf("File can't be open");
    getch();
    return 1;
    }


    fwrite(bmp, 54, 1, fp);
    fseek(fp, 54L, SEEK_SET);

    // Upto Here its OK.


    // Question 1. What do next 16x4 Lines do ?

    fputc(0x0, fp);
    fputc(0x0, fp);
    fputc(0x0, fp);
    fputc(0x0, fp);

    fputc(127, fp);
    fputc(0x0, fp);
    fputc(0x0, fp);
    fputc(0x0, fp);

    fputc(0x0, fp);
    fputc(127, fp);
    fputc(0x0, fp);
    fputc(0x0, fp);

    fputc(127, fp);
    fputc(127, fp);
    fputc(0x0, fp);
    fputc(0x0, fp);

    fputc(0x0, fp);
    fputc(0x0, fp);
    fputc(127, fp);
    fputc(0x0, fp);

    fputc(127, fp);
    fputc(0x0, fp);
    fputc(127, fp);
    fputc(0x0, fp);

    fputc(0x0, fp);
    fputc(192, fp);
    fputc(192, fp);
    fputc(0x0, fp);

    fputc(192, fp);
    fputc(192, fp);
    fputc(192, fp);
    fputc(0x0, fp);

    fputc(128, fp);
    fputc(128, fp);
    fputc(128, fp);
    fputc(0x0, fp);

    fputc(255, fp);
    fputc(0x0, fp);
    fputc(0x0, fp);
    fputc(0x0, fp);

    fputc(0x0, fp);
    fputc(255, fp);
    fputc(0x0, fp);
    fputc(0x0, fp);

    fputc(255, fp);
    fputc(255, fp);
    fputc(0x0, fp);
    fputc(0x0, fp);

    fputc(0x0, fp);
    fputc(0x0, fp);
    fputc(255, fp);
    fputc(0x0, fp);

    fputc(255, fp);
    fputc(0x0, fp);
    fputc(255, fp);
    fputc(0x0, fp);

    fputc(0x0, fp);
    fputc(255, fp);
    fputc(255, fp);
    fputc(0x0, fp);

    fputc(255, fp);
    fputc(255, fp);
    fputc(255, fp);
    fputc(0x0, fp);

    i=0;
    j=479;

    fseek(fp, 118, SEEK_SET);

    while(j>=0)
    {
    i=0;
    while(i<640)
    {
    fputc((getpixel(i, j)<<4) | getpixel(i+1, j), fp); //Que 2. What does this do ? Why Left Shift 4 times and why Bit wise ORing of two pixles.
    i+=2;
    }
    j--;
    }
    free(bmp);
    fclose(fp);
    return 0;
    }
Sign In or Register to comment.