dev-cpp-users Mailing List for Dev-C++ (Page 689)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Elias P. <eli...@ao...> - 2001-06-25 19:06:10
|
> I fear that won't help cause I don't want to _set_ the parameter I wanna _get_
> these informations of the DIB.
Yes, I looked at the documentation now, and that function already needs some
info. You could always use GetObject() to get the bitmap dimensions.
> How to load a Image from disk, let's say "picture.bmp" (which is -just for
> example- about 50k),
> findout its dimensions and display it on the screen?
Ok, if that is all you want to do, there's no need for DIBitmaps at all..
I paste some example code which loads and displays a bitmap directly on the
desktop.
Elias Pschernig
--
#include <windows.h>
int WINAPI WinMain(HINSTANCE hinst,HINSTANCE prev,LPSTR arg,int show) {
HANDLE bitmapHandle;
HDC sourceDC, destinationDC;
BITMAP bitmap;
// load bitmap from disk
bitmapHandle = LoadImage(NULL, "test.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
// normally, you will use: destinationDC = GetDC(hWnd); hWnd being the window to
// draw to, never use the desktop for that, for obvious reasons
destinationDC = GetWindowDC(GetDesktopWindow());
// Get data from the handle
GetObject(bitmapHandle, sizeof(bitmap), &bitmap);
// Create compatible device context and tell it to use the bitmap
sourceDC = CreateCompatibleDC(destinationDC);
SelectObject(sourceDC, bitmapHandle);
// draw the bitmap
BitBlt(destinationDC, 0, 0, bitmap.bmWidth, bitmap.bmHeight, sourceDC, 0, 0, SRCCOPY);
// In C, always release stuff you have allocated..
DeleteDC(sourceDC);
ReleaseDC(GetDesktopWindow(), destinationDC);
return 0;
}
|
|
From: Schedler, K. <Kur...@hi...> - 2001-06-25 18:11:03
|
when you construct a derived class, the parent class is fully constructed first, then the derived class is constructed. in this case, the baseclass constructor requires three arguments. in order for the baseclass to be constructed properly, it needs to receive its arguments immediately. the colon begins what is called a function preamble. This allows you to construct base classes and initialize constant data members before performing the body of your constructor. all this code really means to you is "before we construct our derived class, we need to construct the base class". the author of "C++ In Action" ( http://www.relisoft.com/book/index.htm) <http://www.relisoft.com/book/index.htm)> makes extensive use of function preambles for setting variables and whatnot. -----Original Message----- From: softnasolutions-ltd.fsbusiness.co.uk [mailto:so...@so...] Sent: Monday, June 25, 2001 10:54 AM To: dev...@li... Subject: [Dev-C++] Derived class initialization Hi all, I'm stuying C++ using some sample programs and I have come accross this line of code which i don't quite understand. PLease sombody tell me what it means. derivedclass::derivedclass(classgrade *ave, name, age) : baseclass(ave, name, age). What i don't understand is what it means to have :baseclass(ave, name, age). I figure it has something to do with initiallising the derived calss. but i don't understant exactly what it does. Thnx. Napoleon. "The sender believes that this E-mail and any attachments were free of any virus, worm, Trojan horse, and/or malicious code when sent. This message and its attachments could have been infected during transmission. By reading the message and opening any attachments, the recipient accepts full responsibility for taking protective and remedial action about viruses and other defects. The sender's employer is not liable for any loss or damage arising in any way from this message or its attachments." |
|
From: softnasolutions-ltd.fsbusiness.co.uk <so...@so...> - 2001-06-25 17:54:33
|
Hi all, I'm stuying C++ using some sample programs and I have come accross this = line of code which i don't quite understand. PLease sombody tell me what = it means. derivedclass::derivedclass(classgrade *ave, name, age) : baseclass(ave, = name, age). What i don't understand is what it means to have :baseclass(ave, name, = age). I figure it has something to do with initiallising the derived = calss. but i don't understant exactly what it does. Thnx. Napoleon. |
|
From: Johannes P. <joh...@pr...> - 2001-06-25 10:13:18
|
To be honest gisan
------------------------------
Deleteing (Freeing ) the System Memory is not a Good Ide . Meaning freeing
argv is not a good Idea. As I
have understood in the time I have worked with C .. It is a System (OS)
specific Variable that you only have a pointer to to access. It is not a
copy of
it in memory that is made for you..
This is all that I can give an answer to for this is how I understand it..
Yes there is a tool that caches memory leaks.. or to put it this was shows
them possibly out.(that is
exept for the one between your ears) But I have to cehck If I can find the
name again and if it is for C for
I know it is for Delphi so far.
Also a note of warning.. The macros that you write there is maybe fancy but
it is
number one, harder to debug and number 2 an give problems if you put a
space between
NEWARRAY and the bracket or funny typo's like that. For I remmeber that in
some compiler they can result in a mispmatc and not be compiled. in..
But otherwise it is hard to debug for you cant trace into that code any
more. Only at lower debug level wise..
Well
good luck
Johannes
At 10:48 24/06/2001 +0200, you wrote:
>Hello !
>
>The small program that follows seems to be correct, with DEV it compiles and
>executes successfully, but I have a few questions about it (see the comment)
>
>test.c
>-------
>/*********************************************************************
>
>Please answer these questions:
>(suppose that argc is 1, so that the if will be executed)
>
>- am I allowed to free argv (before the statement argv = new_argv)?
>
>- at the end of the program. will anybody free argv (and the strings
> pointed by its elements) for me?
>
>- if nobody frees argv, will there be a "memory leak"?
>
>- can a "memory leak" cause trouble?
>
>*********************************************************************/
>#include <stdio.h>
>#include <stdlib.h>
>#include <string.h>
>
>#define ARGV0 "new_program_name"
>#define ARGV1 "new_first_argument"
>
>#define NEWARRAY(ptr, len, T) \
> { \
> ptr = (T *)calloc(len, sizeof(T)); \
> if (!ptr) \
> { \
> fputs("out of memory\n", stderr); \
> exit(EXIT_FAILURE); \
> } \
> }
>
>#define NEWSTRING(ptr, len) \
> NEWARRAY(ptr, len + 1, char)
>
>char *
>copy(const char *from); /* make a copy of FROM */
>
>/********************************************************************/
>int
>main(int argc, char **argv)
>{
> if (argc == 1) /* change the argument list */
> {
> char **new_argv;
>
> argc = 2;
> NEWARRAY(new_argv, argc, char *); /* get memory for arg list */
>
> new_argv[0] = copy(ARGV0);
> new_argv[1] = copy(ARGV1);
>
> free(argv); /* trouble ? */
>
> argv = new_argv; /* who will free new_argv? */
> }
>
> puts("Here is the argument list:");
> while (argc--)
> puts(*argv++);
>
> system("pause");
> return EXIT_SUCCESS;
>}
>
>/*******************************************************************/
>
>char *
>copy(const char *from)
>{
> int len = strlen(from);
> char *s;
>
> NEWSTRING(s, len);
> return strcpy(s, from);
>}
>-------
>
>One last thing: is there any tool that catches memory leaks ?
>
>Thank you for your time.
>
>--
>gisan
>
>
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: <jos...@ya...> - 2001-06-25 07:11:32
|
Actually yes but indirectly. You call LoadImage to get the handle of
the bmp, then call GetObject to get the data you're asking for. See
below for a description of the GetObject function.
--- Gregor Peter <Gre...@dl...> escribió: > Hmmm, the
LoadImage( ... ) is a part of the Programmers Reference
> but returns
> (just) a HANDLE .
>
> What I need is a pointer to a BITMAPFILEHEADER to get some
> informations
> SetDIBBitsToDevice( ... ) needs to be able to display the loaded
> Image.
>
> I can't find any informations about HANDLEs in the Windows API
> reference.
> Is it possible to feed the BITMAPFILEHEADER structure via this
> HANDLE?
>
> Gregor
The GetObject function obtains information about a specified graphics
object. Depending on the graphics object, the function places a
filled-in BITMAP, DIBSECTION, EXTLOGPEN, LOGBRUSH, LOGFONT, or LOGPEN
structure, or a count of table entries (for a logical palette), into a
specified buffer.
int GetObject(
HGDIOBJ hgdiobj, // handle to graphics object of interest
int cbBuffer, // size of buffer for object information
LPVOID lpvObject // pointer to buffer for object information
);
Parameters
hgdiobj
A handle to the graphics object of interest. This can be a handle to
one of the following: a logical bitmap, a brush, a font, a palette, a
pen, or a device independent bitmap created by calling the
CreateDIBSection function.
cbBuffer
Specifies the number of bytes of information to be written to the
buffer.
lpvObject
Points to a buffer that is to receive the information about the
specified graphics object.
The following table shows the type of information the buffer receives
for each type of graphics object you can specify with hgdiobj:
hgdiobj Type Data Written to *lpvObject
HBITMAP BITMAP
HBITMAP returned from a call to CreateDIBSection DIBSECTION, if
cbBuffer is set to sizeof(DIBSECTION), or BITMAP, if cbBuffer is set to
sizeof(BITMAP)
HPALETTE a WORD count of the number of entries in the logical palette
HPEN returned from a call to ExtCreatePen EXTLOGPEN
HPEN LOGPEN
HBRUSH LOGBRUSH
HFONT LOGFONT
If the lpvObject parameter is NULL, the function return value is the
number of bytes required to store the information it writes to the
buffer for the specified graphics object.
Return Values
If the function succeeds, and lpvObject is a valid pointer, the return
value is the number of bytes stored into the buffer.
If the function succeeds, and lpvObject is NULL, the return value is
the number of bytes required to hold the information the function would
store into the buffer.
If the function fails, the return value is zero. To get extended error
information, call GetLastError.
Remarks
The buffer pointed to by the lpvObject parameter must be sufficiently
large to receive the information about the graphics object.
If hgdiobj identifies a bitmap created by calling CreateDIBSection, and
the specified buffer is large enough, the GetObject function returns a
DIBSECTION structure. In addition, the bmBits member of the BITMAP
structure contained within the DIBSECTION will contain a pointer to the
bitmap's bit values.
If hgdiobj identifies a bitmap created by any other means, GetObject
returns only the width, height, and color format information of the
bitmap. You can obtain the bitmap's bit values by calling the GetDIBits
or GetBitmapBits function.
If hgdiobj identifies a logical palette, GetObject retrieves a two-byte
integer that specifies the number of entries in the palette. The
function does not retrieve the LOGPALETTE structure defining the
palette. To retrieve information about palette entries, an application
can call the GetPaletteEntries function.
_______________________________________________________________
Do You Yahoo!?
Yahoo! Messenger: Comunicación instantánea gratis con tu gente -
http://messenger.yahoo.es
|
|
From: Elias P. <eli...@ao...> - 2001-06-24 19:54:39
|
> I fear that won't help cause I don't want to _set_ the parameter I wanna _get_ > these informations of the DIB. > > How to load a Image from disk, let's say "picture.bmp" (which is -just for > example- about 50k), > findout its dimensions and display it on the screen? I can't look into the documentation right now, but you had a function to display a DIB bitmap. But LoadImage just returns a HANDLE. So you could use the *GET*DIBits function to get the info you need for the display function, from the HANDLE, which you get from the bitmap file on disk. (i will look at the documentation for the 3 functions later..) Elias Pschernig |
|
From: Gregor P. <Gre...@dl...> - 2001-06-24 18:35:22
|
I fear that won't help cause I don't want to _set_ the parameter I wanna _get_ these informations of the DIB. How to load a Image from disk, let's say "picture.bmp" (which is -just for example- about 50k), findout its dimensions and display it on the screen? Gregor ----- schnipp ----- Elias Pschernig wrote: > > Hmmm, the LoadImage( ... ) is a part of the Programmers Reference but > > returns (just) a HANDLE . > > What I need is a pointer to a BITMAPFILEHEADER to get some informations > > SetDIBBitsToDevice( ... ) needs to be able to display the loaded Image. > > I can't find any informations about HANDLEs in the Windows API reference. > > Is it possible to feed the BITMAPFILEHEADER structure via this HANDLE? > > Gregor > > Have a look at the GetDIBits() function, it seem to convert from the HANDLE > into what you want. > > Elias Pschernig |
|
From: Luigi S. <gi...@li...> - 2001-06-24 17:44:30
|
Hello !
The small program that follows seems to be correct, with DEV it compiles and
executes successfully, but I have a few questions about it (see the comment)
test.c
-------
/*********************************************************************
Please answer these questions:
(suppose that argc is 1, so that the if will be executed)
- am I allowed to free argv (before the statement argv = new_argv)?
- at the end of the program. will anybody free argv (and the strings
pointed by its elements) for me?
- if nobody frees argv, will there be a "memory leak"?
- can a "memory leak" cause trouble?
*********************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ARGV0 "new_program_name"
#define ARGV1 "new_first_argument"
#define NEWARRAY(ptr, len, T) \
{ \
ptr = (T *)calloc(len, sizeof(T)); \
if (!ptr) \
{ \
fputs("out of memory\n", stderr); \
exit(EXIT_FAILURE); \
} \
}
#define NEWSTRING(ptr, len) \
NEWARRAY(ptr, len + 1, char)
char *
copy(const char *from); /* make a copy of FROM */
/********************************************************************/
int
main(int argc, char **argv)
{
if (argc == 1) /* change the argument list */
{
char **new_argv;
argc = 2;
NEWARRAY(new_argv, argc, char *); /* get memory for arg list */
new_argv[0] = copy(ARGV0);
new_argv[1] = copy(ARGV1);
free(argv); /* trouble ? */
argv = new_argv; /* who will free new_argv? */
}
puts("Here is the argument list:");
while (argc--)
puts(*argv++);
system("pause");
return EXIT_SUCCESS;
}
/*******************************************************************/
char *
copy(const char *from)
{
int len = strlen(from);
char *s;
NEWSTRING(s, len);
return strcpy(s, from);
}
-------
One last thing: is there any tool that catches memory leaks ?
Thank you for your time.
--
gisan
|
|
From: Elias P. <eli...@ao...> - 2001-06-23 21:07:31
|
> Hmmm, the LoadImage( ... ) is a part of the Programmers Reference but > returns (just) a HANDLE . > What I need is a pointer to a BITMAPFILEHEADER to get some informations > SetDIBBitsToDevice( ... ) needs to be able to display the loaded Image. > I can't find any informations about HANDLEs in the Windows API reference. > Is it possible to feed the BITMAPFILEHEADER structure via this HANDLE? > Gregor Have a look at the GetDIBits() function, it seem to convert from the HANDLE into what you want. Elias Pschernig |
|
From: Gregor P. <Gre...@dl...> - 2001-06-23 20:41:30
|
Hi there, I like to display several images during runtime of my programm. Charles Petzold uses in his book "Programming Windows" a function called BITMAPFILEHEADER* DibLoadImage( szName filename ) from DIBFILE.H to manage this. #include "dibfile.h" BITMAPFILEHEADER* pbmfh; pbmfh = DibLoadImage( "myFile.bmp" ); ... SetDIBitsToDevice( pbmfh.cx, pbmfh.cy, ... ); DevC++ doesn't know anything about the header-file and it's functions :-( PS: LoadImage( ) won't work cause it returns a HANDLE instead of a BITMAPFILEHEADER. |
|
From: Gregor P. <Gre...@dl...> - 2001-06-23 20:41:24
|
Hmmm, the LoadImage( ... ) is a part of the Programmers Reference but returns (just) a HANDLE . What I need is a pointer to a BITMAPFILEHEADER to get some informations SetDIBBitsToDevice( ... ) needs to be able to display the loaded Image. I can't find any informations about HANDLEs in the Windows API reference. Is it possible to feed the BITMAPFILEHEADER structure via this HANDLE? Gregor -------- schnipp ---------- Jose Manuel Padron Carrillo wrote: > Hi, > > I think you're using a user defined function. That function is not in > the Windows API reference. Instead you can use LoadImage(). See below. > > --- Gregor Peter <Gre...@dl...> escribió: > Hi there, > > > > I like to display some Images, the examples in my books are using the > > function > > DibLoadImage( szFileName ) > > from the header file > > dibfile.h > > > > like > > # include "dibfile.h" > > BITMAPFILEHEADER* pbmfh; > > > > pbmfh = DibLoadImage( "myPic.bmp" ); > > ... > > > > The Borland Win32 Programmer Reference doesn't know such a function > > and > > Dev-C++ nothing about such a headerfile. > > > > Does someone know what to do? > > The LoadImage function loads an icon, cursor, or bitmap. > > HANDLE LoadImage( > > HINSTANCE hinst, // handle of the instance that contains the image > LPCTSTR lpszName, // name or identifier of image > UINT uType, // type of image > int cxDesired, // desired width > int cyDesired, // desired height > UINT fuLoad // load flags > ); > |
|
From: <ste...@ge...> - 2001-06-21 19:43:11
|
Here's how I made my framerate limiter: (further explanation below)
#include <time.h> /* Contains the clock_t type definition, for the =
framerate-measure */
#include <conio.h> /* Contains the kbhit() function, which we'l use for =
the mainloop */
void Game(void)
{
int F; /* Frame counter */
const int FRAMERATE =3D 160; /* We need a framerate @ 160fps or =
less */
clock_t Fstart, Fend; /* Time variables */
F =3D 0;
Fstart =3D clock();
Fend =3D clock();
/* This is the main game loop */
while( !kbhit() )
{
/* Increase our framecounter with 1, each frame/gameloop */
F++;
/* Here we keep looping, until we have decreased
the framerate to FRAMERATE fps */
while( int( F / ( (1+Fend-Fstart) / CLK_TCK ) ) > int(FRAMERATE) =
)
{
Fend =3D clock();
}
}
}
Further explanation:
A framerate is the count, of frames that is displayed each seccond. So, =
if we want a framerate of 160 frames per second (160frames / 1second), =
we can calculate the time that is supposed to pass between each frame =
like this;
TimeBetweenEachFrame =3D 1second / 160frames =3D 0.00625seconds
Okay... The "( (1+Fend-Fstart) / CLK_TCK )" is the time that has passed =
since Fstart =3D clock(); ( The "/ CLK_TCK" is to convert the =
timemeasure into seconds). The "F++;" is to keep counting the frames =
each time we make one.
So the loop goes;
while ( FramesSoFar / TimeSoFar > FrameRateWeLike )
{
TimeSoFar +=3D TimeSinceLastLoop;
}
Bye:
So, I hope this is any good for you Ian. I'm glad to help :)
If there's anything else, just let me know.
- Stein Nyg=E5rd :)
----- Original Message -----
From: "Ian Weston" <lak...@ho...>
To: <dev...@li...>
Sent: Wednesday, June 20, 2001 8:55 PM
Subject: Re: [Dev-C++] Franerate limiter! Damn!
> hi there stein, i was just wondering if it would be possible for you =
to
send
> me the code that worked if thats ok. i would really apreciate it if =
you
> could.
>
> thanks ian.
>
>
> >From: Stein Nyg=E5rd <ste...@ge...>
> >Reply-To: dev...@li...
> >To: <dev...@li...>
> >Subject: [Dev-C++] Franerate limiter! Damn!
> >Date: Wed, 20 Jun 2001 11:42:25 +0200
> >
> >Just ignonore my last mail, I jsut got it working :)
> >
> >Tanks!
>
> =
_________________________________________________________________________=
> Get Your Private, Free E-mail from MSN Hotmail at =
http://www.hotmail.com.
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Wendel <we...@ha...> - 2001-06-21 13:40:22
|
Hello Guy, Thkz for all people!! :) Best Regards, [ ]'s |
|
From: Thomas J. <th...@zi...> - 2001-06-21 11:40:34
|
At 11:38 21-6-2001 +0200, you wrote: > Hmm I am not shure if it is the answer to that what I need. I don't want >to prompt the user for file operations, I like to save some >programminternal values to a file. For varialbes like: >int i = 0; >String valueID = "X"; I wanna get a Textfile that contain: >X = 0 By using something like: >fprintf ( fileID, "%c = %d", valueID, i ); "WriteFile()" work the same fopen, fprintf normally work under windows otherwise use wsprintf to format a string and write to file using WriteFile. Thomas |
|
From: <jos...@ya...> - 2001-06-21 11:01:42
|
--- Gregor Peter <Gre...@dl...> escribió: > Hmm I am not shure if it is the answer to that what I need. > I don't want to prompt the user for file operations, I like to save > some programminternal values to a file. You don't need to prompt the user if you don't like. It's just the example I sent. So with some minor modifications you can get what you need. > For varialbes like: > int i = 0; > String valueID = "X"; > > I wanna get a Textfile that contain: > X = 0 > > By using something like: > fprintf ( fileID, "%c = %d", valueID, i ); > > I didn't figured out yet if "WriteFile()" work the same way. > For WriteFile you need to pass a pointer to the string and the length of it (among other parameters). So in your case you can do a wsprintf() before and then pass the string as parameter for WriteFile(). Hope this helps. _______________________________________________________________ Do You Yahoo!? Yahoo! Messenger: Comunicación instantánea gratis con tu gente - http://messenger.yahoo.es |
|
From: Lorenzo <co...@in...> - 2001-06-21 10:06:58
|
> By using something like: > fprintf ( fileID, "%c = %d", valueID, i ); > > I didn't figured out yet if "WriteFile()" work the same way. The api WriteFile() don't work like fprintf, but you can use api wsprintf() to create the string to send to WriteFile(), the wsprintf work same way of sprintf(). ---------------------------------------------------------------------------- --- If debugging is the process of removing bugs, then programming must be the process of putting them in. ---------------------------------------------------------------------------- --- |
|
From: Gregor P. <Gre...@dl...> - 2001-06-21 09:40:41
|
Hmm I am not shure if it is the answer to that what I need. I don't want to prompt the user for file operations, I like to save some programminternal values to a file. For varialbes like: int i = 0; String valueID = "X"; I wanna get a Textfile that contain: X = 0 By using something like: fprintf ( fileID, "%c = %d", valueID, i ); I didn't figured out yet if "WriteFile()" work the same way. Thanx so far Jose Manuel Padron Carrillo wrote: > --- Gregor Peter <Gre...@dl...> escribió: > Can someone tell me > how to open and write into a textfile (even into > > a > > already opened one) > > Is there under Windows something like fprintf () ? > > > > CreateFile() > ReadFile() > WriteFile() > > I send as attachment one of Dev-C++ examples where those functions are > used. > > I hope this help. |
|
From: Lorenzo <co...@in...> - 2001-06-21 09:28:01
|
This is an example for set key in registry:
#include <windows.h>
int main(int argc, char *argv[])
{
HKEY hKey;
DWORD dwDisposition;
unsigned char *szBuf = (unsigned char *)strdup("lorenzo");
if (RegCreateKeyEx(HKEY_CURRENT_USER, "test", 0, "REG_SZ",
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, &dwDisposition) !=
ERROR_SUCCESS)
return 1;
if (RegSetValueEx(hKey, "string", 0, REG_SZ, szBuf,
strlen((char*)szBuf)) != ERROR_SUCCESS)
return 1;
RegCloseKey(hKey);
return 0;
}
This program open or create if not exist the key "test" in key
HKEY_CURRENT_USER and create string value "string" with value "lorenzo".
This is an example for get key in registry:
#include <windows.h>
int main(int argc, char *argv[])
{
HKEY hKey;
DWORD dwType;
DWORD dwLen;
unsigned char szBuf[255] = {0};
if (RegOpenKeyEx(HKEY_CURRENT_USER, "test", 0, KEY_ALL_ACCESS, &hKey)
!= ERROR_SUCCESS)
return 1;
if (RegQueryValueEx(hKey, "string", 0, &dwType, szBuf, &dwLen) !=
ERROR_SUCCESS)
return 1;
RegCloseKey(hKey);
return 0;
}
This program open the existing key "test" and read value from string value
"string", copy it into szBuf, the size of string is stored into dwLen and
the type of value key is stored into dwType.
I hope this can help you.
----------------------------------------------------------------------------
---
If debugging is the process of removing bugs,
then programming must be the process of putting them in.
----------------------------------------------------------------------------
---
|
|
From: <jos...@ya...> - 2001-06-21 06:54:37
|
--- Gregor Peter <Gre...@dl...> escribió: > Can someone tell me how to open and write into a textfile (even into > a > already opened one) > Is there under Windows something like fprintf () ? > CreateFile() ReadFile() WriteFile() I send as attachment one of Dev-C++ examples where those functions are used. I hope this help. _______________________________________________________________ Do You Yahoo!? Yahoo! Messenger: Comunicación instantánea gratis con tu gente - http://messenger.yahoo.es |
|
From: <jos...@ya...> - 2001-06-21 06:49:58
|
Hi,
I think you're using a user defined function. That function is not in
the Windows API reference. Instead you can use LoadImage(). See below.
--- Gregor Peter <Gre...@dl...> escribió: > Hi there,
>
> I like to display some Images, the examples in my books are using the
> function
> DibLoadImage( szFileName )
> from the header file
> dibfile.h
>
> like
> # include "dibfile.h"
> BITMAPFILEHEADER* pbmfh;
>
> pbmfh = DibLoadImage( "myPic.bmp" );
> ...
>
> The Borland Win32 Programmer Reference doesn't know such a function
> and
> Dev-C++ nothing about such a headerfile.
>
> Does someone know what to do?
The LoadImage function loads an icon, cursor, or bitmap.
HANDLE LoadImage(
HINSTANCE hinst, // handle of the instance that contains the image
LPCTSTR lpszName, // name or identifier of image
UINT uType, // type of image
int cxDesired, // desired width
int cyDesired, // desired height
UINT fuLoad // load flags
);
Parameters
hinst
Identifies an instance of the module that contains the image to be
loaded. To load an OEM image, set this parameter to zero.
lpszName
Identifies the image to load.
If the hinst parameter is non-NULL and the fuLoad parameter does not
include LR_LOADFROMFILE, lpszName is a pointer to a null-terminated
string that contains the name of the image resource in the hinst
module.
If hinst is NULL and LR_LOADFROMFILE is not specified, the low-order
word of this parameter must be the identifier of the OEM image to load.
The OEM image identifiers are defined in WINUSER.H and have the
following prefixes:
Prefix Meaning
OBM_ OEM bitmaps
OIC_ OEM icons
OCR_ OEM cursors
Windows 95: If the fuLoad parameter includes the LR_LOADFROMFILE value,
lpszName is the name of the file that contains the image.
Windows NT: LR_LOADFROMFILE is not supported.
uType
Specifies the type of image to be loaded. This parameter can be one of
the following values:
Value Meaning
IMAGE_BITMAP Loads a bitmap.
IMAGE_CURSOR Loads a cursor.
IMAGE_ICON Loads an icon.
cxDesired
Specifies the width, in pixels, of the icon or cursor. If this
parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the
function uses the SM_CXICON or SM_CXCURSOR system metric value to set
the width. If this parameter is zero and LR_DEFAULTSIZE is not used,
the function uses the actual resource width.
cyDesired
Specifies the height, in pixels, of the icon or cursor. If this
parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the
function uses the SM_CYICON or SM_CYCURSOR system metric value to set
the height. If this parameter is zero and LR_DEFAULTSIZE is not used,
the function uses the actual resource height.
fuLoad
Specifies a combination of the following values:
Value Meaning
LR_DEFAULTCOLOR The default flag; it does nothing. All it means is "not
LR_MONOCHROME".
LR_CREATEDIBSECTION When the uType parameter specifies IMAGE_BITMAP,
causes the function to return a DIB section bitmap rather than a
compatible bitmap. This flag is useful for loading a bitmap without
mapping it to the colors of the display device.
LR_DEFAULTSIZE Uses the width or height specified by the system metric
values for cursors or icons, if the cxDesired or cyDesired values are
set to zero. If this flag is not specified and cxDesired and cyDesired
are set to zero, the function uses the actual resource size. If the
resource contains multiple images, the function uses the size of the
first image.
LR_LOADFROMFILE Loads the image from the file specified by the lpszName
parameter. If this flag is not specified, lpszName is the name of the
resource.
LR_LOADMAP3DCOLORS Searches the color table for the image and replaces
the following shades of gray with the corresponding 3D color:
Color Replaced with
Dk Gray, RGB(128,128,128) COLOR_3DSHADOW
Gray, RGB(192,192,192) COLOR_3DFACE
Lt Gray, RGB(223,223,223) COLOR_3DLIGHT
LR_LOADTRANSPARENT Retrieves the color value of the first pixel in the
image and replaces the corresponding entry in the color table with the
default window color (COLOR_WINDOW). All pixels in the image that use
that entry become the default window color. This value applies only to
images that have corresponding color tables. If fuLoad includes both
the LR_LOADTRANSPARENT and LR_LOADMAP3DCOLORS values, LRLOADTRANSPARENT
takes precedence. However, the color table entry is replaced with
COLOR_3DFACE rather than COLOR_WINDOW.
LR_MONOCHROME Loads the image in black and white.
LR_SHARED Shares the image handle if the image is loaded multiple
times. If LR_SHARED is not set, a second call to LoadImage for the same
resource will load the image again and return a different handle.Do not
use LR_SHARED for images that have non-standard sizes, that may change
after loading, or that are loaded from a file.
Return Values
If the function succeeds, the return value is the handle of the newly
loaded image.
If the function fails, the return value is NULL.
_______________________________________________________________
Do You Yahoo!?
Yahoo! Messenger: Comunicación instantánea gratis con tu gente -
http://messenger.yahoo.es
|
|
From: Kaustubh P. <kau...@pa...> - 2001-06-21 03:56:37
|
HI.. I am trying to read the contents of the .zip fies and .jar files..I am = not getting any API / Package that can do it .... I know it can be done = in vc++ . but want to do it in c/c++ only.. Can anyone be of help.. Thanks.. Kaustubh |
|
From: Wendel <we...@ha...> - 2001-06-21 02:51:01
|
Hello Guy,
I recived 4 messages ... and the answers are very different .... answers:
2) > The line ' HKEY HKEY_USERS\wendel_test ' is wrong. You can't do that.
HKEY is a
> registry key handle not the key's name.
3) You can't use #include <Winreg.h> with Dev-C++. Just delete that line.
For the use of RegCreateKeyEx, at the link in the beginning of this message,
you will find links to some examples.
4) It work very well here.
Then i try do the changes in my program ... the nunbem of erros is low ...
but don't work yet ... :-/
In the second case, spoken that handle isn't the key name. But i translate
to my lenguague and handle is a work that don't do sense for me, unhappyly!
:-/
What is the handle ?? Can you show me a correct value that must i use to i
work, in the contrary of the ' HKEY HKEY_USERS\wendel_test ' ??
In the first case, it is a good help for me ... my errors down only for two
erros:
#include <stdio.h>
#include <windows.h> //Header: Declared in Winreg.h; include Windows.h.
#include <winreg.h> // i put this 2 headers as is needed in the text.
int main()
{
LONG RegCreateKeyEx(
HKEY HKEY_USERS\wendel_test
return(0);
}
8 f:\dev-c_~1\untitl~1.cpp
parse error before `0x80000003'
8 f:\dev-c_~1\untitl~1.cpp
stray '\' in program
What is the error stray '\' in program ?? is it when i used "return(0);" ??
Why ?
In the trirth case, i comment the line "#include <winreg.h>" and it up 4
errors and don't show me a link to examples.
And in the 4 case, it don't work here!! hehehe =]
ps.: Thkz again for all help.
[ ]'s
Best Regards.
|
|
From: Gregor P. <Gre...@dl...> - 2001-06-20 22:10:14
|
Can someone tell me how to open and write into a textfile (even into a already opened one) Is there under Windows something like fprintf () ? Thanx for answering :-) Gregor |
|
From: Ian W. <lak...@ho...> - 2001-06-20 18:57:08
|
hi there stein, i was just wondering if it would be possible for you to send me the code that worked if thats ok. i would really apreciate it if you could. thanks ian. >From: Stein Nygård <ste...@ge...> >Reply-To: dev...@li... >To: <dev...@li...> >Subject: [Dev-C++] Franerate limiter! Damn! >Date: Wed, 20 Jun 2001 11:42:25 +0200 > >Just ignonore my last mail, I jsut got it working :) > >Tanks! _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. |
|
From: Andre` N. C. <ca...@op...> - 2001-06-20 17:48:39
|
If you are looking for any help with the win32 platform I might be interested, I havn't used allegro, only DX. ----- Original Message ----- From: "jansb000" <jan...@wx...> To: <dev...@li...> Sent: Wednesday, June 20, 2001 1:45 PM Subject: Re: [Dev-C++] Can someone help me please!? > We use the Allegro game library. It is multi-platform, and it is optimised > to use DX in Windows and GL in UNIX. It also works for DOS. > For the sake of ease of use we have created a C++ wrapper around it. > > The WCS project is also multi-platform. Some of the developers use LINUX. I > have Win98. > > One of the open tasks is to extend the C++ graphics wrapper so that it can > work with SDL. > > ----- Original Message ----- > From: "Andre` Niel Cameron" <ca...@op...> > To: <dev...@li...> > Sent: Wednesday, June 20, 2001 12:04 AM > Subject: Re: [Dev-C++] Can someone help me please!? > > > > > > > > > > > If you want to learn game programming you may be interrested to join the > > WCS > > > project. This project has the explicit goals: > > > - learn C++ > > > - learn game programming > > > - learn using animation (and multimedia in general) > > > > > > > What are you using for graphics? DX? > > > > > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users |