Click here to Skip to main content
15,891,567 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to join two programes? Pin
Waldemar Ork8-Nov-09 0:20
Waldemar Ork8-Nov-09 0:20 
GeneralRe: How to join two programes? Pin
Richard Andrew x648-Nov-09 6:55
professionalRichard Andrew x648-Nov-09 6:55 
GeneralRe: How to join two programes? Pin
LunaticFringe8-Nov-09 8:05
LunaticFringe8-Nov-09 8:05 
GeneralRe: How to join two programes? Pin
Waldemar Ork8-Nov-09 9:49
Waldemar Ork8-Nov-09 9:49 
QuestionRe: How to join two programes? Pin
David Crow7-Nov-09 10:06
David Crow7-Nov-09 10:06 
Questionneed information about online courses in vc++ Pin
l_d7-Nov-09 3:01
l_d7-Nov-09 3:01 
AnswerRe: need information about online courses in vc++ Pin
Richard MacCutchan7-Nov-09 4:23
mveRichard MacCutchan7-Nov-09 4:23 
Questiondraw buterfly grahics using c,c++ Pin
aviparida7-Nov-09 1:03
aviparida7-Nov-09 1:03 
AnswerRe: draw buterfly grahics using c,c++ Pin
Richard MacCutchan7-Nov-09 4:32
mveRichard MacCutchan7-Nov-09 4:32 
AnswerRe: draw buterfly grahics using c,c++ Pin
CPallini7-Nov-09 8:20
mveCPallini7-Nov-09 8:20 
QuestionHow to get Windows Handler from process id of excel instance. Pin
NarVish7-Nov-09 0:03
NarVish7-Nov-09 0:03 
AnswerRe: How to get Windows Handler from process id of excel instance. Pin
includeh107-Nov-09 1:01
includeh107-Nov-09 1:01 
GeneralRe: How to get Windows Handler from process id of excel instance. Pin
NarVish7-Nov-09 1:40
NarVish7-Nov-09 1:40 
GeneralRe: How to get Windows Handler from process id of excel instance. Pin
includeh107-Nov-09 2:06
includeh107-Nov-09 2:06 
GeneralRe: How to get Windows Handler from process id of excel instance. Pin
NarVish7-Nov-09 2:21
NarVish7-Nov-09 2:21 
I tried with EnumWindows function also. Below is the complete code. Please mention, if I missed anything.

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;
}

QuestionRe: How to get Windows Handler from process id of excel instance. Pin
David Crow7-Nov-09 10:09
David Crow7-Nov-09 10:09 
AnswerRe: How to get Windows Handler from process id of excel instance. Pin
includeh107-Nov-09 10:29
includeh107-Nov-09 10:29 
Questionthread to process call Pin
includeh106-Nov-09 23:27
includeh106-Nov-09 23:27 
AnswerRe: thread to process call Pin
«_Superman_»7-Nov-09 10:50
professional«_Superman_»7-Nov-09 10:50 
Questionfunctions of raw socket Pin
includeh106-Nov-09 22:57
includeh106-Nov-09 22:57 
AnswerRe: functions of raw socket Pin
Richard MacCutchan7-Nov-09 4:30
mveRichard MacCutchan7-Nov-09 4:30 
Questionnamed IP to digital IP Pin
includeh106-Nov-09 22:38
includeh106-Nov-09 22:38 
AnswerRe: named IP to digital IP Pin
Tony Richards6-Nov-09 23:34
Tony Richards6-Nov-09 23:34 
GeneralRe: named IP to digital IP Pin
includeh107-Nov-09 2:10
includeh107-Nov-09 2:10 
AnswerRe: named IP to digital IP Pin
David Crow7-Nov-09 10:14
David Crow7-Nov-09 10:14 

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.