I am Using RegEnumValue() to Obtain the Names of the Values in the Specified Registry. But Its Not Working correctly. I dont know where I am doing the mistake. According to me the code is perfectly OK. But see if u can Find any Bug and can HELP me.
When I debug the Following in Code it just Show me the Last Value Name int he Registry MyApplication while there is eight Values. I get Other Values as Empty String.(String Values).
The 4th parameter to RegEnumValue() ?
lpcValueName [in/out] should be the size of the buffer before the call, after the call its the number of characters returned, being in a for loop you should be setting that before the call everytime.
I am writting register part of my software. When user enter the right register code, I want to modify some Bytes in the a.exe file's to remember this. And it means I need write some bytes to the a.exe file when it is running.
You first need to reserve space in the EXE for this, and be able to locate it code-wise, either by offset or by special signature bytes (I presume you have already done this).
I do not believe that you can modify the EXE file while it is mapped into memory (i.e. running). You should have read-only access to the EXE file, so your executable can make a copy of itself and launch that copy passing it a special command line parameter (which means run, do not copy yourself) so that it does the real launching. I think you can then mark that copy-of-yourself with the Delete On Close flag, so that it cleans itself up when it exits. The process would work like this:
1: When launched, check for the run, do not copy yourself parameter
2a: If found, the application runs normally
2b: If not found, copy yourself (the EXE file) to a temporary location
3: Launch the temporary copy passing the run, do not copy yourself parameter
4: Flag the temporary copy for delete-on-close (lookup the FILE_FLAG_DELETE_ON_CLOSE flag)
Once you do this, your application's copy can modify the original EXE on disk, and whatever you change will have an effect the next time it is started.
This is also a way to handle automatic updates without a satellite or worker/helper application handling the replacing of files that are in use.
Be sure to give the temporary copy a meaningful filename, and document it, so that users do not worry when they see an unknown executable filename in Task Manager.
-=- James Please rate this message - let me know if I helped or not!<HR>If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
CocreateInstance in used to obtain only single Object of the class. Whilei CoGetClassObject is used to obtain the multiple Object of the same Class.
And CocreateInstance automatically call the ClassFactory(). you don't have to care for it.
Firstly, as already mentioned, CoCreateInstance uses the IClassFactory interface to create the object. Secondly, IClassFactory has other methods besides CreateInstance. Finally, the class factory is allowed to implement other interfaces.
I have a mfc application,based on CDialog,developed with vc6.0. Now I have make its *.chm help file. But when I press F1, it will always shows "Cannot find the ... *.HLP file". How can I change F1's default help file's name?
CWinApp has a member LPCTSTR m_pszHelpFilePath that is initialized before InitInstance() is called using a _tcsdup(), so you could free() the current m_pszHelpFilePath and _tcsdup() your own path in your InitInstance(). NOTE: during termination MFC will call free() on m_pszHelpFilePath assuming that it has been allocated using _tcsdup() so DO NOT set it to a static string.
-- modified at 3:30 Monday 17th September, 2007
If you are using VC6 then you will also need to override WinHelp either in theApp or in the mainFrame.
If you are using VC7 and above then forget the suggestion above and just call EnableHtmlHelp() in your WinApp constructor.
In fact your code was perfectly correct and that's the wey to do it (and you don't need to specify the second template argument because it has a default value). There are some articles here[^] about the STL, you'll probably find some usefull information.
In the CFrame cpp file (Frame.cpp) the error occurs in line 479 in the function "LRESULT CToolbar::OnCustomDraw(NMHDR* pNMHDR)" atg the line 479, ie:
BOOL HasText = (SendMessage(m_hWnd, TB_GETSTRING, (WPARAM) MAKEWPARAM (0,0), NULL) != -1);
Please advise me if you have a fix for this as soon as possible.
If anyone knows of the fix please email me directly at:
A C++ programming language novice, but striving to learn
Last Visit: 31-Dec-99 18:00 Last Update: 6-May-21 16:10