It is not recommended to modify HKLM and Program Files and many other locations.
These recommendations where true from a very long time.
But since users in XP and earlier OSs where true administrators, this did not pose a problem.
From Vista onwards, a program by default runs without admin privileges.
That is the reason for the prompt.
«_Superman_» I love work. It gives me something to do between weekends.
Since you are writing to HKEY_LOCAL_MACHINE, I don't think you can prevent the prompt - writing there REQUIRES administrative privilege.
Having your application in the Program Files directory is OK, but modifying or creating files in that directory is a problem also requiring admin privilege.
Even if you create a manifest containing the RequestedExecutionLevel set to "requiresAdministrator" (as some will probably suggest) will not solve it - all that does is when your program starts the user is prompted to enter the administrator password or approve the operation anyway.
As DavidCrow indicated, there is probably a better way to accomplish what you need - perhaps using HKEY_CURRENT_USER instead.
I try MFC dialog use draw x and y axis.(only background based on dialog box width and height).
Your question is not really clear: are you drawing the chart yourself ? If yes, I suggest you use an existing chart control: there are some articles about chart controls on codeproject, and you can have a look at my sig for a link to a chart control I developed.
I am using GDIplus to save an Image.I am getting the Graphics reference from Image not from Device.And then m drawing another image of same size (White background with one Red Rectangle) by using DrawImage method of Graphics.
Here is the code below:
I used ImageAttributes for Transparency but by using setColorMatrix,It sets transparency for whole image.
Now,I have two problems:
1)I want to set transparency for White pixels so that when I draw rectangle.tif on temp.tif file I can see background.I want to use as layer.
2)When I draw rectangle with ImageAttribute on temp file and then its not saving with transparency info even.
I hope i understand your questions clearly. Im not using GDIplus (but GDI) and Im not using your program language, but maybe this helps a little:
- to get transparency on the pixellevel every pixel in your bitmap must be 4 bytes (RGBA) and not 3 bytes (RGB). See MSDN for exact info. In the A byte (called alpha channel) you may set the transparency level between 0 and 255. You should use the winapi function Alphablend() (or the gdiplus equevalent) to copy the bitmap to the screen.
- One of the problems with transparent bitmaps is that when you put them on screen the transparency is visible but this information is lost (on the screen). Let me explain this: Suppose you want to fade in a bitmap. Then for every step you must first repaint the background (that what wad on the screen before the bitmap was painted on it) and then copy the transparent bitmap on it, decreasing transparency in every step. If you don't repaint the background first you will not get the desired result (but a transparent bitmap on a tranparent bitmap).
The screen has no transparency set (it is a RGB-surface) so saving it will result in a bitmap that only shows 'what was on screen'. Transparency is a property of a bitmap not of the screen that displays it (the screen shows the result only).
To forbid anybody to create an instance of the class. The idea of a singleton (as its name suggest) is that only one instance of the class exist. If you have a public constructor, it means that anybody can create instances of the class. When the constructor is declared public, if you try to instantiate the class outside of itself, the code will generate an error.
So, if you make the constructor public, nothing will "happen" directly but your design is flawed: you are not sure anymore that your class can be instantiated multiple times.
As others have pointed out, the idea is that the implementation of a singleton class has full control over the property of ever having only one instance. So you need to make sure that there is no way to create a second instance, if one is already in existance, meaning:
1. You can not create an instance with a constructor without going through the class's code
2. You can not copy an (i. e. the only existing) instance to make another one
3. You can access the one existing instance or create it from anywhere
The first is achieved by not providing a constructor that is public. The problem however is, that the C/C++ compiler implicitely always creates a default constructor if there is no other, and that default constructor would be dclared as public! Therefore we mus explicitely declare a default constructor that is private to prevent the compiler from creating a public one.
The second would be achieved by not creating a copy constructor, but again, the compiler implicitely creates one if there is no other. The safest way to prevent this is again, to explicitely define a private copy constructor.
The third can be achieved by defining a static function that delivers a reference or pointer to the one instance in existance. This function can check whether there already is an instance and retrun that, or if there is none, use the private constructor to create it.
As far as I understood, he wants the string "ABC,123" be considered as one column in the CSV file. But this has nothing to do with C++, rather with the CSV syntax in which he has put double quotes around the field.
This has nothing to do with C++ but rather to the CSV format. If you google for the format specification (see here[^] for instance) you can see that: Fields with embedded commas must be enclosed within double-quote characters.
How is the correct way to subclassing my CHeaderCtrl class into my CListCtrl ?
Let say I have CListCtrlEx , ( public of CListCtrl ) , and I have a CHeaderCtrlEx class ( public of CHeaderCtrl ) and I need to subclassing into CListCtrlEx ... how it's correct way to do it ?
I tell you for what I need subclassing : I want to improve my CListCtrlEx class to CHeaderCtrlEx class from here[^] and saw there , that CHeaderCtrlEx is subclassing into CListCtrlEx ...