But when subkey i written like follows it is not working.
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
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
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.
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.
«_Superman_» I love work. It gives me something to do between weekends.
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).
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.
Luc Pattyn [Forum Guidelines][Why QA sucks][My Articles] I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
Last Visit: 31-Dec-99 19:00 Last Update: 25-Jan-21 5:22