diff --git a/httpserver.cpp b/httpserver.cpp index 61f8b81..58355ce 100644 --- a/httpserver.cpp +++ b/httpserver.cpp @@ -2,6 +2,7 @@ #include using namespace std; #include "mongoose.h" +#include "httpserver.h" string queryDict(const char *idxFileName, const char *keyword); static const char *html_form = @@ -31,10 +32,6 @@ static int handler(struct mg_connection *conn) { return 1; } -typedef struct _HTTPD{ - const char * idxFileName; - const char * port; -}HTTPD; int stopped = 0; diff --git a/httpserver.h b/httpserver.h new file mode 100755 index 0000000..f9b7858 --- /dev/null +++ b/httpserver.h @@ -0,0 +1,11 @@ +#ifndef _HTTPSERVER_H +#define _HTTPSERVER_H + +typedef struct _HTTPD{ + const char * idxFileName; + const char * port; +}HTTPD; + +void _httpServer(void *pv); + +#endif diff --git a/msw/trayicon.h b/msw/trayicon.h index 0cb23ef..f1e03dc 100644 --- a/msw/trayicon.h +++ b/msw/trayicon.h @@ -15,7 +15,7 @@ #define MENU_EXIT 33 -extern void (*app_close_listener)( HWND ); +void app_close_listener( HWND ); void RegisterApplicationClass( HINSTANCE hInstance ); #endif diff --git a/msw/winmain.cpp b/msw/winmain.cpp index 71fe207..c928e08 100644 --- a/msw/winmain.cpp +++ b/msw/winmain.cpp @@ -1,5 +1,6 @@ #include "trayicon.h" #include "shellapi.h" +#include "../httpserver.h" #include LRESULT (*WindowProc_fallback)( HWND, UINT, WPARAM, LPARAM ); @@ -58,7 +59,7 @@ LRESULT app_window_proc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) } } -extern int stopped = 0; +extern int stopped; void app_close_listener( HWND hWnd ) { stopped = 1; @@ -94,7 +95,8 @@ int httpServer(const char *idxFileName, const char *port) { if(GetConsoleWindow() == NULL) { HTTPD httpd; httpd.idxFileName = idxFileName; - httpd.port = port; _beginthread( _httpServer, 0, (void*)&httpd ); + httpd.port = port; + _beginthread( _httpServer, 0, (void*)&httpd ); _inMain(NULL); } else { bg(GetCommandLine());