Implement XDG compliance, logging, and improved 401 error handling
- Install to ~/.local/bin/winamp-mpris - Use ~/.local/state/winamp-mpris/bridge.log for logging - Use $XDG_RUNTIME_DIR/winamp-mpris.pid for PID management - Add detailed user notification for 401 Unauthorized errors - Add install.sh for automated, standard-compliant setup - Include Winamp Web Interface source code and installer in repository
BIN
gen_httpSrv_systray/Images/SECUR08.ICO
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
gen_httpSrv_systray/Images/Title.bmp
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
gen_httpSrv_systray/Images/auth2.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
gen_httpSrv_systray/Images/next.bmp
Normal file
|
After Width: | Height: | Size: 114 B |
BIN
gen_httpSrv_systray/Images/next.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
gen_httpSrv_systray/Images/pause.ICO
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
gen_httpSrv_systray/Images/pause.bmp
Normal file
|
After Width: | Height: | Size: 114 B |
BIN
gen_httpSrv_systray/Images/play.bmp
Normal file
|
After Width: | Height: | Size: 114 B |
BIN
gen_httpSrv_systray/Images/play.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
gen_httpSrv_systray/Images/prev.bmp
Normal file
|
After Width: | Height: | Size: 114 B |
BIN
gen_httpSrv_systray/Images/prev.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
gen_httpSrv_systray/Images/server.ico
Normal file
|
After Width: | Height: | Size: 318 B |
BIN
gen_httpSrv_systray/Images/stop.bmp
Normal file
|
After Width: | Height: | Size: 114 B |
BIN
gen_httpSrv_systray/Images/stop.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
gen_httpSrv_systray/Images/winamp.ico
Normal file
|
After Width: | Height: | Size: 318 B |
64
gen_httpSrv_systray/WawiTray Readme.txt
Normal file
@@ -0,0 +1,64 @@
|
||||
A Really Quick Readme For The WawiTray Thingy
|
||||
-------------------------------------------------------
|
||||
|
||||
(Because I'm hungry and I want to go make dinner!)
|
||||
|
||||
|
||||
|
||||
Based on a suggestion from Bill Kearney, it's a really teeny HTTP client which will send the right commands to the Winamp HTTP Server plugin to make it do stuff. This way you can control your winamp from another computer without using the big browser window if all you want it to do is control playback.
|
||||
|
||||
Stick the right host (in IPv4 dotted format only, for example your local machine is always 127.0.0.1) and port number in (so it matches the value in the HTTP Server config window, 80 by default); stick a username and password in if required and click away. It'll either make winamp do stuff, or (hopefully) tell you why it can't.
|
||||
|
||||
This is something I've only worked on for an hour or two, and as such probably has a few teething problems. If you do find anything, please drop me a mail (contact@flippet.net) to tell me what, and I'll see what I can do. Or feel free to send suggestions, jokes, cash et cetera...
|
||||
|
||||
|
||||
|
||||
|
||||
Disclaimer
|
||||
----------
|
||||
|
||||
While I've gone to every effort to make sure this doesn't cause harmful effects - I don't want to fry my own computer! - I cannot say for sure that it will not fry yours. I will not be responsible for any damage or loss of anything even slightly relating to this program. You use it ENTIRELY AT YOUR OWN RISK. Don't run to me if things break. I'll fix bits of the program if you spot bugs if I want to, but I'm under no obligation to do so at all. And don't you forget it.
|
||||
|
||||
Besides that, I hope it's useful. Have fun!
|
||||
|
||||
|
||||
|
||||
|
||||
Version History
|
||||
---------------
|
||||
|
||||
2.1
|
||||
* Made it work with recent versions of Wawi
|
||||
* Added a prettier config window
|
||||
* A few little tweaks here and there...
|
||||
|
||||
1.5
|
||||
* Tooltip of systray icon tells the song title. Set how often it updates in the Config window.
|
||||
|
||||
1.4
|
||||
* Fancy-pants little icons for the play options in the menu
|
||||
|
||||
1.3
|
||||
* The default action when left clicking on the icon can now be changed
|
||||
|
||||
1.2
|
||||
* Added shortcuts to the Browse and Playlist pages
|
||||
|
||||
1.1
|
||||
* Added a volume slider
|
||||
* Added better error messages if it gets HTTP responses that it shouldn't
|
||||
|
||||
1.0
|
||||
* Initial release
|
||||
|
||||
|
||||
|
||||
Me
|
||||
--
|
||||
|
||||
Phil Himsworth, UK
|
||||
|
||||
web: http://www.flippet.org
|
||||
email: contact@flippet.net
|
||||
|
||||
September, 2002
|
||||
15
gen_httpSrv_systray/client.ini
Normal file
@@ -0,0 +1,15 @@
|
||||
[Wawi Tray]
|
||||
port=800
|
||||
default=105
|
||||
updatedelay=10
|
||||
auth=1
|
||||
host=10.2.169.200
|
||||
username=bob
|
||||
password=password
|
||||
[Winamp HTTP Server Client Applet]
|
||||
port=800
|
||||
default=105
|
||||
updatedelay=10
|
||||
host=127.0.0.1
|
||||
username=anon
|
||||
password=
|
||||
453
gen_httpSrv_systray/config.cpp
Normal file
@@ -0,0 +1,453 @@
|
||||
#include <windows.h>
|
||||
#include <prsht.h>
|
||||
#include <mmsystem.h>
|
||||
#include <commctrl.h>
|
||||
#include "resource.h"
|
||||
#include "main.h"
|
||||
|
||||
extern HINSTANCE inst;
|
||||
extern HWND hwnd;
|
||||
|
||||
extern char host[255], username[20], password[20];
|
||||
extern int port, default_action, update_delay;
|
||||
extern UINT timer_id;
|
||||
extern bool use_auth;
|
||||
|
||||
extern char szAppName[], AboutText[];
|
||||
|
||||
extern HWND ConfigWnd, VolumeWnd;
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Entry point for new Config window, using Property Sheets instead of a single dialog.
|
||||
void NewConfig()
|
||||
{
|
||||
PROPSHEETPAGE psp[4];
|
||||
PROPSHEETHEADER psh;
|
||||
|
||||
psp[0].dwSize = sizeof(PROPSHEETPAGE);
|
||||
psp[0].dwFlags = PSP_USEICONID | PSP_USETITLE;
|
||||
psp[0].hInstance = inst;
|
||||
psp[0].pszTemplate = MAKEINTRESOURCE(IDD_ABOUT);
|
||||
psp[0].pszIcon = MAKEINTRESOURCE(IDI_WINAMP);
|
||||
psp[0].pfnDlgProc = ConfigAboutWndProc;
|
||||
psp[0].pszTitle = "About";
|
||||
psp[0].lParam = 0;
|
||||
psp[0].pfnCallback = NULL;
|
||||
|
||||
psp[1].dwSize = sizeof(PROPSHEETPAGE);
|
||||
psp[1].dwFlags = PSP_USEICONID | PSP_USETITLE;
|
||||
psp[1].hInstance = inst;
|
||||
psp[1].pszTemplate = MAKEINTRESOURCE(IDD_SERVER);
|
||||
psp[1].pszIcon = MAKEINTRESOURCE(IDI_SERVER);
|
||||
psp[1].pfnDlgProc = ConfigServerWndProc;
|
||||
psp[1].pszTitle = "Server";
|
||||
psp[1].lParam = 0;
|
||||
psp[1].pfnCallback = NULL;
|
||||
|
||||
psp[2].dwSize = sizeof(PROPSHEETPAGE);
|
||||
psp[2].dwFlags = PSP_USEICONID | PSP_USETITLE;
|
||||
psp[2].hInstance = inst;
|
||||
psp[2].pszTemplate = MAKEINTRESOURCE(IDD_SYSTRAY);
|
||||
psp[2].pszIcon = MAKEINTRESOURCE(GetIconID());
|
||||
psp[2].pfnDlgProc = ConfigSystrayWndProc;
|
||||
psp[2].pszTitle = "Tray Icon";
|
||||
psp[2].lParam = 0;
|
||||
psp[2].pfnCallback = NULL;
|
||||
|
||||
psp[3].dwSize = sizeof(PROPSHEETPAGE);
|
||||
psp[3].dwFlags = PSP_USEICONID | PSP_USETITLE;
|
||||
psp[3].hInstance = inst;
|
||||
psp[3].pszTemplate = MAKEINTRESOURCE(IDD_AUTH);
|
||||
psp[3].pszIcon = MAKEINTRESOURCE(IDI_AUTH2);
|
||||
psp[3].pfnDlgProc = ConfigAuthWndProc;
|
||||
psp[3].pszTitle = "Authentication";
|
||||
psp[3].lParam = 0;
|
||||
psp[3].pfnCallback = NULL;
|
||||
|
||||
|
||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||
psh.dwFlags = PSH_USEICONID | PSH_PROPSHEETPAGE;
|
||||
psh.hwndParent = hwnd;
|
||||
psh.hInstance = inst;
|
||||
psh.pszIcon = NULL;
|
||||
psh.pszCaption = "WawiTray Config";
|
||||
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
|
||||
psh.nStartPage = 0;
|
||||
psh.ppsp = (LPCPROPSHEETPAGE) &psp;
|
||||
psh.pfnCallback = NULL;
|
||||
|
||||
PropertySheet(&psh);
|
||||
config_write();
|
||||
ConfigWnd = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Server options window proc
|
||||
BOOL CALLBACK ConfigServerWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
char TempString[10];
|
||||
int port_temp;
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
wsprintf(TempString,"%d",port);
|
||||
SetDlgItemText(hwndDlg,IDC_HOST,host);
|
||||
SetDlgItemText(hwndDlg,IDC_PORT,TempString);
|
||||
break;
|
||||
|
||||
|
||||
case WM_NOTIFY:
|
||||
switch (((NMHDR FAR *) lParam)->code)
|
||||
{
|
||||
case PSN_APPLY: port_temp = GetDlgItemInt(hwndDlg,IDC_PORT,NULL,false);
|
||||
if (port_temp > 0 && port_temp < 65536)
|
||||
{
|
||||
port = port_temp;
|
||||
GetDlgItemText(hwndDlg,IDC_HOST,host,255);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(hwndDlg,"Port must be from 1 to 65535!","Winamp Web Interface",MB_OK);
|
||||
SetDlgItemInt(hwndDlg,IDC_PORT,port,false);
|
||||
SetWindowLong(hwndDlg,DWL_MSGRESULT,true);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Systray options window proc
|
||||
BOOL CALLBACK ConfigSystrayWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
char temp[5];
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
int def_button;
|
||||
switch(default_action)
|
||||
{
|
||||
case WA_PREV:
|
||||
def_button = IDC_DEF_PREV;
|
||||
break;
|
||||
case WA_PLAY:
|
||||
def_button = IDC_DEF_PLAY;
|
||||
break;
|
||||
case WA_PAUSE:
|
||||
def_button = IDC_DEF_PAUSE;
|
||||
break;
|
||||
case WA_STOP:
|
||||
def_button = IDC_DEF_STOP;
|
||||
break;
|
||||
case WA_NEXT:
|
||||
def_button = IDC_DEF_NEXT;
|
||||
break;
|
||||
}
|
||||
|
||||
CheckRadioButton(hwndDlg,IDC_DEF_PREV,IDC_DEF_NEXT,def_button);
|
||||
|
||||
wsprintf(temp,"%d",update_delay);
|
||||
SetDlgItemText(hwndDlg,IDC_UPDATEDELAY,temp);
|
||||
break;
|
||||
|
||||
|
||||
case WM_NOTIFY:
|
||||
switch (((NMHDR FAR *) lParam)->code)
|
||||
{
|
||||
case PSN_APPLY: update_delay = GetDlgItemInt(hwndDlg,IDC_UPDATEDELAY,NULL,false);
|
||||
KillTimer(hwnd,timer_id);
|
||||
timer_id = SetTimer(hwnd,TIMER_ID,update_delay*1000,NULL);
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_DEF_PREV) == BST_CHECKED)
|
||||
default_action = WA_PREV;
|
||||
else
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_DEF_PREV) == BST_CHECKED)
|
||||
default_action = WA_PREV;
|
||||
else
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_DEF_PLAY) == BST_CHECKED)
|
||||
default_action = WA_PLAY;
|
||||
else
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_DEF_PAUSE) == BST_CHECKED)
|
||||
default_action = WA_PAUSE;
|
||||
else
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_DEF_STOP) == BST_CHECKED)
|
||||
default_action = WA_STOP;
|
||||
else
|
||||
default_action = WA_NEXT;
|
||||
|
||||
systray_modify(hwnd,1030,LoadIcon(inst, MAKEINTRESOURCE(GetIconID())),szAppName);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Authentication options window proc
|
||||
BOOL CALLBACK ConfigAuthWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int use_auth_int;
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
SetDlgItemText(hwndDlg,IDC_USERNAME,username);
|
||||
SetDlgItemText(hwndDlg,IDC_PASSWORD,password);
|
||||
if (use_auth)
|
||||
CheckDlgButton(hwndDlg,IDC_AUTH,1);
|
||||
else
|
||||
CheckDlgButton(hwndDlg,IDC_AUTH,0);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case WM_NOTIFY:
|
||||
switch (((NMHDR FAR *) lParam)->code)
|
||||
{
|
||||
case PSN_APPLY: GetDlgItemText(hwndDlg,IDC_USERNAME,username,20);
|
||||
GetDlgItemText(hwndDlg,IDC_PASSWORD,password,20);
|
||||
use_auth_int = IsDlgButtonChecked(hwndDlg,IDC_AUTH);
|
||||
if (use_auth_int == 0)
|
||||
use_auth = false;
|
||||
else
|
||||
use_auth = true;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// About window proc
|
||||
BOOL CALLBACK ConfigAboutWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
break;
|
||||
|
||||
|
||||
case WM_NOTIFY:
|
||||
switch (((NMHDR FAR *) lParam)->code)
|
||||
{
|
||||
case PSN_APPLY: break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// WindowProc for Config dialog
|
||||
BOOL CALLBACK ConfigWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
ConfigWnd = hwndDlg; // Keep global pointer to window so no more than one is active
|
||||
char temp[100];
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
int def_button;
|
||||
switch(default_action)
|
||||
{
|
||||
case WA_PREV:
|
||||
def_button = IDC_DEF_PREV;
|
||||
break;
|
||||
case WA_PLAY:
|
||||
def_button = IDC_DEF_PLAY;
|
||||
break;
|
||||
case WA_PAUSE:
|
||||
def_button = IDC_DEF_PAUSE;
|
||||
break;
|
||||
case WA_STOP:
|
||||
def_button = IDC_DEF_STOP;
|
||||
break;
|
||||
case WA_NEXT:
|
||||
def_button = IDC_DEF_NEXT;
|
||||
break;
|
||||
}
|
||||
SetDlgItemText(hwndDlg,IDC_HOST,host);
|
||||
wsprintf(temp,"%d",port);
|
||||
SetDlgItemText(hwndDlg,IDC_PORT,temp);
|
||||
wsprintf(temp,"%d",update_delay);
|
||||
SetDlgItemText(hwndDlg,IDC_UPDATEDELAY,temp);
|
||||
SetDlgItemText(hwndDlg,IDC_USERNAME,username);
|
||||
SetDlgItemText(hwndDlg,IDC_PASSWORD,password);
|
||||
CheckRadioButton(hwndDlg,IDC_DEF_PREV,IDC_DEF_NEXT,def_button);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDCANCEL: EndDialog(hwndDlg,0);
|
||||
break;
|
||||
case IDABOUT: MessageBox(hwnd,AboutText,szAppName,MB_OK | MB_ICONINFORMATION);
|
||||
break;
|
||||
case IDOK: GetDlgItemText(hwndDlg,IDC_HOST,host,255);
|
||||
port = GetDlgItemInt(hwndDlg,IDC_PORT,NULL,false);
|
||||
update_delay = GetDlgItemInt(hwndDlg,IDC_UPDATEDELAY,NULL,false);
|
||||
KillTimer(hwnd,timer_id);
|
||||
timer_id = SetTimer(hwnd,TIMER_ID,update_delay*1000,NULL);
|
||||
GetDlgItemText(hwndDlg,IDC_USERNAME,username,20);
|
||||
GetDlgItemText(hwndDlg,IDC_PASSWORD,password,20);
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_DEF_PREV) == BST_CHECKED)
|
||||
default_action = WA_PREV;
|
||||
else
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_DEF_PREV) == BST_CHECKED)
|
||||
default_action = WA_PREV;
|
||||
else
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_DEF_PLAY) == BST_CHECKED)
|
||||
default_action = WA_PLAY;
|
||||
else
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_DEF_PAUSE) == BST_CHECKED)
|
||||
default_action = WA_PAUSE;
|
||||
else
|
||||
if (IsDlgButtonChecked(hwndDlg,IDC_DEF_STOP) == BST_CHECKED)
|
||||
default_action = WA_STOP;
|
||||
else
|
||||
default_action = WA_NEXT;
|
||||
|
||||
systray_modify(hwnd,1030,LoadIcon(inst, MAKEINTRESOURCE(GetIconID())),szAppName);
|
||||
config_write();
|
||||
EndDialog(hwndDlg,0);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// write config
|
||||
void config_write()
|
||||
{
|
||||
char ini_file[MAX_PATH], *p;
|
||||
char string[32];
|
||||
GetModuleFileName(inst,ini_file,sizeof(ini_file));
|
||||
p=ini_file+lstrlen(ini_file);
|
||||
while (p >= ini_file && *p != '\\') p--;
|
||||
if (++p >= ini_file) *p = 0;
|
||||
lstrcat(ini_file,"client.ini");
|
||||
|
||||
wsprintf(string,"%d",port);
|
||||
WritePrivateProfileString(szAppName,"port",string,ini_file);
|
||||
|
||||
wsprintf(string,"%d",default_action);
|
||||
WritePrivateProfileString(szAppName,"default",string,ini_file);
|
||||
|
||||
wsprintf(string,"%d",update_delay);
|
||||
WritePrivateProfileString(szAppName,"updatedelay",string,ini_file);
|
||||
|
||||
if (use_auth)
|
||||
WritePrivateProfileString(szAppName,"auth","1",ini_file);
|
||||
else
|
||||
WritePrivateProfileString(szAppName,"auth","0",ini_file);
|
||||
|
||||
|
||||
WritePrivateProfileString(szAppName,"host",host,ini_file);
|
||||
WritePrivateProfileString(szAppName,"username",username,ini_file);
|
||||
WritePrivateProfileString(szAppName,"password",password,ini_file);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// read config (port and password)
|
||||
void config_read()
|
||||
{
|
||||
char ini_file[MAX_PATH], *p;
|
||||
GetModuleFileName(inst,ini_file,sizeof(ini_file));
|
||||
p=ini_file+lstrlen(ini_file);
|
||||
while (p >= ini_file && *p != '\\') p--;
|
||||
if (++p >= ini_file) *p = 0;
|
||||
lstrcat(ini_file,"client.ini");
|
||||
|
||||
GetPrivateProfileString(szAppName,"host","127.0.0.1",(char*)&host,255,ini_file);
|
||||
GetPrivateProfileString(szAppName,"username","user",(char*)&username,20,ini_file);
|
||||
GetPrivateProfileString(szAppName,"password","password",(char*)&password,20,ini_file);
|
||||
|
||||
port = GetPrivateProfileInt(szAppName,"port",80,ini_file);
|
||||
default_action = GetPrivateProfileInt(szAppName,"default",WA_NEXT,ini_file);
|
||||
update_delay = GetPrivateProfileInt(szAppName,"updatedelay",10,ini_file);
|
||||
|
||||
int use_auth_int = GetPrivateProfileInt(szAppName,"auth",0,ini_file);
|
||||
if (use_auth_int == 1)
|
||||
use_auth = true;
|
||||
else
|
||||
use_auth = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// WindowProc for Volume dialog
|
||||
BOOL CALLBACK VolumeWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
char temp[50];
|
||||
VolumeWnd = hwndDlg;
|
||||
HWND SliderWnd;
|
||||
POINT mousepos;
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
GetCursorPos(&mousepos);
|
||||
SetWindowPos(hwndDlg,HWND_TOP,mousepos.x-46,mousepos.y-95,0,0,SWP_NOSIZE);
|
||||
SliderWnd = GetDlgItem(hwndDlg,IDC_VOLUME);
|
||||
SendMessage(SliderWnd, TBM_SETRANGE, (WPARAM) true, (LPARAM) MAKELONG(0,10));
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDC_DONE:
|
||||
EndDialog(hwndDlg,0);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case WM_VSCROLL:
|
||||
DWORD dwPos;
|
||||
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case TB_THUMBTRACK:
|
||||
case TB_LINEDOWN:
|
||||
case TB_LINEUP:
|
||||
case TB_PAGEDOWN:
|
||||
case TB_PAGEUP:
|
||||
|
||||
SliderWnd = GetDlgItem(hwndDlg,IDC_VOLUME);
|
||||
dwPos = SendMessage(SliderWnd, TBM_GETPOS, 0, 0);
|
||||
wsprintf(temp,"/vol?volume=%d",10-dwPos);
|
||||
//MessageBox(SliderWnd,temp,"Slider Position",MB_OK | MB_TOPMOST);
|
||||
WASend(temp);
|
||||
return 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
340
gen_httpSrv_systray/connection.cpp
Normal file
@@ -0,0 +1,340 @@
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
|
||||
#include "resource.h"
|
||||
#include "main.h"
|
||||
|
||||
extern char szAppName[];
|
||||
extern char username[20], password[20], title[255];
|
||||
extern char host[255];
|
||||
extern int port;
|
||||
|
||||
extern bool use_auth;
|
||||
|
||||
extern HWND hwnd;
|
||||
|
||||
|
||||
// Base64 character array
|
||||
// 0 1 2 3 4 5 6
|
||||
// 01234567890123456789012345678901234567890123456789012345678901234
|
||||
const char bchars[] = "=BCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+*";
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Start winsock
|
||||
bool StartWinSock()
|
||||
{
|
||||
WORD wVersionRequested = MAKEWORD(2,2);
|
||||
WSADATA wsaData;
|
||||
|
||||
if (WSAStartup(wVersionRequested, &wsaData ) != 0 )
|
||||
{
|
||||
MessageBox(NULL, "ERROR: Winsock not available", szAppName, MB_OK);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Low level socket writing function - strings
|
||||
void prints(SOCKET socket, char * string)
|
||||
{
|
||||
int i=0;
|
||||
while (string[i] != 0)
|
||||
i++;
|
||||
|
||||
if (send(socket,string,i,0) == SOCKET_ERROR)
|
||||
{
|
||||
//MessageBox(NULL,"Socket send() error!",szAppName,MB_OK);
|
||||
}
|
||||
}
|
||||
|
||||
// Low level socket writing function - integers
|
||||
void printsi(SOCKET socket,int number)
|
||||
{
|
||||
char buffer[256];
|
||||
wsprintf(buffer,"%d",number); // Stick it in a string and call prints()
|
||||
prints(socket,(char*)&buffer);
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Opens socket
|
||||
bool MakeRequest(char * host, int port, char * url, bool verbose, bool auth, bool gettitle)
|
||||
{
|
||||
//MessageBox(NULL,"Entering MakeRequest","wawitray",MB_OK | MB_TOPMOST);
|
||||
|
||||
SOCKET ssocket = socket(AF_INET,SOCK_STREAM,0);
|
||||
if (ssocket == INVALID_SOCKET)
|
||||
{
|
||||
if (verbose)
|
||||
MessageBox(NULL, "ERROR: Couldn't create socket", szAppName, MB_OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
struct sockaddr_in server_address;
|
||||
ZeroMemory(&server_address,sizeof(server_address));
|
||||
|
||||
server_address.sin_family = AF_INET;
|
||||
|
||||
server_address.sin_addr.s_addr = inet_addr(host);
|
||||
server_address.sin_port = htons(port);
|
||||
|
||||
if (SOCKET_ERROR == connect(ssocket,(sockaddr*)&server_address,sizeof(sockaddr_in)))
|
||||
{
|
||||
if (verbose)
|
||||
MessageBox(hwnd,"Couldn't connect to remote Winamp!\n\nCheck you have the address and port right.",szAppName,MB_OK|MB_ICONERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
char method[6];
|
||||
if (gettitle)
|
||||
wsprintf(method,"GET");
|
||||
else
|
||||
wsprintf(method,"HEAD");
|
||||
|
||||
char request[100];
|
||||
|
||||
if (auth)
|
||||
{
|
||||
char b64userpass[100], userpass[100];
|
||||
wsprintf(userpass,"%s:%s",username,password);
|
||||
ToBase64(userpass,b64userpass);
|
||||
wsprintf(request,"%s %s HTTP/1.0\nAuthorisation: Basic %s\n\n",method,url,b64userpass);
|
||||
}
|
||||
else
|
||||
{
|
||||
wsprintf(request,"%s %s HTTP/1.0\nConnection: Close\n\n",method,url);
|
||||
}
|
||||
prints(ssocket,request);
|
||||
|
||||
int res = GetResponse(ssocket,gettitle);
|
||||
|
||||
closesocket(ssocket);
|
||||
|
||||
switch(res)
|
||||
{
|
||||
case RES_OK:
|
||||
break;
|
||||
case RES_AUTH:
|
||||
if (verbose)
|
||||
MessageBox(hwnd,"Incorrect username or password!\n\nCheck the details are right in the Config window.",szAppName,MB_OK|MB_ICONERROR | MB_TOPMOST);
|
||||
break;
|
||||
case RES_NOTFOUND:
|
||||
if (verbose)
|
||||
MessageBox(hwnd,"Received a 404 Page Not Found response, which the Winamp HTTP Server does not produce!\n\nAre you sure your host and port settings are correct?",szAppName,MB_OK | MB_ICONERROR | MB_TOPMOST);
|
||||
break;
|
||||
case RES_BADREQUEST:
|
||||
if (verbose)
|
||||
MessageBox(hwnd,"Received a 400 Bad Request message, which the Winamp HTTP Server does not produce!\n\nCheck your Host and Port settings are correct.",szAppName, MB_OK | MB_ICONERROR | MB_TOPMOST);
|
||||
case RES_UNKNOWN:
|
||||
case RES_FAIL:
|
||||
if (verbose)
|
||||
MessageBox(hwnd,"Unknown HTTP Response",szAppName,MB_OK | MB_ICONWARNING | MB_TOPMOST);
|
||||
break;
|
||||
}
|
||||
|
||||
//MessageBox(hwnd,"Leaving MakeRequest","wawitray",MB_OK | MB_TOPMOST);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int WASend(char * command)
|
||||
{
|
||||
MakeRequest(host,port,command,true,use_auth,false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Converts a string to Base64
|
||||
void ToBase64(char * instr, char * outstr)
|
||||
{
|
||||
//MessageBox(NULL,instr,"instr",MB_OK);
|
||||
|
||||
int i=0;
|
||||
int o=0;
|
||||
int j = lstrlen(instr);
|
||||
|
||||
bool done = false;
|
||||
|
||||
while(instr[i] != 0 && done == false)
|
||||
{
|
||||
outstr[o] = bchars[(instr[i] & 0xFC) / 4];
|
||||
outstr[o+1] = bchars[((instr[i] & 0x03) * 16) + ((instr[i+1] & 0xF0) / 16)];
|
||||
if (instr[i+1] == 0)
|
||||
{
|
||||
outstr[o+2] = '=';
|
||||
outstr[o+3] = '=';
|
||||
done = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
outstr[o+2] = bchars[((instr[i+1] & 0x0F) * 4) + ((instr[i+2] & 0xC0) /64)];
|
||||
if (instr[i+2] == 0)
|
||||
{
|
||||
outstr[o+3] = '=';
|
||||
done = true;
|
||||
}
|
||||
else
|
||||
outstr[o+3] = bchars[(instr[i+2] & 0x3F)];
|
||||
}
|
||||
|
||||
o += 4;
|
||||
i += 3;
|
||||
}
|
||||
|
||||
outstr[o] = 0;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Receives return HTTP header
|
||||
int GetResponse(SOCKET socket, bool gettitle)
|
||||
{
|
||||
char buffer[2048],http_version[20],response[5],text[100];
|
||||
int buffer_len;
|
||||
int buffer_filled = 0;
|
||||
int buffer_left;
|
||||
bool complete = false;
|
||||
|
||||
int breaks;
|
||||
if (gettitle)
|
||||
breaks = 1;
|
||||
else
|
||||
breaks = 0;
|
||||
|
||||
|
||||
while(true)
|
||||
{
|
||||
// receive data
|
||||
buffer_len = sizeof(buffer);
|
||||
buffer_left = buffer_len-buffer_filled;
|
||||
if (buffer_left <= 0)
|
||||
buffer_len = 0;
|
||||
else
|
||||
buffer_len = recv(socket,buffer + buffer_filled,buffer_len-buffer_filled,0);
|
||||
|
||||
if (buffer_len != SOCKET_ERROR && buffer_len != 0)
|
||||
{
|
||||
buffer_filled += buffer_len;
|
||||
// scan for end of header
|
||||
for (int i=0;i<=buffer_filled;i++)
|
||||
if (buffer[i]=='\n' && (buffer[i+1]=='\n' || buffer[i+2]=='\n'))
|
||||
{
|
||||
if (breaks == 0)
|
||||
{
|
||||
buffer[i+1] = 0;
|
||||
//MessageBox(NULL,buffer,"gen_httpsrv debug", MB_OK);
|
||||
char * chptr = (char*)&buffer;
|
||||
|
||||
chptr = GetAString(chptr,http_version);
|
||||
chptr = GetAString(chptr,response);
|
||||
chptr = GetAString(chptr,text);
|
||||
chptr = SkipHeader(chptr);
|
||||
|
||||
if (StrComp(response,"200"))
|
||||
{
|
||||
if (gettitle)
|
||||
GetALine(chptr,title);
|
||||
return RES_OK;
|
||||
}
|
||||
if (StrComp(response,"401"))
|
||||
return RES_AUTH;
|
||||
if (StrComp(response,"404"))
|
||||
return RES_NOTFOUND;
|
||||
if (StrComp(response,"400"))
|
||||
return RES_BADREQUEST;
|
||||
|
||||
return RES_UNKNOWN;
|
||||
}
|
||||
else
|
||||
breaks--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return RES_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Retrieves next token from buffer
|
||||
char * GetAString(char* chptr, char* text) // Old GetAString - only accepts single words
|
||||
{
|
||||
int bptr = 0;
|
||||
int tptr = 0;
|
||||
while (chptr[bptr] == ' ' || chptr[bptr] == '\n' || chptr[bptr] == '\r') // skip leading spaces and stuff
|
||||
bptr++;
|
||||
|
||||
while (chptr[bptr] != 0 && chptr[bptr] != ' ' && chptr[bptr] != '\n' && chptr[bptr] != '\r' && bptr < 255) // while current char is a letter
|
||||
{
|
||||
text[tptr] = chptr[bptr]; // add letter to text[]
|
||||
bptr++;
|
||||
tptr++;
|
||||
}
|
||||
text[tptr] = 0;
|
||||
chptr = chptr + bptr;
|
||||
return chptr; // return pointer to the end of this string
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Skips the rest of the HTTP header
|
||||
char * SkipHeader(char * chptr)
|
||||
{
|
||||
while (chptr[0] != '\n' || (chptr[1] != '\n' && chptr[2] != '\r'))
|
||||
chptr++;
|
||||
return chptr;
|
||||
}
|
||||
// --------------------------------------------------------------------------------
|
||||
// Gets a whole line
|
||||
char * GetALine(char * chptr, char * text)
|
||||
{
|
||||
int bptr = 0;
|
||||
int tptr = 0;
|
||||
while (chptr[bptr] == ' ' || chptr[bptr] == '\n' || chptr[bptr] == '\r') // skip leading spaces and stuff
|
||||
bptr++;
|
||||
|
||||
while (chptr[bptr] != 0 && chptr[bptr] != '\n' && chptr[bptr] != '\r' && bptr < 255) // while current char is a letter
|
||||
{
|
||||
text[tptr] = chptr[bptr]; // add letter to text[]
|
||||
bptr++;
|
||||
tptr++;
|
||||
}
|
||||
text[tptr] = 0;
|
||||
chptr = chptr + bptr;
|
||||
return chptr; // return pointer to the end of this string
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Strcmp() without using Clib
|
||||
bool StrComp(char * string1, char * string2)
|
||||
{
|
||||
int ptr=0;
|
||||
|
||||
while (ToLowerCase(string1[ptr]) == ToLowerCase(string2[ptr])) // while the strings are the same, keep going
|
||||
{
|
||||
if (string1[ptr] == 0) // if they're the same and 0, they're identical null terminated strings
|
||||
return true;
|
||||
ptr++;
|
||||
}
|
||||
return false; // if not the same, they're... not the same
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Convert a char to lower case
|
||||
char ToLowerCase(char c)
|
||||
{
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
c += 32;
|
||||
return c;
|
||||
}
|
||||
188
gen_httpSrv_systray/gen_httpSrv_systray.dsp
Normal file
@@ -0,0 +1,188 @@
|
||||
# Microsoft Developer Studio Project File - Name="gen_httpSrv_systray" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=gen_httpSrv_systray - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "gen_httpSrv_systray.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "gen_httpSrv_systray.mak" CFG="gen_httpSrv_systray - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "gen_httpSrv_systray - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "gen_httpSrv_systray - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "gen_httpSrv_systray - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib winmm.lib comctl32.lib /nologo /subsystem:windows /machine:I386 /out:"Release/wawitray.exe"
|
||||
|
||||
!ELSEIF "$(CFG)" == "gen_httpSrv_systray - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib winmm.lib comctl32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"Debug/wawitray.exe" /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "gen_httpSrv_systray - Win32 Release"
|
||||
# Name "gen_httpSrv_systray - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\config.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\connection.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\main.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource1.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\title.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\main.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Images\auth2.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Images\next.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\next.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Images\pause.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\pause.ICO
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Images\play.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\play.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Images\prev.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\prev.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Images\SECUR08.ICO
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Images\server.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Images\stop.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\stop.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Images\Title.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Images\winamp.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
29
gen_httpSrv_systray/gen_httpSrv_systray.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "gen_httpSrv_systray"=.\gen_httpSrv_systray.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
333
gen_httpSrv_systray/main.cpp
Normal file
@@ -0,0 +1,333 @@
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "resource.h"
|
||||
|
||||
char szAppName[] = "Wawi Tray";
|
||||
char szWndClass[] = "WawiTrayApp";
|
||||
|
||||
char AboutText[] = "Winamp Web Interface\n\nRemote SysTray Client\n\n© 2002 Phil Himsworth\n\nWeb: http://www.flippet.org\nEmail: contact@flippet.net";
|
||||
|
||||
HINSTANCE inst = NULL;
|
||||
HWND hwnd = NULL;
|
||||
HWND ConfigWnd = NULL;
|
||||
HWND VolumeWnd = NULL;
|
||||
|
||||
UINT timer_id;
|
||||
|
||||
bool done = false;
|
||||
|
||||
char username[20];
|
||||
char password[20];
|
||||
char host[255];
|
||||
|
||||
char title[255];
|
||||
|
||||
bool use_auth = false;
|
||||
|
||||
int port;
|
||||
int default_action;
|
||||
int update_delay;
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
|
||||
inst = hInstance;
|
||||
|
||||
WNDCLASSEX wc;
|
||||
|
||||
wc.cbSize = sizeof(wc);
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = WndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = inst;
|
||||
wc.hIcon = NULL;
|
||||
wc.hCursor = NULL;
|
||||
wc.hbrBackground = (HBRUSH)COLOR_BACKGROUND;
|
||||
wc.lpszMenuName = NULL; //MAKEINTRESOURCE(IDR_MENU);
|
||||
wc.lpszClassName = szWndClass;
|
||||
wc.hIconSm = NULL;
|
||||
|
||||
if (RegisterClassEx(&wc)==0)
|
||||
MessageBox(NULL,"RegisterClassEx error!", szAppName,MB_OK);
|
||||
|
||||
|
||||
hwnd = CreateWindowEx( 0,
|
||||
szWndClass,
|
||||
szAppName,
|
||||
WS_CAPTION | WS_SYSMENU,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
200,
|
||||
100,
|
||||
NULL,
|
||||
NULL,
|
||||
inst,
|
||||
NULL);
|
||||
|
||||
|
||||
// Shows the window. Used only for message debugging
|
||||
//ShowWindow(hwnd,nShowCmd);
|
||||
|
||||
StartWinSock();
|
||||
|
||||
config_read();
|
||||
|
||||
int default_icon = GetIconID();
|
||||
|
||||
if (systray_add(hwnd,1030,LoadIcon(inst, MAKEINTRESOURCE(default_icon)),szAppName) == 0)
|
||||
MessageBox(hwnd,"systray_add error",szAppName,MB_OK);
|
||||
|
||||
/*
|
||||
UINT SetTimer(
|
||||
HWND hWnd, // handle of window for timer messages
|
||||
UINT nIDEvent, // timer identifier
|
||||
UINT uElapse, // time-out value
|
||||
TIMERPROC lpTimerFunc // address of timer procedure
|
||||
);
|
||||
*/
|
||||
|
||||
timer_id = SetTimer(hwnd,TIMER_ID,update_delay*1000,NULL);
|
||||
|
||||
|
||||
//HANDLE titlethread;
|
||||
//DWORD titlethread_id;
|
||||
|
||||
//titlethread = CreateThread(NULL,0,TitleThread,0,0,&titlethread_id);
|
||||
|
||||
MSG msg;
|
||||
ZeroMemory(&msg,sizeof(msg));
|
||||
|
||||
while(done == false)
|
||||
{
|
||||
GetMessage(&msg,hwnd,0,0);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
|
||||
systray_del(hwnd,1030);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
void SendDefaultAction()
|
||||
{
|
||||
switch(default_action)
|
||||
{
|
||||
case WA_PREV:
|
||||
WASend("/prev");
|
||||
break;
|
||||
case WA_PLAY:
|
||||
WASend("/play");
|
||||
break;
|
||||
case WA_PAUSE:
|
||||
WASend("/pause");
|
||||
break;
|
||||
case WA_STOP:
|
||||
WASend("/stop");
|
||||
break;
|
||||
case WA_NEXT:
|
||||
WASend("/next");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int GetIconID()
|
||||
{
|
||||
switch(default_action)
|
||||
{
|
||||
case WA_PREV:
|
||||
return IDI_PREV;
|
||||
break;
|
||||
case WA_PLAY:
|
||||
return IDI_PLAY;
|
||||
break;
|
||||
case WA_PAUSE:
|
||||
return IDI_PAUSE;
|
||||
break;
|
||||
case WA_STOP:
|
||||
return IDI_STOP;
|
||||
break;
|
||||
case WA_NEXT:
|
||||
return IDI_NEXT;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
UINT mousemsg;
|
||||
HMENU menu;
|
||||
char path[MAX_PATH];
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
done = true;
|
||||
break;
|
||||
|
||||
case WM_USER+3:
|
||||
mousemsg = (UINT)lParam;
|
||||
switch(mousemsg)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
SendDefaultAction();
|
||||
break;
|
||||
|
||||
case WM_RBUTTONDOWN:
|
||||
menu = GetSubMenu(LoadMenu(inst,MAKEINTRESOURCE(IDR_MENU)),0);
|
||||
POINT pt;
|
||||
GetCursorPos(&pt);
|
||||
SetForegroundWindow(hwnd);
|
||||
SetMenuItemBitmaps(menu,IDM_PREV,MF_BYCOMMAND,LoadBitmap(inst,MAKEINTRESOURCE(IDB_PREV)),NULL);
|
||||
SetMenuItemBitmaps(menu,IDM_PLAY,MF_BYCOMMAND,LoadBitmap(inst,MAKEINTRESOURCE(IDB_PLAY)),NULL);
|
||||
SetMenuItemBitmaps(menu,IDM_PAUSE,MF_BYCOMMAND,LoadBitmap(inst,MAKEINTRESOURCE(IDB_PAUSE)),NULL);
|
||||
SetMenuItemBitmaps(menu,IDM_STOP,MF_BYCOMMAND,LoadBitmap(inst,MAKEINTRESOURCE(IDB_STOP)),NULL);
|
||||
SetMenuItemBitmaps(menu,IDM_NEXT,MF_BYCOMMAND,LoadBitmap(inst,MAKEINTRESOURCE(IDB_NEXT)),NULL);
|
||||
|
||||
TrackPopupMenu(menu,0,pt.x,pt.y,0,hwnd,NULL);
|
||||
//SetMenuDefaultItem(menu,IDM_NEXT,FALSE);
|
||||
PostMessage(hwnd,WM_NULL,0,0);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDM_QUIT:
|
||||
done = true;
|
||||
DestroyWindow(hwnd);
|
||||
break;
|
||||
case IDM_ABOUT:
|
||||
MessageBox(hwnd,AboutText,szAppName,MB_OK | MB_ICONINFORMATION);
|
||||
break;
|
||||
case IDM_CONFIG:
|
||||
if (!ConfigWnd)
|
||||
{
|
||||
NewConfig();
|
||||
ConfigWnd = NULL;
|
||||
}
|
||||
else
|
||||
SetActiveWindow(ConfigWnd);
|
||||
break;
|
||||
|
||||
case IDM_VOLUME:
|
||||
if (!VolumeWnd)
|
||||
{
|
||||
DialogBox(inst,MAKEINTRESOURCE(IDD_VOLUME),hwnd,VolumeWndProc);
|
||||
VolumeWnd = NULL;
|
||||
}
|
||||
else
|
||||
SetActiveWindow(VolumeWnd);
|
||||
break;
|
||||
|
||||
case IDM_BROWSE:
|
||||
wsprintf(path,"http://%s:%d/winamp?page=browse",host,port);
|
||||
//MessageBox(hwnd,path,"Browse Path",MB_OK | MB_TOPMOST);
|
||||
ShellExecute(hwnd,"open",path,NULL,NULL,0);
|
||||
break;
|
||||
|
||||
case IDM_PLAYLIST:
|
||||
wsprintf(path,"http://%s:%d/winamp?page=list",host,port);
|
||||
//MessageBox(hwnd,path,"Browse Path",MB_OK | MB_TOPMOST);
|
||||
ShellExecute(hwnd,"open",path,NULL,NULL,0);
|
||||
break;
|
||||
|
||||
// Winamp Control Items
|
||||
case IDM_PREV:
|
||||
WASend("/prev");
|
||||
break;
|
||||
case IDM_PLAY:
|
||||
WASend("/play");
|
||||
break;
|
||||
case IDM_PAUSE:
|
||||
WASend("/pause");
|
||||
break;
|
||||
case IDM_STOP:
|
||||
WASend("/stop");
|
||||
break;
|
||||
case IDM_NEXT:
|
||||
WASend("/next");
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_TIMER:
|
||||
if ((UINT)wParam == timer_id)
|
||||
{
|
||||
MakeRequest(host,port,"/smalltitle",false,false,true);
|
||||
if (StrComp(title,""))
|
||||
wsprintf(title,"%s",szAppName);
|
||||
systray_modify(hwnd,1030,LoadIcon(inst, MAKEINTRESOURCE(GetIconID())),title);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return DefWindowProc(hwnd,uMsg,wParam,lParam);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int systray_modify(HWND hwnd, UINT uID, HICON hIcon, LPSTR lpszTip)
|
||||
{
|
||||
NOTIFYICONDATA tnid;
|
||||
tnid.cbSize = sizeof(NOTIFYICONDATA);
|
||||
tnid.hWnd = hwnd;
|
||||
tnid.uID = uID;
|
||||
tnid.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
|
||||
tnid.uCallbackMessage = WM_USER+3;
|
||||
tnid.hIcon = hIcon;
|
||||
lstrcpyn(tnid.szTip, lpszTip, sizeof(tnid.szTip)-1);
|
||||
return (Shell_NotifyIcon(NIM_MODIFY, &tnid));
|
||||
}
|
||||
|
||||
|
||||
|
||||
int systray_add(HWND hwnd, UINT uID, HICON hIcon, LPSTR lpszTip)
|
||||
{
|
||||
NOTIFYICONDATA tnid;
|
||||
tnid.cbSize = sizeof(NOTIFYICONDATA);
|
||||
tnid.hWnd = hwnd;
|
||||
tnid.uID = uID;
|
||||
tnid.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
|
||||
tnid.uCallbackMessage = WM_USER+3;
|
||||
tnid.hIcon = hIcon;
|
||||
lstrcpyn(tnid.szTip, lpszTip, sizeof(tnid.szTip)-1);
|
||||
return (Shell_NotifyIcon(NIM_ADD, &tnid));
|
||||
}
|
||||
|
||||
int systray_del(HWND hwnd, UINT uID)
|
||||
{
|
||||
NOTIFYICONDATA tnid;
|
||||
tnid.cbSize = sizeof(NOTIFYICONDATA);
|
||||
tnid.hWnd = hwnd;
|
||||
tnid.uID = uID;
|
||||
return (Shell_NotifyIcon(NIM_DELETE, &tnid));
|
||||
}
|
||||
61
gen_httpSrv_systray/main.h
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
// Winamp actions
|
||||
#define WA_PREV 101
|
||||
#define WA_PLAY 102
|
||||
#define WA_PAUSE 103
|
||||
#define WA_STOP 104
|
||||
#define WA_NEXT 105
|
||||
|
||||
#define RES_OK 201
|
||||
#define RES_AUTH 202
|
||||
#define RES_NOTFOUND 205
|
||||
#define RES_BADREQUEST 206
|
||||
#define RES_UNKNOWN 203
|
||||
#define RES_FAIL 204
|
||||
|
||||
#define TIMER_ID 30
|
||||
|
||||
|
||||
// config.cpp
|
||||
void NewConfig();
|
||||
BOOL CALLBACK ConfigServerWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL CALLBACK ConfigSystrayWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL CALLBACK ConfigAuthWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL CALLBACK ConfigAboutWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL CALLBACK ConfigWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam);
|
||||
void config_write();
|
||||
void config_read();
|
||||
BOOL CALLBACK VolumeWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam);
|
||||
|
||||
|
||||
|
||||
// connection.cpp
|
||||
bool StartWinSock();
|
||||
void prints(SOCKET socket, char * string);
|
||||
void printsi(SOCKET socket,int number);
|
||||
bool MakeRequest(char * host, int port, char * url, bool verbose, bool auth, bool gettitle);
|
||||
int WASend(char * command);
|
||||
void ToBase64(char * instr, char * outstr);
|
||||
int GetResponse(SOCKET socket, bool gettitle);
|
||||
char * GetAString(char* chptr, char* text);
|
||||
char * SkipHeader(char * chptr);
|
||||
char * GetALine(char * chptr, char * text);
|
||||
bool StrComp(char * string1, char * string2);
|
||||
char ToLowerCase(char c);
|
||||
|
||||
// main.cpp
|
||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow);
|
||||
|
||||
void SendDefaultAction();
|
||||
int GetIconID();
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
int systray_modify(HWND hwnd, UINT uID, HICON hIcon, LPSTR lpszTip);
|
||||
int systray_add(HWND hwnd, UINT uID, HICON hIcon, LPSTR lpszTip);
|
||||
int systray_del(HWND hwnd, UINT uID);
|
||||
|
||||
|
||||
// title.cpp
|
||||
DWORD WINAPI TitleThread(LPVOID param);
|
||||
BIN
gen_httpSrv_systray/next.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
gen_httpSrv_systray/pause.ICO
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
gen_httpSrv_systray/play.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
gen_httpSrv_systray/prev.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
67
gen_httpSrv_systray/resource.h
Normal file
@@ -0,0 +1,67 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by resource1.rc
|
||||
//
|
||||
#define IDABOUT 3
|
||||
#define IDI_ICON1 101
|
||||
#define IDI_NEXT 101
|
||||
#define IDI_ICON2 102
|
||||
#define IDI_PAUSE 102
|
||||
#define IDI_ICON3 103
|
||||
#define IDI_PLAY 103
|
||||
#define IDI_ICON4 104
|
||||
#define IDI_PREV 104
|
||||
#define IDI_ICON5 105
|
||||
#define IDI_STOP 105
|
||||
#define IDD_CONFIG 106
|
||||
#define IDR_MENU 107
|
||||
#define IDD_VOLUME 108
|
||||
#define IDB_STOP 109
|
||||
#define IDB_PAUSE 110
|
||||
#define IDB_PLAY 111
|
||||
#define IDB_PREV 112
|
||||
#define IDB_NEXT 113
|
||||
#define IDD_SERVER 114
|
||||
#define IDD_AUTH 115
|
||||
#define IDD_SYSTRAY 116
|
||||
#define IDD_ABOUT 117
|
||||
#define IDB_TITLE 119
|
||||
#define IDI_WINAMP 120
|
||||
#define IDI_SERVER 121
|
||||
#define IDI_AUTH 122
|
||||
#define IDI_AUTH2 123
|
||||
#define IDC_HOST 1001
|
||||
#define IDC_PORT 1002
|
||||
#define IDC_USERNAME 1003
|
||||
#define IDC_PASSWORD 1005
|
||||
#define IDC_VOLUME 1006
|
||||
#define IDC_DONE 1007
|
||||
#define IDC_DEF_PREV 1008
|
||||
#define IDC_DEF_PLAY 1009
|
||||
#define IDC_DEF_PAUSE 1010
|
||||
#define IDC_DEF_STOP 1011
|
||||
#define IDC_DEF_NEXT 1012
|
||||
#define IDC_UPDATEDELAY 1013
|
||||
#define IDC_AUTH 1014
|
||||
#define IDM_PREV 40001
|
||||
#define IDM_PLAY 40002
|
||||
#define IDM_PAUSE 40003
|
||||
#define IDM_STOP 40004
|
||||
#define IDM_NEXT 40005
|
||||
#define IDM_CONFIG 40006
|
||||
#define IDM_QUIT 40007
|
||||
#define IDM_ABOUT 40008
|
||||
#define IDM_VOLUME 40009
|
||||
#define IDM_PLAYLIST 40010
|
||||
#define IDM_BROWSE 40011
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 124
|
||||
#define _APS_NEXT_COMMAND_VALUE 40012
|
||||
#define _APS_NEXT_CONTROL_VALUE 1017
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
BIN
gen_httpSrv_systray/resource1.aps
Normal file
363
gen_httpSrv_systray/resource1.rc
Normal file
@@ -0,0 +1,363 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_PAUSE ICON DISCARDABLE "pause.ICO"
|
||||
IDI_PLAY ICON DISCARDABLE "play.ico"
|
||||
IDI_PREV ICON DISCARDABLE "prev.ico"
|
||||
IDI_STOP ICON DISCARDABLE "stop.ico"
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_MENU MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "Menu"
|
||||
BEGIN
|
||||
MENUITEM "&Config...", IDM_CONFIG
|
||||
MENUITEM "&Quit", IDM_QUIT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Music Collection...", IDM_BROWSE
|
||||
MENUITEM "Playlist...", IDM_PLAYLIST
|
||||
MENUITEM "Volume...", IDM_VOLUME
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "P&revious Track", IDM_PREV
|
||||
MENUITEM "&Play", IDM_PLAY
|
||||
MENUITEM "Pa&use", IDM_PAUSE
|
||||
MENUITEM "&Stop", IDM_STOP
|
||||
MENUITEM "&Next Track", IDM_NEXT
|
||||
END
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.K.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_NEXT ICON DISCARDABLE "next.ico"
|
||||
IDI_WINAMP ICON DISCARDABLE "Images\\winamp.ico"
|
||||
IDI_SERVER ICON DISCARDABLE "Images\\server.ico"
|
||||
IDI_AUTH ICON DISCARDABLE "Images\\SECUR08.ICO"
|
||||
IDI_AUTH2 ICON DISCARDABLE "images\\auth2.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_CONFIG DIALOGEX 0, 0, 286, 212
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Winamp HTTP Server Systray Client Config"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,229,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,229,39,50,14
|
||||
PUSHBUTTON "About",IDABOUT,229,23,50,14
|
||||
GROUPBOX "Remote Winamp Properties",IDC_STATIC,7,7,218,43
|
||||
EDITTEXT IDC_HOST,13,29,98,12,ES_AUTOHSCROLL | NOT WS_BORDER,
|
||||
WS_EX_STATICEDGE
|
||||
EDITTEXT IDC_PORT,120,29,35,12,ES_AUTOHSCROLL | ES_NUMBER | NOT
|
||||
WS_BORDER,WS_EX_STATICEDGE
|
||||
LTEXT "Remote Computer",IDC_STATIC,13,19,72,9
|
||||
LTEXT "Port",IDC_STATIC,120,19,24,9
|
||||
EDITTEXT IDC_USERNAME,13,75,98,12,ES_AUTOHSCROLL | NOT WS_BORDER,
|
||||
WS_EX_STATICEDGE
|
||||
EDITTEXT IDC_PASSWORD,120,75,98,12,ES_PASSWORD | ES_AUTOHSCROLL |
|
||||
NOT WS_BORDER,WS_EX_STATICEDGE
|
||||
LTEXT "Username",IDC_STATIC,13,65,59,8
|
||||
LTEXT "Password",IDC_STATIC,120,65,50,8
|
||||
GROUPBOX "Systray Settings",IDC_STATIC,7,97,218,65
|
||||
CONTROL "Previous",IDC_DEF_PREV,"Button",BS_AUTORADIOBUTTON,15,
|
||||
122,45,10
|
||||
CONTROL "Play",IDC_DEF_PLAY,"Button",BS_AUTORADIOBUTTON,15,132,
|
||||
50,10
|
||||
CONTROL "Pause",IDC_DEF_PAUSE,"Button",BS_AUTORADIOBUTTON,71,122,
|
||||
50,10
|
||||
CONTROL "Stop",IDC_DEF_STOP,"Button",BS_AUTORADIOBUTTON,71,132,
|
||||
45,10
|
||||
CONTROL "Next",IDC_DEF_NEXT,"Button",BS_AUTORADIOBUTTON,131,122,
|
||||
50,10
|
||||
LTEXT "Default Action (single click on tray icon)",IDC_STATIC,
|
||||
16,109,140,10
|
||||
EDITTEXT IDC_UPDATEDELAY,120,145,35,12,ES_AUTOHSCROLL | ES_NUMBER |
|
||||
NOT WS_BORDER,WS_EX_STATICEDGE
|
||||
RTEXT "Tooltip update delay (s)",IDC_STATIC,39,147,75,10
|
||||
GROUPBOX "Authentication",IDC_STATIC,7,53,218,44
|
||||
END
|
||||
|
||||
IDD_VOLUME DIALOGEX 0, 0, 46, 95
|
||||
STYLE DS_SYSMODAL | DS_SETFOREGROUND | WS_POPUP | WS_CAPTION
|
||||
EXSTYLE WS_EX_TOOLWINDOW
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Slider1",IDC_VOLUME,"msctls_trackbar32",TBS_AUTOTICKS |
|
||||
TBS_VERT | TBS_TOP | WS_TABSTOP,20,5,20,70
|
||||
PUSHBUTTON "Done",IDC_DONE,8,80,27,10
|
||||
LTEXT "100%",IDC_STATIC,1,9,18,10
|
||||
LTEXT "0%",IDC_STATIC,9,64,10,10
|
||||
END
|
||||
|
||||
IDD_SERVER DIALOGEX 0, 0, 220, 129
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
GROUPBOX "Winamp Server",IDC_STATIC,7,7,206,54
|
||||
EDITTEXT IDC_HOST,13,29,118,12,ES_AUTOHSCROLL | NOT WS_BORDER,
|
||||
WS_EX_STATICEDGE
|
||||
EDITTEXT IDC_PORT,141,29,35,12,ES_AUTOHSCROLL | ES_NUMBER | NOT
|
||||
WS_BORDER,WS_EX_STATICEDGE
|
||||
LTEXT "Remote Computer IP Address",IDC_STATIC,13,19,100,9
|
||||
LTEXT "Port",IDC_STATIC,141,19,24,9
|
||||
END
|
||||
|
||||
IDD_AUTH DIALOGEX 0, 0, 220, 129
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT IDC_USERNAME,13,44,86,12,ES_AUTOHSCROLL | NOT WS_BORDER,
|
||||
WS_EX_STATICEDGE
|
||||
EDITTEXT IDC_PASSWORD,107,44,98,12,ES_PASSWORD | ES_AUTOHSCROLL |
|
||||
NOT WS_BORDER,WS_EX_STATICEDGE
|
||||
LTEXT "Username",IDC_STATIC,13,33,59,8
|
||||
LTEXT "Password",IDC_STATIC,107,33,50,8
|
||||
GROUPBOX "Authentication",IDC_STATIC,7,7,206,58
|
||||
CONTROL "Use Authentication",IDC_AUTH,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,14,19,165,11
|
||||
END
|
||||
|
||||
IDD_SYSTRAY DIALOGEX 0, 0, 220, 129
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
GROUPBOX "Systray Settings",IDC_STATIC,7,7,206,70
|
||||
CONTROL "Previous",IDC_DEF_PREV,"Button",BS_AUTORADIOBUTTON,26,
|
||||
34,45,10
|
||||
CONTROL "Play",IDC_DEF_PLAY,"Button",BS_AUTORADIOBUTTON,26,44,50,
|
||||
10
|
||||
CONTROL "Pause",IDC_DEF_PAUSE,"Button",BS_AUTORADIOBUTTON,90,34,
|
||||
50,10
|
||||
CONTROL "Stop",IDC_DEF_STOP,"Button",BS_AUTORADIOBUTTON,90,44,45,
|
||||
10
|
||||
CONTROL "Next",IDC_DEF_NEXT,"Button",BS_AUTORADIOBUTTON,151,34,
|
||||
50,10
|
||||
LTEXT "Default Action (single click on tray icon)",IDC_STATIC,
|
||||
16,21,140,10
|
||||
EDITTEXT IDC_UPDATEDELAY,120,57,35,12,ES_AUTOHSCROLL | ES_NUMBER |
|
||||
NOT WS_BORDER,WS_EX_STATICEDGE
|
||||
RTEXT "Tooltip update delay (s)",IDC_STATIC,39,59,75,10
|
||||
END
|
||||
|
||||
IDD_ABOUT DIALOG DISCARDABLE 0, 0, 220, 129
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL 119,IDC_STATIC,"Static",SS_BITMAP,7,7,20,20
|
||||
CTEXT "Wawi Remote Systray Thingy\n\nPhil Himsworth, 2002\nhttp://www.flippet.org || contact@flippet.net",
|
||||
IDC_STATIC,7,81,206,34
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_CONFIG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 279
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 205
|
||||
END
|
||||
|
||||
IDD_VOLUME, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 39
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 88
|
||||
END
|
||||
|
||||
IDD_SERVER, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 213
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 122
|
||||
END
|
||||
|
||||
IDD_AUTH, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 213
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 122
|
||||
END
|
||||
|
||||
IDD_SYSTRAY, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 213
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 122
|
||||
END
|
||||
|
||||
IDD_ABOUT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 213
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 122
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,1,0,1
|
||||
PRODUCTVERSION 2,1,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "080904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "Remote Systray Applet for the Winamp Web Interface Plugin\0"
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "WawiTray\0"
|
||||
VALUE "FileVersion", "2, 1, 0, 1\0"
|
||||
VALUE "InternalName", "WawiTray\0"
|
||||
VALUE "LegalCopyright", "Copyright © 2002 Phil Himsworth\0"
|
||||
VALUE "LegalTrademarks", "It's mine, dammit, MINE!!!\0"
|
||||
VALUE "OriginalFilename", "WawiTray.exe\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "WawiTray\0"
|
||||
VALUE "ProductVersion", "2, 1, 0, 1\0"
|
||||
VALUE "SpecialBuild", "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x809, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_STOP BITMAP DISCARDABLE "Images\\stop.bmp"
|
||||
IDB_PAUSE BITMAP DISCARDABLE "Images\\pause.bmp"
|
||||
IDB_PLAY BITMAP DISCARDABLE "Images\\play.bmp"
|
||||
IDB_PREV BITMAP DISCARDABLE "Images\\prev.bmp"
|
||||
IDB_NEXT BITMAP DISCARDABLE "Images\\next.bmp"
|
||||
IDB_TITLE BITMAP DISCARDABLE "Images\\Title.bmp"
|
||||
#endif // English (U.K.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
BIN
gen_httpSrv_systray/stop.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
32
gen_httpSrv_systray/title.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
extern HINSTANCE inst;
|
||||
extern HWND hwnd;
|
||||
|
||||
extern char host[255], username[20], password[20], title[255];
|
||||
extern int port, default_action, update_delay;
|
||||
|
||||
extern char szAppName[], AboutText[];
|
||||
|
||||
extern HWND ConfigWnd, VolumeWnd;
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Thread to update title in systray tooltip
|
||||
DWORD WINAPI TitleThread(LPVOID param)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
MakeRequest(host,port,"/smalltitle",false,false,true);
|
||||
if (StrComp(title,""))
|
||||
wsprintf(title,"%s",szAppName);
|
||||
systray_modify(hwnd,1030,LoadIcon(inst, MAKEINTRESOURCE(GetIconID())),title);
|
||||
//MessageBox(hwnd,title,"Title",MB_OK | MB_TOPMOST);
|
||||
Sleep(update_delay*1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||