|
Because Windows 2000 detects memory leaks and cleans up after you. Ar you *sure* you aren't leaking memory ? I'd suggest posting your code, I'd be happy to provide a sanity check.
Are you calling ::DeleteEnhMetaFile(); ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Is it possible to create a memory device context with specific resolution and pixel depth (LOGPIXELSX, LOGPIXELSY, BITSPIXEL, et), rather than simply copying the values for an existing device?
I need to play windows meta files into a DC in order to generate bitmaps which will be saved as various raster file formats. The x and y resolution as well as the pixel depth of these files are not related to the resolution of the display or to any attached printer.
I am currently doing this by specifying ANISOTROPIC mapping mode, and setting the Window and Viewport Extents as required.
This works for some of the metafiles, but unfortunately, many of them explicitly set the mapping mode or extents internally. I have used EnumMetaFile to trap these commands, but it would be much easier (and faster) if I could simply create a device context with the correct parameters and just play the metafile.
Any help or tips would be greatly appreciated.
Thanks,
Bill
|
|
|
|
|
I'm writing a word processor and need to draw lines across my RichEditView to represent page breaks.
Unlike a basic CView, CRichEditView doesn't seem to use OnDraw to update the display, so overriding this seems to have no effect, and using OnPaint stops the text being displayed altogether.
Is there a way around this or should I just give up???
|
|
|
|
|
Hi fellow programmers!
Ok, here is the situation:
I am writting program consisted of 1 exe and about 5 dlls.
I have a structure(struct Options) which has all the programs variable in it. in My main file I defined
Options O;
then in other .cpp files I defined it
extern Options O;
this structure holds all variable, and works great in my exe program. However I want to export this instance (Options O) to my dll files so my dll files can use the variables inside this certain instance of the structure.
How can I do that? because in my DLL files when I import the extern Options O. It creates a new instance of Options and it doesn't use the variables which are already being used in the exe file;
I am totall puzzled!
some one please help me!!! I really appreciate it! please ask me if you need more information to answer my question!
Best regards to you all!
Damon
|
|
|
|
|
Basically, you should encapsulate the options:
1) In some DLL, create a function that returns the address or reference
Options& GetOptions()
{
static Options options;
return options;
}
2) export that function from the DLL
3) whenever you need the access to options, use GetOptions.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Look at this page by Ryan Schneider.
A Simple Wrapper for Sharing Data Structures Between Processes
http://www.codeproject.com/useritems/csharedstruct.asp
Another approach could be an initialization function in every dll
// in your exe .cpp
Options O;
MyDllInit( O );
// in your dll .cpp
Options O_Dll;
void MyDllInit( Options &O )
{
memcpy( &O_Dll, &O, sizeof(Options);
}
|
|
|
|
|
Hello!
I have a great problem.
I have done a view showing a bitmap.
The view always fits the size of the
bitmap. In the case, that the view
is smaller than the bitmap, scrollbars
are shown to scroll over the bitmap.
Now I want to implement the maximize
functionality that way, that pushing
the maximize button expands the view
to fit the bitmap only, but not to the
size of the mainframe window. How can
I implement this functionality. I already
catched the corresponding messages in
OnSysCommand and I can resize the view
to fit the bitmap, but I can not change
the maximize button to the restore button.
Is anyone out there who can help?
Many thanks in advance.
Peter
from Vienna
pmrainer
|
|
|
|
|
There are a number of ways to do this. You can turn OFF the maximise button in the view window, you could capture WM_SIZE and when the window gets a message to size bigger than the bitmap you could make it size to just the bitmap, or you could just allow the maximising and centre the bitmap.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Handle WM_GETMINMAXINFO. Use AdjustWindowRect[Ex] in the handler to compute frame size based on bitmap size.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Is it possible to access eg. CTreeDoc from CTreeView and CArtView?
I use:
CTreeDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
in the CArtView::OnDraw(), but it won't let me access the member functions of CTreeDoc. What do I need to add?
Marco
|
|
|
|
|
|
Hey does anyone know how to put a DWORD into a BYTE Buffer
without converting it or using the string functions. ie what would be the code behind the string functions that does it.
Cheers
Peter
|
|
|
|
|
Why do you want to copy a DWORD into a BYTE buffer?
Anyway, how about something like this...
(I have just written it in the browser, so there might be syntax errors...)
DWORD dw = 65535;
byte b = (byte*)malloc(sizeof(DWORD));
memcpy(b, dw, sizeof(DWORD));
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
There is also
*((DWORD *) b) = dw;
But that has some minor drawbacks on many CPUs. If b is not aligned on a DWORD, you get an alignment fault. Luckally, that isn't a problem on intel processors.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I hope that you have seen the web browser called "NEO-PLANET". Its user interface is really interactive. I want to create such user interfaces using VC++. Please help me in this regard.
Imran Farooqui
|
|
|
|
|
|
there are one const memeber constM and one const function constFunction
#classA head file
class classA
{
const int constM ;
const int constFunction ();
}
class classA::constM;
#end of classA head file
#classA cpp file
int constFunction (){return 0;};
#end of classA cpp file
#fileB head file
#include "classA.h"
void main()
{
};
class fileB::cons
compile error:
two obj file LNK2001
Help!!Help!!Help!!
Please pardon my weak English!
|
|
|
|
|
Place you "class classA::constM" in the classA.cpp file. Having it in the H file causes it to be defined in every .CPP file that includes classA.h.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Thanks!!!
Please pardon my weak English!
|
|
|
|
|
Hi, all.
========
Under win98 file name longer than 8.3 appear with "~1" in DOS.
example:
--------
Win98, the file looks like this:
filename longer than 8 chars.dat
DOS, the file looks like this:
filena~1.dat
Does anyone know where the filename is stored, and how does it work?
thanks!!
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
The long file name occupies multiple, linked entries in FAT directory. These entries are marked with attribute combination which was never used in any version of DOS. When you save file with a long fn to floppy and read this on a machine running DOS (do you still have one?), these directory entries are ignored by operating system.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
so...
if I understood right:
long file names and short file names saved on the HD the same way but the Operating System reads it differently
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
i am working in tcp/IP communication.
i am using some Third Party API's for connecting through TCP/IP.
the API taking Lot of time to check the connectivity.
is there any API in MSDN which can ensur connectivity for specified IP address. Kindly Reply ASAP.
Looking forward for early reasponse
Suleman
|
|
|
|
|
Is it always taking a long time, or is it just when the program cannot connect to the server that it takes a long time?
If it only is when it cannot connect there is really not much to do about it.
If the program try to connect to a server that does not exist, it sends, (windows socket standard), a SYN packet to the ip-address, and wait for some time for an answer (a SYNACK packet), if it don't get the answer it tries 2 more times.
It takes some time, about 30 seconds, I would say...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Can someone give me a little example of code how to use the VK_UP key in MFC.
I want that if I press the "up" key a messagebox should appear...
|
|
|
|