Click here to Skip to main content
15,885,366 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
AnswerRe: named IP to digital IP Pin
Moak7-Nov-09 15:46
Moak7-Nov-09 15:46 
Question"PostMessage" without window Pin
includeh106-Nov-09 22:26
includeh106-Nov-09 22:26 
AnswerRe: "PostMessage" without window Pin
Richard MacCutchan6-Nov-09 22:32
mveRichard MacCutchan6-Nov-09 22:32 
GeneralRe: "PostMessage" without window Pin
includeh106-Nov-09 22:41
includeh106-Nov-09 22:41 
AnswerRe: "PostMessage" without window Pin
Code-o-mat6-Nov-09 22:50
Code-o-mat6-Nov-09 22:50 
GeneralRe: "PostMessage" without window Pin
Richard MacCutchan6-Nov-09 22:55
mveRichard MacCutchan6-Nov-09 22:55 
Answer[Message Deleted] Pin
Kushagra Tiwari6-Nov-09 23:38
Kushagra Tiwari6-Nov-09 23:38 

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.