Click here to Skip to main content
15,887,434 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionProblem with CreateFileMapping() window7/Vista. Pin
janaswamy uday17-May-10 2:38
janaswamy uday17-May-10 2:38 
QuestionMFC CreateInstance from CWinThread Pin
IAmRami17-May-10 2:28
IAmRami17-May-10 2:28 
AnswerRe: MFC CreateInstance from CWinThread Pin
Code-o-mat17-May-10 2:43
Code-o-mat17-May-10 2:43 
GeneralRe: MFC CreateInstance from CWinThread Pin
IAmRami17-May-10 3:31
IAmRami17-May-10 3:31 
GeneralRe: MFC CreateInstance from CWinThread Pin
Code-o-mat17-May-10 3:48
Code-o-mat17-May-10 3:48 
GeneralRe: MFC CreateInstance from CWinThread Pin
IAmRami19-May-10 22:05
IAmRami19-May-10 22:05 
QuestionHow to get all instances of Excel.exe Pin
KTTransfer17-May-10 2:17
KTTransfer17-May-10 2:17 
AnswerRe: EnumWindowsProc( ) , EnumProcessModules , FindWindow( ), Pin
Software_Developer17-May-10 3:00
Software_Developer17-May-10 3:00 
This code by a coder dude called NarVish gets the Windows Handles
from process id of excel instance instances.


BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) 
{
	DWORD dwThreadId, dwProcessId;
	HINSTANCE hInstance;
	char String[255];
	HANDLE hProcess;
	dwThreadId = GetWindowThreadProcessId(hWnd, &dwProcessId);
}
int _tmain(int argc, _TCHAR* argv[])
{
	HWND  hwnd = (HWND)FindWindow(_T("XLMAIN"), NULL); 
        DWORD aProcesses[1024], cbNeeded, cProcesses;
        unsigned int i;

        if( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) )
            return 1;
        cProcesses = cbNeeded / sizeof(DWORD);
        for (i=0; i<cProcesses; i++ )
	{
              if( aProcesses[i] != 0 )
	      {
		  TCHAR szProcessName[MAX_PATH] = _T("<unknown>");
                  HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, aProcesses[i] );
              if ( NULL != hProcess )
			{
				HMODULE hMod;
				DWORD cbNeeded;
 
				if( EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded) )
				{
					GetModuleBaseName( hProcess, hMod, szProcessName, sizeof(szProcessName)/sizeof(TCHAR) );  
					if(_wcsicmp(szProcessName,L"EXCEL.EXE") == 0)	//if(strcmp((const char*)szProcessName,(const char*)excelProcName)==0)
					{
						cout<< szProcessName << "--" << aProcesses[i] <<endl;
						Excel::Window* pWindow = NULL;
						pid = aProcesses[i];
						EnumWindows( EnumWindowsProc, NULL);
                                                HRESULT hr = AccessibleObjectFromWindow(hwnd, OBJID_NATIVEOM, __uuidof(Excel::Window), (void**)&pWindow);
						if (hr == S_OK)
						{ 
						}
                                        }
				}
			} 
			// Print the process name and identifier.
			_tprintf( TEXT("%s  (PID: %u)\n"), szProcessName, aProcesses[i] ); 
			CloseHandle( hProcess );
		}
	} 
	return 0;
}

AnswerRe: How to get all instances of Excel.exe Pin
sashoalm17-May-10 5:07
sashoalm17-May-10 5:07 
GeneralRe: How to get all instances of Excel.exe Pin
KTTransfer17-May-10 18:12
KTTransfer17-May-10 18:12 
GeneralRe: How to get all instances of Excel.exe Pin
sashoalm17-May-10 23:33
sashoalm17-May-10 23:33 
GeneralRe: How to get all instances of Excel.exe Pin
T210211-Jan-11 22:00
T210211-Jan-11 22:00 
QuestionHow to register an automation enabled application in the ROT when it's started from the command line. Pin
TClarke17-May-10 0:45
TClarke17-May-10 0:45 
Questionneed help vc++.net please Pin
Gilbertu16-May-10 23:54
Gilbertu16-May-10 23:54 
AnswerRe: need help vc++.net please Pin
Hristo-Bojilov17-May-10 0:09
Hristo-Bojilov17-May-10 0:09 
GeneralRe: need help vc++.net please Pin
Gilbertu17-May-10 0:19
Gilbertu17-May-10 0:19 
QuestionHiding Controls Dynamically in Dialog Pin
Anu_Bala16-May-10 23:40
Anu_Bala16-May-10 23:40 
AnswerRe: Hiding Controls Dynamically in Dialog Pin
Hristo-Bojilov17-May-10 0:59
Hristo-Bojilov17-May-10 0:59 
AnswerRe: Hiding Controls Dynamically in Dialog Pin
Member 392263917-May-10 2:18
Member 392263917-May-10 2:18 
GeneralRe: Hiding Controls Dynamically in Dialog Pin
David Crow17-May-10 3:05
David Crow17-May-10 3:05 
QuestionInput from Commandline. Pin
krishna_CP16-May-10 22:37
krishna_CP16-May-10 22:37 
AnswerRe: Input from Commandline. Pin
Hristo-Bojilov16-May-10 22:44
Hristo-Bojilov16-May-10 22:44 
AnswerRe: Input from Commandline. Pin
Garth J Lancaster16-May-10 23:33
professionalGarth J Lancaster16-May-10 23:33 
AnswerRe: Input from Commandline. Pin
Aescleal17-May-10 1:11
Aescleal17-May-10 1:11 
QuestionWriteprivateprofilestring() take delay to update original ini file Pin
Shivanand Gupta16-May-10 20:56
Shivanand Gupta16-May-10 20:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.