|
completely?
With a this->ShowWindow(SW_HIDE);
I hope this works in your case
|
|
|
|
|
CEdit::ShowWindow(SW_HIDE);
Greetings from Germany
|
|
|
|
|
I have written a piece of code to enumerate a subkey name in the registry.Here is the function:
<code>
HKEY RegOpen( HKEY hKey, LPCTSTR pszSubKey, DWORD dwRights)
{
HKEY hSubKey;
if ( RegOpenKeyEx(
hKey,
pszSubKey,
0,
dwRights,
&hSubKey
) == ERROR_SUCCESS
)
{
return hSubKey;
}
return NULL;
};
bool RegEnumSubKeys(
CString szName,
HKEY hStartKey,
CString strStartKey
)
{
DWORD dwSubKeyCnt, dwMaxSubKey;
if ( RegQueryInfoKey(
hStartKey,
NULL,
NULL,
0,
&dwSubKeyCnt,
&dwMaxSubKey,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
) == ERROR_SUCCESS
)
{
if(dwSubKeyCnt)
{
dwMaxSubKey +=1;
LPTSTR pszKeyName = (LPTSTR)::malloc( dwMaxSubKey*sizeof(TCHAR) );
if(pszKeyName)
{
FILETIME ftWriteTime;
LONG retCode;
DWORD i=0;
for(i=0;i< dwSubKeyCnt; i++)
{
if (ERROR_SUCCESS == (retCode = RegEnumKeyEx(
hStartKey,
i,
pszKeyName,
&dwMaxSubKey,
NULL,
NULL,
NULL,
&ftWriteTime
))
)
{
CString csFound;
csFound.Format(_T("%s\\%s"), strStartKey, pszKeyName);
TRACE(_T("%s\n"), csFound);
HKEY hSubKey = RegOpen(hStartKey, pszKeyName, KEY_ALL_ACCESS);
if(hSubKey)
{
if(RegEnumSubKeys(szName, hSubKey, csFound))
{
RegClose(hSubKey);
}
else
{
RegClose(hSubKey);
::free( (LPVOID) pszKeyName );
return false;
}
}
else
{
::free( (LPVOID) pszKeyName );
return false;
}
}
else
{
::free( (LPVOID) (LPCTSTR) pszKeyName );
return false;
}
}
::free( (LPVOID) pszKeyName );
}
else
return false;
}
return true;
}
return false;
};
unfortunately, the function only can trace one branch of the registry. I checked the code, the RegEnumKeyEx returned ERROR_MORE_DATA when it execute twice or more。However, if I use the RegEnumKey instead of RegEnumKeyEx, the function works well. Who can tell me why? Highly appreciated!
-- modified at 20:47 Monday 6th August, 2007
|
|
|
|
|
Please modify your post by surrounding the code snippet with <pre> tags.
How is RegEnumSubKeys() initially called?
What is RegOpen() ?
I assume you know of the missing comma in the function's parameter list.
Have you considered simplifying your code to something like:
LONG RegEnumSubKeys( HKEY hStartKey, LPCTSTR lpszStartKey )
{
LONG retCode;
HKEY hSubKey;
TCHAR szKeyName[MAX_PATH];
int i = 0;
retCode = RegOpenKeyEx(hStartKey, lpszStartKey, 0, KEY_READ, &hSubKey);
if (ERROR_SUCCESS == retCode)
{
while (ERROR_SUCCESS == retCode)
{
DWORD dwMaxSubKey = MAX_PATH;
retCode = RegEnumKeyEx(hSubKey,
i++,
szKeyName,
&dwMaxSubKey,
NULL,
NULL,
NULL,
NULL);
if (ERROR_NO_MORE_ITEMS == retCode)
break;
else if (ERROR_SUCCESS == retCode)
retCode = RegEnumSubKeys(hSubKey, szKeyName);
}
retCode = RegCloseKey(hSubKey);
}
return retCode;
}
"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
|
|
|
|
|
Thanks for you response! I have appended the RegOpen function to the original code snippets.
I have tried your code, unfortunately it can only enumerate one branch of the registry just like my original code. If replace the RegEnumKeyEx with RegEnumKey, it works. However, the RegEnumKey is obsolete in MSDN.
In the CodeProject site, I checked http://www.codeproject.com/system/cregistrykey.asp[^] that uses RegEnumKeyEx to finish the job. It is pretty complicated and I did not find remarkable logical differences between his codes and mine.
|
|
|
|
|
retinex wrote: I have tried your code, unfortunately it can only enumerate one branch of the registry...
I'm not sure what you did to make it stop working, but I used that code to drill down several levels deep and it worked fine.
"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
|
|
|
|
|
<code>for(i=0;i< dwSubKeyCnt; i++)
{
DWORD ghostMaxSubKey = dwMaxSubKey;
if (ERROR_SUCCESS == (retCode = RegEnumKeyEx(
hStartKey,
i,
pszKeyName,
&ghostMaxSubKey,
NULL,
NULL,
NULL,
&ftWriteTime
))
)
{
Thanks for your help.
I checked my code and added one line prior to the RegEnumKeyEx,e.g. the Underlined code. It works fine. However, I don't know why?
|
|
|
|
|
I get the error when compiling my old project with VS 2005, no problems with VS 2003.
:-
3>c:\AC_emu\filetreectrl.cpp(460) : error C3861: 'TRACE': identifier not found
How can I get rid of this error please;
e.g. TRACE(_T("Cannot select a empty path\n"));
|
|
|
|
|
It's an MFC construct. Is your project using MFC?
"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 its an MFC Dialog application.
|
|
|
|
|
I had a number of issues porting to VS2005, but TRACE macros weren't one of them - they seem to work just fine. Carefully check the include files. On my current project, clicking on a TRACE macro shows that
in afx.h
#define TRACE ALTTRACE
and in afx.h
#include <alttrace.h>
which has the definitions
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
I have a win32 app that is usually never run directly from the exe but rather we create a shortcut to it (on desktop) and run from there. Reason for doing so is that in the shortcut we can spcify the "Start in" folder (which is different from \debug folder where the exe is placed) and the application uses this working folder to store some data. If we directly run the exe, it will assume the current folder (\debug) to be the working folder, which is not OK for my app.
Now the problem is, when I start debugging with F5, it runs the exe form \debug folder. How can I set it to run the desktop shortcut rather than the main exe? I am using VS2005.
It's better to know some of the questions than all of the answers.
Pravin.
|
|
|
|
|
in the debugging settings, you can specify the starting folder...
|
|
|
|
|
Thanks for the quick help. I got it working
It's better to know some of the questions than all of the answers.
Pravin.
|
|
|
|
|
Hi there,
i open a DOS-Console in a MFC-Application, by launching wmain(0,0);
But i don't get a Console-Window, how is it possible to open a console window
apart of creating a new process or something like this.
Big thanks
PS: a printf does entry the chars into stdout, that works ...
|
|
|
|
|
Your question is unclear. Are you wanting to start one process from another?
"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
|
|
|
|
|
Thanks for your help temptation
No, i wanted to open a ConsoleWindow from out a Window
I made it via AllocConsole, than i had the problem that a printf does not write into the console.
This problem i solved with this code :
int hCrt, i;
FILE *hf;
hCrt = _open_osfhandle((long) GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
hf = _fdopen( hCrt, "w" );
*stdout = *hf;
i = setvbuf( stdout, NULL, _IONBF, 0 );
But at the moment i have still a problem during writing text via PDCurses, it won't be displayed into
the console.
A make a "mutation of the Console-Project, where a MFC Window-Application start new processes and redirect the output to his View.
In my case i add to the MFC-Project a whole Win32-DOS-Project and start the Main-Function via calling the _main
( the DOS-Application should not be launched as a new process, to keep the possibility to interact
the MFC Application with the DOS-Application ( via Message ) )
I hope you can understand my idea
Do you know the application of several DOS-Consoles into different Tab's ?
Greetings
|
|
|
|
|
How can i obtain the ip address of a user chatting in yahoo messenger
|
|
|
|
|
This is a VC++ forum, but not for Hacking. If u wanna that... good luck by self learning
Greetings.
--------
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?
|
|
|
|
|
Nelek wrote: good luck by self learning
I think it was a good answer.
Sometimes I want to ask this question but I forgot,did your problem solve ?I think you have a problem on your project?
|
|
|
|
|
You can't. Yahoo's IM server does not pass that information on to you.
"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
|
|
|
|
|
There are some codes:
while(iter != vectVltSvrName.end())
{
EstablishBinding((*iter).c_str(), END_POINT);
int nSize = 255;
char chServerDir[255] = "";
RpcTryExcept
{
GetServerDir(nSize,(unsigned char*) chServerDir);
}
RpcExcept(DO_EXCEPTION)
{
*Ret = ERR_NONE;
*bIs = FALSE;
goto Label;
}
RpcEndExcept
iter ++;
}
why VC2005 would tell me such error:error 141 error C2712: Cannot use __try in functions that require object unwinding e:\work\olework\sm50_neui\program\lckernel\lcobject.cpp 7438
and how should I resolve it?I do not know if I should remove the exception all change it to try{}catch(...){}
Thanks.
GOOD LUCK!
|
|
|
|
|
have you read this[^] ?
hint: compile with /Gx-
|
|
|
|
|
I am reading it now.
Thanks.
But I don't know how to set such options!
And would you tell me there are some ways to exchange somethings real-time,such as icq?
Thanks very much
|
|
|
|
|
go to your project settings... there you'll find off the compilation parameters... one corresponds to the /Gx-
|
|
|
|
|