|
|
In brief:
const is a contract between the developer and the compiler: the developer promises not to modify the const -declared identifier and if he/she violates that contract the compiler generates an error.
volatile is used as an instruction to the compiler that the volatile -declared identifier may be modified in the background. The compiler must not optimize and cache it in a register; its memory location has to be read each time the value is requested.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi,
const is to say the programm that the value in this variable should not change or be modified. One easy example to use it is when you use a function e.g. SearchObject (const CString szName, const int nID)
here I'm telling that these szName and nID may not being changed inside the run of the function.
About volatile... I can't tell you more than the MSDN help says, I have never used it.
volatile Member data is loaded from memory each time it is accessed; disables certain optimizations.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Help !!!!!!!!!!!!!!
1. I use C&WinAPI
2. to show a dialog to select file, but you cannot manipulate it
my imagine :
1. use openfile dialog and hide the right key menu
2. i know a dialog in VB, right of the dialog is a editbox show directory list, when you select any folder in that, the left side show a file list of that folder, but it is ocx, how can i invoke it?
so, how can i do for each way. and are there any other simplest way ?
|
|
|
|
|
Are you inquiring about GetOpenFileName() ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
if use GetOpenFileName() , you can rename or delete files ,it have no security,i want to avoid it, i just let you select file and cannot do anything other.
Help me!!!!!!!!!!!
|
|
|
|
|
See here (figure 16) and here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I want to put toolbar on top(upper side) of the desktop.
I don't want to put it over the desktop background or over the icons.
Is there a way to change size of Desktop ?
Is Desktop regular window ?
Thank you
-- modified at 10:25 Friday 11th May, 2007
|
|
|
|
|
This article - while old - is still the reference work for desktop toolbars. Windows automatically shifts the icons out of the way for such toobars, but since the desktop background covers the entire desktop, it is not possible not to cover it (at least partially).
|
|
|
|
|
How to calculate the size of a function?
Software Developer
Sanjay Khapre
|
|
|
|
|
|
lol
Cheers,
Russell
|
|
|
|
|
At run time it is difficult to do, unless you have access to the .obj file. If you do, you can parse the file (see Microsoft Portable Executable and Common Object File Format Specification) and look for the size record for the function you are interested in.
To experiment with this, take a .obj file that contains a single function, and run this from the command line:
dumpdin /all myobj.obj > foo.txt The file foo.txt will contain a complete dump of the file, and you should see a record that looks like
0F2 00000000 SECT27 notype () External | ?GetFontProperties@@YAHPBDPAU_tagFONT_PROPERTIES@@@Z (int __cdecl GetFontProperties(char const *,struct _tagFONT_PROPERTIES *))
tag index 00000106 size 00000C7D lines 0000856D next function 00000111 In this example, I used the XFont.obj from my XFont article. You can see that the size of GetFontProperties() is given as hex 00000C7D.
Note that these sizes are not exact - if you read the PE Format spec, you will find more info.
Just out of curiosity, why do you want to do this?
|
|
|
|
|
hello, I have my code written in visual c++ 2005 and I want to save my results in xml how can I do this?...can you give me a clue? ...please..thanks
lavi
|
|
|
|
|
There are several articles here on CP on how to do this. I have used this one myself.
|
|
|
|
|
I have a display that simulates a digital scope. In my OnDraw rutine I draw the scope with scales and grid lines. I receive data via Ethernet and plot it in the scope. I'm using double buffering to minimized the flicker, though I'm pretty sure I'm not implementing it correctly.
Is there any way to save my memory bitmap or the memory DC so that I can Bit Blit it, when there is no data change, instead of redrawing everything again and then blitting it?
Also, if anyone can point me in the direction on some good articles that talk about double buffering I would greatly appreciate it.
Thanks,
Paul
|
|
|
|
|
masnu wrote: Is there any way to save my memory bitmap or the memory DC so that I can Bit Blit it
Yes.
masnu wrote: if anyone can point me in the direction on some good articles
Take a look here.
|
|
|
|
|
from
http://www.codeproject.com/printing/printingmadeeasy.asp
Error C2660: 'MyPrintUnit::MyPrintUnit' : function does not take 1 parameters
I basically added the 4 files from his zip archive, and then copied and pasted his example usage into his source files, but am getting this error. It looks like MyPrintUnit is derived from GPrintUnit and its this base class that has the 1 parameter constructor, but have I done something wrong, or is it his mistake, or is there a way for me to call the base class version of MyPrintUnit in GPrintUnit
void MyPrintJob::OnPrint()
{
MyPrintUnit unit(this);
unit.Print();
}
note:
class MyPrintUnit : public GPrintUnit
{
public:
MyPrintUnit() {;}
virtual ~MyPrintUnit() {;}
virtual void DefineColHeadings();
virtual void CreatePrintFonts();
void InitPrintMetrics();
virtual BOOL Print();
CFont m_fontHeading;
CFont m_fontBody;
CFont m_fontHeader;
CFont m_fontFooter;
};
class GPrintUnit : public CObject
{
public:
GPrintUnit(GPrintJob *pJob=NULL);
....
etc
|
|
|
|
|
ldsdbomber wrote: Error C2660: 'MyPrintUnit::MyPrintUnit' : function does not take 1 parameters
The compiler is telling you the exact problem. You are constructing a MyPrintUnit object with one argument when it is expecting none.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
yes, I understand that, I think I said that in the original post. What i don't understand is why. I assume as it's an article on the website it's been compiled and working on someone's PC. It looks like it's trying to construct with the base class constructor.
If I take out the "this" and construct without parameters then the next line unit.Print(); does not work
error C2228: left of '.Print' must have class/struct/union type
Are you saying that this article is broken (the follow up replies don't seem to indicate this) or am I doing something wrong?
|
|
|
|
|
ldsdbomber wrote: Are you saying that this article is broken
In one word, yes.
The sample code is just that - I don't think it was ever compiled. There are obvious errors in it, not even counting the one you stumbled on. Here's the deal: If you look at the unit_table1.h file, you will see that the ctor is defined as
Table1Unit(GPrintJob *pJob);
That is what you must do.
Please post again if you have further questions.
|
|
|
|
|
Thanks,
sorry I didn't realise the articles here hadn't been vetted, I'll be careful in future!
|
|
|
|
|
The problem is that the listing of the sample code in the article was never compiled, although the demo code (in the zip download) obviously was.
|
|
|
|
|
ldsdbomber wrote: If I take out the "this" and construct without parameters then the next line unit.Print(); does not work
error C2228: left of '.Print' must have class/struct/union type
Then you've got something else wrong, or have made a change elsewhere that you've not shown. The MyPrintUnit object can be constructed with no arguments.
I put the following in an existing project and it compiled fine:
#include "gfx_printunit.h"
class MyPrintUnit : public GPrintUnit
{
public:
MyPrintUnit() {;}
virtual ~MyPrintUnit() {;}
virtual void DefineColHeadings(){}
virtual void CreatePrintFonts(){}
void InitPrintMetrics() {}
virtual BOOL Print(){return 1;}
CFont m_fontHeading;
CFont m_fontBody;
CFont m_fontHeader;
CFont m_fontFooter;
};
...
MyPrintUnit unit;
unit.Print();
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I download some article about shell programming and try to run it.
After that it always run although I restart my PC and can't delete this DLL files too.
Please give me some idea for solve this problem.
|
|
|
|