2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Loading image dialog
#324740
05/22/10 22:24
05/22/10 22:24
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
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:
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
Senior Expert
|
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: MMike]
#324776
05/23/10 10:58
05/23/10 10:58
|
Joined: Mar 2008
Posts: 2,247 Baden Württemberg, Germany
Espér
Expert
|
Expert
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
|
try this:
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.
|
|
|
Re: Loading image dialog
[Re: 825707653]
#324948
05/24/10 01:18
05/24/10 01:18
|
Joined: Jul 2004
Posts: 1,710
MMike
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
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
OP
Serious User
|
OP
Serious User
Joined: Jul 2004
Posts: 1,710
|
|
|
|
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
Expert
|
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...
#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
|
|
|
|