Click here to Skip to main content
15,918,109 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Why... Pin
Frank Deo15-Jul-02 13:00
Frank Deo15-Jul-02 13:00 
GeneralRe: Why... Pin
Nish Nishant15-Jul-02 14:56
sitebuilderNish Nishant15-Jul-02 14:56 
GeneralGetting RuntimeClass of a CObject Derived Class Pin
MightyThor15-Jul-02 12:16
MightyThor15-Jul-02 12:16 
GeneralRe: Getting RuntimeClass of a CObject Derived Class Pin
Christian Graus15-Jul-02 12:34
protectorChristian Graus15-Jul-02 12:34 
GeneralRe: Getting RuntimeClass of a CObject Derived Class Pin
Roman Fadeyev15-Jul-02 19:03
Roman Fadeyev15-Jul-02 19:03 
GeneralRe: Getting RuntimeClass of a CObject Derived Class Pin
Christian Graus15-Jul-02 19:13
protectorChristian Graus15-Jul-02 19:13 
GeneralRe: Getting RuntimeClass of a CObject Derived Class Pin
MightyThor15-Jul-02 23:35
MightyThor15-Jul-02 23:35 
Generalexcel automation, hprocess is not closing Pin
pnpfriend15-Jul-02 12:10
pnpfriend15-Jul-02 12:10 
hi all,
I found an article about I have an excel automation dos based application . I take an article,
Automate excel from c++ without using mfc or #import (Q216686) as an example.

then based on another article Automate excel and then know the use closed it(Q192348)
I changed my code again. actually, i added,
<br />
// wait until the user close the application<br />
<br />
    HWND hWnd;<br />
    char buf[1024];<br />
    hWnd = ::FindWindow("XLMain",NULL);<br />
    if(NULL==hWnd)<br />
    {<br />
      long lErr = GetLastError();<br />
      sprintf(buf, "FindWindow Error code = %d",lErr);<br />
      AfxMessageBox(buf);<br />
    }<br />
    <br />
    DWORD pid;<br />
    DWORD dThread;<br />
    DWORD dwReason;<br />
    dThread = ::GetWindowThreadProcessId(hWnd,&pid);<br />
    HANDLE hProcess;<br />
    hProcess = ::OpenProcess(SYNCHRONIZE|PROCESS_ALL_ACCESS,TRUE,pid);<br />
<br />
    dwReason = ::WaitForSingleObject(hProcess,INFINITE);<br />
    ::CloseHandle(hProcess);<br />


everything is fine except
dwReason = ::WaitForSingleObject(hProcess,INFINITE);
is waiting forever because in windows task manager's processes tab, you will find EXCEL.EXE eventhough you have closed ms excel application.

if you command the line
dwReason = ::WaitForSingleObject(hProcess,INFINITE);
you will not find EXCEL.EXE in windows task manager's processes tab.
why is that?
Generalplease...... Pin
pnpfriend16-Jul-02 2:44
pnpfriend16-Jul-02 2:44 
GeneralRe: excel automation, hprocess is not closing Pin
Richard Ellis16-Jul-02 14:05
Richard Ellis16-Jul-02 14:05 
GeneralRe: excel automation, hprocess is not closing Pin
pnpfriend17-Jul-02 3:39
pnpfriend17-Jul-02 3:39 
Generalderive a class from my tree control Pin
Steve L.15-Jul-02 11:39
Steve L.15-Jul-02 11:39 
GeneralRe: derive a class from my tree control Pin
Joaquín M López Muñoz15-Jul-02 11:43
Joaquín M López Muñoz15-Jul-02 11:43 
GeneralRe: derive a class from my tree control Pin
Steve L.15-Jul-02 11:50
Steve L.15-Jul-02 11:50 
GeneralRe: derive a class from my tree control Pin
Joaquín M López Muñoz15-Jul-02 12:01
Joaquín M López Muñoz15-Jul-02 12:01 
GeneralRe: derive a class from my tree control Pin
Steve L.15-Jul-02 12:08
Steve L.15-Jul-02 12:08 
GeneralUsing CRecordset Pin
achandra00715-Jul-02 10:23
achandra00715-Jul-02 10:23 
GeneralRe: Using CRecordset Pin
Ranjan Banerji15-Jul-02 11:02
Ranjan Banerji15-Jul-02 11:02 
GeneralRe: Using CRecordset Pin
achandra00715-Jul-02 11:39
achandra00715-Jul-02 11:39 
GeneralComboBoxEx with DropList style problem Pin
Maciek Niedzielski15-Jul-02 10:10
Maciek Niedzielski15-Jul-02 10:10 
QuestionHow to make invisible CEdit visisble with code? Pin
ns15-Jul-02 10:09
ns15-Jul-02 10:09 
Answernevermind - I got it! Pin
ns15-Jul-02 10:15
ns15-Jul-02 10:15 
GeneralOpening a serial COM port Pin
dorin15-Jul-02 9:47
dorin15-Jul-02 9:47 
GeneralRe: Opening a serial COM port Pin
Joaquín M López Muñoz15-Jul-02 9:58
Joaquín M López Muñoz15-Jul-02 9:58 
GeneralWeird Acception Violation :: MFC Pin
valikac15-Jul-02 9:35
valikac15-Jul-02 9:35 

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.