|
If you use EnumChildWindows() , you will need a callback function. What you put in it is up to you.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
How do i declare a bool callback function? I keep getting undeclared variable when i try to compile.
<br />
EnumChildWindows(variable, function, NULL);<br />
<br />
BOOL CALLBACK function(HWND variable, LPARAM lParam){<br />
...
}<br />
Thanx in advance!
|
|
|
|
|
dellthinker wrote: I keep getting undeclared variable when i try to compile.
Probably because you are referencing it (i.e., function() ) before it has been declared.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Can I get some example programs of class Savings?
I am new to programing and by seeing related programs, I'll be able to develope a general technigue for developing classes.
Thanks
tomd
Tom
|
|
|
|
|
Tom De Angelis wrote: Can I get some example programs of class Savings?
You mean like:
class Savings
{
public:
Savings()
~Savings();
};
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Can you more explain about class Savings?
|
|
|
|
|
Hi,
I need to serialize/deserialize object/container which can contain properties and CArray based dynamic stuff to/from XML.
Is there any useful libraries/implementations for XML serialization?
Will appreciate any feedback.
|
|
|
|
|
You could try libxml. It can save/load XML files.
http://en.wikipedia.org/wiki/Libxml2.
|
|
|
|
|
I've got a class that wraps GDI+. In the constructor I call GdiplusStartup, and in the destructor I call GdiplusShutdown. This could result in multiple startup & shutdown calls. (And possibly several startup calls before any shutdown calls) Is it safe to make these calls multiple times?
|
|
|
|
|
indigox3 wrote: Is it safe to make these calls multiple times?
What does the documentation say?
|
|
|
|
|
Not much relevant to my question.
http://msdn2.microsoft.com/en-us/library/ms534077.aspx
|
|
|
|
|
indigox3 wrote: Not much relevant to my question.
Seems pretty clear to me
"Each call to GdiplusStartup should be paired....."
GdiplusShutdown Function The GdiplusShutdown function cleans up resources used by Microsoft Windows GDI+. Each call to GdiplusStartup should be paired with a call to GdiplusShutdown.
|
|
|
|
|
I don't know.
The docs state:
"You must call GdiplusStartup before you create any GDI+ objects,
and you must delete all of your GDI+ objects (or have them go out
of scope) before you call GdiplusShutdown."
Although there's a token associated with each startup/shutdown pair,
the token (or any other context) isn't used when working with GDI+
objects. That means there's no internal context relating created GDI+
objects with a GdiPlusStartup() call.
If I had to guess, I'd say it will work fine - the DLL is probably released
when the last token is returned to GdiPlusShutdown(). It's not documented,
however, so that's a complete assumption, and relying on that assumption
could be disastrous in the future..
To be safe, I personally chose (and still choose) to do this pair of calls ONCE
for an entire application.
This can be done with a singleton class wrapping the gdiplus dll (may fit nice with
your wrapper class), or simply calling the startup/shutdown functions during app
initialization/cleanup.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'd rather just do the initialization once like you suggest, but the code I'm working on is a module to be shared among different client apps, so I can't be sure a priori if the client is already using GDI+. Thanks for the reply,
|
|
|
|
|
Mark Salsbery wrote: The docs state:
Seems pretty clear to me
"Each call to GdiplusStartup should be paired....."
GdiplusShutdown Function The GdiplusShutdown function cleans up resources used by Microsoft Windows GDI+. Each call to GdiplusStartup should be paired with a call to GdiplusShutdown.
|
|
|
|
|
Thanks for the question, I did not know the answer and I was curious myself so I took the liberty of investigating.
My first clue was in the MSDN
It says: Each call to GdiplusStartup should be paired with a call to GdiplusShutdown.
http://msdn2.microsoft.com/en-us/library/ms534076.aspx[^]
So I fired up IDA Pro and began dissassembling gdiplus.dll to have a look at the op-codes. I always want to know whats really going on.
Indeed, it appears each call to GdiplusStartup results in the critical section wrapped incrementing of a reference counter. Subsequently each call to GdiplusShutdown performs the opposite with the decrementing of the reference counter dword_7A20A040. Cleanup of the objects does not appear to take place until the reference count is zero.
So it seems it is indeed safe to call GdiplusStartup/GdiplusShutdown in parallel between threads, and even within the same thread. As long as each GdiplusStartup is followed by a GdiplusShutdown.
Best Wishes,
-Randor (David Delaune)
|
|
|
|
|
Cool! Thanks for that analysis
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank you so much for checking this out!
|
|
|
|
|
I have a problem detecting the physical screen size (in millimeters) with different video cards. In my case, I use the same monitor with same resolution, i.e. 19" LCD - 1280x1024. I'm using a C++ common device context function, GetDeviceCaps(HORZSIZE) and it returns deferent results with different video cards, e.g. for nVidia Quadro it return 380 mm but for Maxtrox it returns 375 mm. I've already tried with other video cards with different resolution but sometimes the function gave me different results, e.g. 320x240 mmxmm, 320x256 mmxmm, 375x300 mm, 380x300 mm (I confirm "with the same monitor"). That cause me a problem when I use map mode MM_HIMETRIC and I would like to draw a rectangle in MM_HIMETRIC units, let say 5000x5000. It gives a different size of rectangle on the screen. Is there any way that I can set the physical screen size or any way to solves the problem?
I know that there is a function, ChangeDisplaySettings(), to set the dispaly properties but there is no option to set the physical screen size.
Furthermore, it has no effect when I changed from DVI to VGA port. The result is still the same.
Thank you very much,
JibJeab
|
|
|
|
|
Given that monitors have knobs on them to stretch / shrink the width & height of a picture, I can't imagine you can totally trust any dpis given to you by the OS (or graphics driver).
While that is less of an issue with flat screens, it's not completely gone.
It get's even worse on some CRTs, with the picture bulging at the sides, etc.
Have you tried drawing a ruler on the screen in X & Y, and getting the user to drag it with the mouse until it matches some real world measurements done by them on the screeen?
Iain.
|
|
|
|
|
Hi. I have an image file located in a directory. How can I send it to the default printer and print it from my VC++ code? I tried different ways but doesn't work. Please help!!!
|
|
|
|
|
Go to the Articles section on this site under "General C++" you will a category for "Printing"
|
|
|
|
|
Thanks. I'll do that. I hope it's not too hard. I tried system("print filepath"). It hangs. Is there any dos command that I can sent from dos command prompt to print a file? Thanks a lot!
|
|
|
|
|
ShilpaPotnis wrote: Is there any dos command
Perhaps using the Shell interface would suffice. There are ShellExecute(...) or ShellExecuteEx(...) and there is a Shell Library[^]
|
|
|
|
|
Thanks! I'll try this too.
|
|
|
|