Gamestudio Links
Zorro Links
Newest Posts
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
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AbrahamR), 717 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Loading image dialog #324740
05/22/10 22:24
05/22/10 22:24
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
I have this, but now how i pass the return image to a BMAP pointer, and to save in the working folder..

the code:

Code:
IPicture* pPic;

int abd()
{
	OPENFILENAME of;
	char buf[256];
					FillMemory(&of,sizeof(of),0);
					FillMemory(buf,256,0);
					
					of.Flags=OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST;
					of.lStructSize=sizeof(of);
					of.hwndOwner=hWnd;	
					of.lpstrFilter	="Supported Files Types (*.bmp;*.gif;*.jpg;*.ico;*.emf;*.wmf)\0*.bmp;*.gif;*.jpg;*.ico;*.emf;*.wmf\0Bitmaps (*.bmp)\0*.bmp\0GIF Files (*.gif)\0*.gif\0JPEG Files (*.jpg)\0*.jpg\0Icons (*.ico)\0*.ico\0Enhanced Metafiles (*.emf)\0*.emf\0Windows Metafiles (*.wmf)\0*.wmf\0\0";
					
					of.lpstrFile=buf;
					of.nMaxFile=255;	
					of.lpstrTitle="Open";	
					if (GetOpenFileName(&of)){
						if (pPic) pPic->Release();
						pPic=LoadPic(buf);
						
					}
}



Last edited by MMike; 05/22/10 22:32.
Re: Loading image dialog [Re: MMike] #324741
05/22/10 22:49
05/22/10 22:49
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
use returning filename with bmap_create and return the resulting bmap.


3333333333
Re: Loading image dialog [Re: Quad] #324747
05/23/10 00:04
05/23/10 00:04
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
i dont work Api / C a long time, can you just write those lines for me please?

ai tred add_buffer but it did not worked as i excepted...
you mean return the filename, like
BMAP* x= bmap_create("string");
where i get that string value?

Re: Loading image dialog [Re: MMike] #324753
05/23/10 02:32
05/23/10 02:32
Joined: Jun 2009
Posts: 8
8
825707653 Offline
Newbie
825707653  Offline
Newbie
8

Joined: Jun 2009
Posts: 8
I can't understand these code.

Re: Loading image dialog [Re: MMike] #324776
05/23/10 10:58
05/23/10 10:58
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
try this:

Code:
OPENFILENAME ofd;
	char buf[256];
	FillMemory(&ofd,sizeof(ofd),0);
	FillMemory(buf,256,0);
	
	ofd.Flags=OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST|OFN_NOCHANGEDIR;
	ofd.lStructSize=sizeof(ofd);
	ofd.hwndOwner=hWnd;
	ofd.lpstrFilter	="Supported Files Types (*.bmp;*.gif;*.jpg;*.ico;*.emf;*.wmf)\0*.bmp;*.gif;*.jpg;*.ico;*.emf;*.wmf\0Bitmaps (*.bmp)\0*.bmp\0GIF Files (*.gif)\0*.gif\0JPEG Files (*.jpg)\0*.jpg\0Icons (*.ico)\0*.ico\0Enhanced Metafiles (*.emf)\0*.emf\0Windows Metafiles (*.wmf)\0*.wmf\0\0";
	ofd.lpstrInitialDir = _chr(""); //work_dir
	ofd.lpstrFile=buf;
	ofd.nMaxFile=255;	
	ofd.lpstrTitle="Load an Image File";
	if (GetOpenFileName(&ofd))
	{
		BItmap_Pointer = bmap_create(ofd.lpstrFile);
	}



Last edited by Espér; 05/23/10 10:58.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Loading image dialog [Re: 825707653] #324948
05/24/10 01:18
05/24/10 01:18
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
Originally Posted By: 825707653
I can't understand these code.


LOL..Im sure im thankful

Re: Loading image dialog [Re: Espér] #325047
05/24/10 17:46
05/24/10 17:46
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
strange its not working

Re: Loading image dialog [Re: MMike] #325049
05/24/10 17:53
05/24/10 17:53
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
perhaps you can say, WHAT is not working...
Opening the dialog..?
Calling a picture..?

What?


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Loading image dialog [Re: MMike] #325064
05/24/10 19:17
05/24/10 19:17
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
buf holds the path:
so it should be open_bmap=bmap_create(buf);

Re: Loading image dialog [Re: MMike] #325080
05/24/10 20:05
05/24/10 20:05
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Same thing. "ofd.lpstrFile" is pointing to "buf" anyway...

Both ways works for me. I just tested it.

Maybe there is a bug in your "LoadPic" function?

Here is the COMPLETE script I was testing with...
Code:
#include <litec.h>
#include <default.c>
#include <windows.h>

PANEL*	output_pan = {	bmap="#64x64x24";		pos_x=50;  pos_y=50;	flags=SHOW;		}

function main()
{	wait(5);	level_load(NULL);		vec_fill(sky_color, 50);		wait(-3);

	OPENFILENAME ofd;		FillMemory(&ofd, sizeof(ofd), 0);
	char buf[256];			FillMemory(buf,  256, 0);
	ofd.Flags=OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST|OFN_NOCHANGEDIR;
	ofd.lStructSize		= sizeof(ofd);
	ofd.hwndOwner		= hWnd;
	ofd.lpstrFilter		= "Supported Files Types (*.bmp;*.gif;*.jpg;*.ico;*.emf;*.wmf)\0*.bmp;*.gif;*.jpg;*.ico;*.emf;*.wmf\0Bitmaps (*.bmp)\0*.bmp\0GIF Files (*.gif)\0*.gif\0JPEG Files (*.jpg)\0*.jpg\0Icons (*.ico)\0*.ico\0Enhanced Metafiles (*.emf)\0*.emf\0Windows Metafiles (*.wmf)\0*.wmf\0\0";
	ofd.lpstrInitialDir = _chr("");		//work_dir
	ofd.lpstrFile		= buf;
	ofd.nMaxFile		= 255;	
	ofd.lpstrTitle		= "Load an Image File";
	if (GetOpenFileName(&ofd))		{	output_pan.bmap = bmap_create(buf);	}
	else							{	output_pan.bmap = NULL;				}

}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
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