Skip to content

Commit

Permalink
fix for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
brookhong committed Apr 3, 2015
1 parent b032b4d commit bd5de29
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
5 changes: 1 addition & 4 deletions httpserver.cpp
Expand Up @@ -2,6 +2,7 @@
#include <string.h>
using namespace std;
#include "mongoose.h"
#include "httpserver.h"
string queryDict(const char *idxFileName, const char *keyword);

static const char *html_form =
Expand Down Expand Up @@ -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;

Expand Down
11 changes: 11 additions & 0 deletions 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
2 changes: 1 addition & 1 deletion msw/trayicon.h
Expand Up @@ -15,7 +15,7 @@
#define MENU_EXIT 33


extern void (*app_close_listener)( HWND );
void app_close_listener( HWND );
void RegisterApplicationClass( HINSTANCE hInstance );

#endif
6 changes: 4 additions & 2 deletions msw/winmain.cpp
@@ -1,5 +1,6 @@
#include "trayicon.h"
#include "shellapi.h"
#include "../httpserver.h"
#include <process.h>

LRESULT (*WindowProc_fallback)( HWND, UINT, WPARAM, LPARAM );
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit bd5de29

Please sign in to comment.