|
Sorry friends , I got the solution. I am reading incorrectly. I am reading in local machine instead of reading current user.
Any way it is working thanks......To invent something, you need a mountain of junk in your mind.
---------------------Thomas alva edison
|
|
|
|
|
You can use ATL class CRegKey to do registry operations "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
sampath-padamatinti wrote: But when subkey i written like follows it is not working.
Per MSDN:
If RegOpenKey() fails, the return value is a nonzero error code defined in Winerror.h. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
My project contain 5 dll and 4 dll are win32 and one dll is MFC shared dll.These dll are written in c language.our task is
redesign project and convert these code in c++ language (means use object oriented concept).One main dll is IProfile that contains exported
function and that exported function are called from another dll.In c language they are use extern.But in c++ i have
to create wrapper class for that.But i dont know how to create wrapper class.can anyone please tell me how to create
wrapper class in c++.
Thanks in advance
|
|
|
|
|
jadhavjitendrar wrote: .But i dont know how to create wrapper class.can anyone please tell me how to create
wrapper class in c++
Do you know C++ well?
You probably should create a facade, see "Facade Pattern" at Wikipedia.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Yes sir,can u explain me in details
|
|
|
|
|
No, I can't do it here, since the facade pattern is a quite large topic and good C++ languaqe knowledge is a pre-requisite.
Anyway I may suggest you reading some good C++ books (see this thread [^] for hints), and the GoF's "Design Patterns" one.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I want to use the spy++ to get a form control(login button) handle, but I find that it cannot.
If I write the c++ prgram to find the control handle, which methods can be used?
|
|
|
|
|
Without actually seeing that form my guess would be that the button is not a control itself but is drawn and its buttonlike functionality is handled by the form itself, thus, no separate handle. > The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi all,
I am working on a MDI(MFC) application. which has customized OnSysCommand function.
after maximizing any child window of the application, if I try to open other child window using windows menu.
the application didn't receive WM_SYSCOMMAND message, so the function OnSysCommand is not get
called and the result the new window is not restored/painted properly.
anyone have the idea why this is happening.
Thanks,
Smith
|
|
|
|
|
I don't think your application should receive this message when opening a child window. See the description here[^] on MSDN. MVP 2010 - are they mad?
|
|
|
|
|
Hi All,
i have a DLL, there is some code as mentioned below:-
char szName[MAX_PATH];
CString csName = "3424234";
wcstombs( szName, csName.operator LPCTSTR(), _tcslen( csName.operator LPCTSTR()));
Now i want to initialize szName array to 0, to aviod the unexpected behaviour.
Now my question is whether i use memset or SecureZeroMemory?
Which is better, and why?
Any help will be appreciated.Величие не Бога может быть недооценена.
modified on Tuesday, February 9, 2010 12:39 AM
|
|
|
|
|
char szName[MAX_PATH] = {0};
|
|
|
|
|
But i am looking for details regarding SecureZeroMemory and memset or memcpy, any way thanks for your help Величие не Бога может быть недооценена.
|
|
|
|
|
I think _superman_ has already sent you a better answer which I think explains the differences. I usually initialize all arrays to zero as I posted before.
|
|
|
|
|
SecureZeroMemory may be a little slow on the x86 platform as it initializes each element of the array in a loop. But for x64 it uses an intrinsic, which will be very fast.
You could also use the C-Runtime memcpy_s function.
To initialize the array to zero at the time of creation, the reply by Rejeesh definitely works in Visual Studio.
|
|
|
|
|
Thanks for the reply.
So you mean in 64 bit processor, SecureZeroMemory will not make much change in time consumption.Величие не Бога может быть недооценена.
|
|
|
|
|
That's correct.
Intrinsics are similar to writing inline assembly instructions.
x64 does not support inline assembly and so you have to use intrinsics.
Read more about intrinsics in the following links -
Intrinsic function[^]
Compiler Intrinsics[^]
|
|
|
|
|
(i think you've got your x86 and x64 reversed here)
|
|
|
|
|
One thing others didn't point out: memset is a CRT call, and SecureZeroMemory is an API call. That's it. I don't think one would be "faster" over the other (practically) to initialize an array of size MAX_PATH .
If you had considered ZeroMemory , there are chances where the compiler can completely optimize out (remove) the call to this function when it detects that the initialised buffer isn't being used anywhere. However, SecureZeroMemory would ensure that the buffer be initialised, even if it isn't being used at all (the optimiser won't rule this call out).
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Adam Roderick J 09 wrote: Now i want to initialize szName array to 0, to aviod the unexpected behaviour.
1. You should be using the wcstombs_s() function.
2. You should use that function as documented here[^] to calculate the required size of your destination buffer, and allocating that appropriately. In your example above, if the length of your string exceeds MAX_PATH then you have an immediate memory leak.
3. Clearing the buffer to zeroes before copying the string provides no benefit.MVP 2010 - are they mad?
|
|
|
|
|
Hi,
How can I get the cluster size of any logical drive?
|
|
|
|
|
Use the API GetDiskFreeSpace([^]) Величие не Бога может быть недооценена.
|
|
|
|
|
The GetDiskFreeSpace function cannot report volume sizes that are greater than 2 gigabytes (GB). I have drive more than 2 GB.
Any other workaround....
|
|
|
|
|
Jsut try this link
[^]Величие не Бога может быть недооценена.
|
|
|
|