1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
|
//nach ganz oben (wegen Static)
BOOL CJSPeditorView::EnumWindowsProc(HWND hwnd, LPARAM lParam);
bool CJSPeditorView::isOpen;
//weiterunten...
BOOL CALLBACK CJSPeditorView::EnumWindowsProc(HWND hwnd, LPARAM lParam)
{//durchsucht alle fenstertitel, und setzt isOpen auf true, falls der tomcat dabei war...
char WindowText[255];
CString s;
if ( ::IsWindowVisible(hwnd) && ::IsWindow(hwnd) && ::GetParent(hwnd)==NULL )
{
::GetWindowText( hwnd, WindowText, 255 );
s=WindowText;
if(s == "Tomcat 3.2")
isOpen = true;
}
return TRUE;
}
void CJSPeditorView::OnDateiAusfhren()
{//Funktion speichert die datei ab, und ruft sie im Browser auf.
this->GetDocument()->OnSaveDocument(GetDocument()->GetPathName());//Datei speichern
isOpen = false;
EnumWindows(/*(WNDENUMPROC)*/EnumWindowsProc,NULL);
if(isOpen)//Tomcat läuft ?
ShellExecute(NULL,"open","mozilla.exe","http://localhost/root/"+ this->GetDocument()->GetTitle(),NULL,SW_SHOW);
else
{
WinExec("E:\Weller\jakarta-tomcat-3.2.4\bin\startup.bat",SW_SHOW);//Tomcat starten
MessageBox("Tomcat starting, please wait");
_sleep(8000);//damit der Browser nicht vor dem Tomcat da ist, sonst kann er die .jsp nicht auflösen
ShellExecute(NULL,"open","mozilla.exe","http://localhost/root/"+ this->GetDocument()->GetTitle(),NULL,SW_SHOW);//.jsp auflösen
}
} |