Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, ozgur), 1,421 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
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 Offline OP
Junior Member
Theil  Offline 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: Theil] #315583
03/16/10 22:35
03/16/10 22:35
Joined: Sep 2009
Posts: 84
Theil Offline OP
Junior Member
Theil  Offline OP
Junior Member

Joined: Sep 2009
Posts: 84
Well I guess it's not possible =/

Re: is it possible to print the actual screen into a page? [Re: Theil] #315586
03/16/10 23:48
03/16/10 23:48
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
It should be posssible with the winAPI, although I've never used it for printing so I can't really help you.

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 Offline
Serious User
Nidhogg  Offline
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: Nidhogg] #315924
03/20/10 05:02
03/20/10 05:02
Joined: Sep 2009
Posts: 84
Theil Offline OP
Junior Member
Theil  Offline OP
Junior Member

Joined: Sep 2009
Posts: 84
I want to print everything to a page with a printer, well maybe I could use WinAPI but I don't know where to start.

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
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

Look at

bmap_for_screen (BMAP*, var modify, var delay);


Hope this helps!
Ottawa laugh

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 Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
add to top:
Code:
#include <windows.h>
long WINAPI ShellExecute(long hwnd ,long lpOperation ,long lpFile ,long lpParameters ,long lpDirectory ,long nShowCmd);



call:
Code:
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.)

Code:
#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: Quad] #317211
03/29/10 23:47
03/29/10 23:47
Joined: Sep 2009
Posts: 84
Theil Offline OP
Junior Member
Theil  Offline OP
Junior Member

Joined: Sep 2009
Posts: 84
Thanks but I think there must be something wrong because now I'm getting this error


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 Offline
Senior Expert
Quad  Offline
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 Offline OP
Junior Member
Theil  Offline 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;

}

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1