I want to get the description of a process (the description that is seen in task manager) in Windows using C++.
See Question&Answers more detail:osI want to get the description of a process (the description that is seen in task manager) in Windows using C++.
See Question&Answers more detail:osYou most likely want to get the FileDesription
field from the version resources of the main .exe
file of the program, using the VerQueryValue()
API call. Here is an example from that document:
The following example shows how to enumerate the available version languages and retrieve the FileDescription string-value for each language.
Be sure to call the GetFileVersionInfoSize and GetFileVersionInfo functions before calling VerQueryValue to properly initialize the pBlock buffer.
// Structure used to store enumerated languages and code pages. HRESULT hr; struct LANGANDCODEPAGE { WORD wLanguage; WORD wCodePage; } *lpTranslate; // Read the list of languages and code pages. VerQueryValue(pBlock, TEXT("\VarFileInfo\Translation"), (LPVOID*)&lpTranslate, &cbTranslate); // Read the file description for each language and code page. for( i=0; i < (cbTranslate/sizeof(struct LANGANDCODEPAGE)); i++ ) { hr = StringCchPrintf(SubBlock, 50, TEXT("\StringFileInfo\%04x%04x\FileDescription"), lpTranslate[i].wLanguage, lpTranslate[i].wCodePage); if (FAILED(hr)) { // TODO: write error handler. } // Retrieve file description for language and code page "i". VerQueryValue(pBlock, SubBlock, &lpBuffer, &dwBytes); }