2 registered members (AndrewAMD, ozgur),
1,421
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
is it possible to print the actual screen into a page?
#314102
03/05/10 18:23
03/05/10 18:23
|
Joined: Sep 2009
Posts: 84
Theil
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2009
Posts: 84
|
What I want to do is that when a print button is pressed in my program the printer should start printing the screen. If someone know how to do this, please tell me.
Last edited by Theil; 03/05/10 18:25.
|
|
|
Re: is it possible to print the actual screen into a page?
[Re: DJBMASTER]
#315590
03/17/10 02:39
03/17/10 02:39
|
Joined: Dec 2006
Posts: 1,086 Queensland - Australia
Nidhogg
Serious User
|
Serious User
Joined: Dec 2006
Posts: 1,086
Queensland - Australia
|
Do you want to print what's actually on the screen or just text?
Windows XP SP3 Intel Dual Core CPU: E5200 @ 2.5GHz 4.00GB DDR3 Ram ASUS P5G41T-M LX PCIE x16 GeForce GTS 450 1Gb SB Audigy 4 Spyware Doctor with AntiVirus
|
|
|
Re: is it possible to print the actual screen into a page?
[Re: Theil]
#316290
03/22/10 22:48
03/22/10 22:48
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi!
Look at
bmap_for_screen (BMAP*, var modify, var delay);
Hope this helps! Ottawa Ver 7.86.2 Pro and Lite-C
|
|
|
Re: is it possible to print the actual screen into a page?
[Re: Ottawa]
#317205
03/29/10 22:53
03/29/10 22:53
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
add to top:
#include <windows.h>
long WINAPI ShellExecute(long hwnd ,long lpOperation ,long lpFile ,long lpParameters ,long lpDirectory ,long nShowCmd);
call:
file_for_screen("printfile.jpg",0);
wait(-2);//it could be better if you check file exists or not instead of waiting 2 secs
ShellExecute(0,"print","printfile0.jpg","","",1);
this will show user a print dialog where they can choose printer, paper etc. and it will print your file. here is a complete test script. press space to trigger printing(press only once.)
#include <acknex.h>
#include <default.c>
#include <windows.h>
long WINAPI ShellExecute(long hwnd ,long lpOperation ,long lpFile ,long lpParameters ,long lpDirectory ,long nShowCmd);
TEXT* test = {
red = 0;
green = 0;
blue = 0;
font = "Arial#18b";
string = "Print from the engine!";
flags = SHOW | CENTER_X;
pos_x = 100;
pos_y = 20;
}
void print_screen(){
file_for_screen("printfile.jpg",0);
wait(-2);
ShellExecute(0,"print","printfile0.jpg","","",1);
}
void main(){
vec_set(screen_color,vector(255,255,255));
video_set(200,60,0,0);
on_space = print_screen;
}
Last edited by Quadraxas; 03/29/10 22:55.
3333333333
|
|
|
Re: is it possible to print the actual screen into a page?
[Re: Theil]
#317212
03/29/10 23:51
03/29/10 23:51
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
I do not know what does that mean but this does not look like it is related to printing see if removing this line:
file_for_screen("printfile.jpg",0);
will stop giving error(printing wont work obviously.)
3333333333
|
|
|
Re: is it possible to print the actual screen into a page?
[Re: Quad]
#317213
03/30/10 00:08
03/30/10 00:08
|
Joined: Sep 2009
Posts: 84
Theil
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2009
Posts: 84
|
Yeah the error is gone but as you said, it won't print, are you sure that I should call the function form main()? because if I set a 3d model to SHOW it starts to flick.
The actual code looks like this:
void print_screen(){ wait(-2); ShellExecute(0,"print","printfile0.jpg","","",1); reset(map_3d,INVISIBLE) }
void main() { video_mode = 8; // run at 1024 x 768 pixels video_screen = 1; handle = media_loop("TheOne.mp3",NULL,50); mouse_map = arrow; mouse_mode = 4; execute_program(); on_space = print_screen; }
|
|
|
|