|
Trouver une ressource
Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !
CHAINE RADIO/TV
Information sur la source
Description
Chaine RADIO/TV est un petit programme qui liste un certain nombre de chaîne radio/TV cliquez sur un mon et le lecteur multimédias par défaut (qui lit le m3u) s'ouvre avec la chaîne désiré (les chaînes son modifiable dans le config.cfg) Attention un point importent : dans le config.cfg la syntaxe est la suivant . [VIDE] //une ligne du listbox vide [TITRE]=Le titre; //les deux suivent doive être toujours ensemble [CHAINE]=Nom de la chaine; [URL]=Url de la page; exemple: [TITRE]= «»«»«»«»«]TV[»«»«»«»«»; [VIDE] [CHAINE]=[!] TF1; [URL]=mms://a889.l4162624888.c41626.e.lm.akamaistream.net/D/889/41626/v0001/reflector:24888;
Source
- #include <windows.h>
- #include <fstream>
- #include <vector>
- #define IDB_BUTTON 0X0ff
- #define IDM_HELP 0x1ff
- #define IDM_APROPO 0x2ff
- #define WM_ICONE 0x3fff
- HWND hButton,hButtont;
- using namespace std;
-
- /* Declare Windows procedure */
- const HBRUSH hCouleur_blue = CreateSolidBrush(RGB(200,200,255));
- LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
- HINSTANCE Inst;
- ifstream fStr;
- string sCint,sTempo,sTempo2;
- int a,infoSelect,infomom;
- int nbChaine=0;
- vector<std::string> vLien;
- HMENU hMenu,jmenupopup;
- HBITMAP fond;
- HRGN Rgn;
- POINT point;
- const char* ccNULL="NULL";
- const char* ccCHAINE="[CHAINE]";
- const char* ccTITRE="[TITRE]";
- const char* ccVIDE="[VIDE]";
- const char* ccURL="[URL]";
- const char* ccECPACE=" ";
- /* Make the class name into a global variable */
- char szClassName[ ] = "Chaine RADIO/TV";
-
- void error(std::string);
- BOOL Deleticone(HWND fen);
- DWORD WINAPI add_icone(HWND fen,char *infobulle);
-
-
-
- int WINAPI WinMain (HINSTANCE hThisInstance,
- HINSTANCE hPrevInstance,
- LPSTR lpszArgument,
- int nFunsterStil)
-
- {
- Inst=hThisInstance;
- HWND hwnd; /* This is the handle for our window */
- MSG messages; /* Here messages to the application are saved */
- WNDCLASSEX wincl; /* Data structure for the windowclass */
-
- /* The Window structure */
- wincl.hInstance = hThisInstance;
- wincl.lpszClassName = szClassName;
- wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
- wincl.style = CS_DBLCLKS; /* Catch double-clicks */
- wincl.cbSize = sizeof (WNDCLASSEX);
-
- /* Use default icon and mouse-pointer */
- wincl.hIcon = LoadIcon (hThisInstance, "A");
- wincl.hIconSm = LoadIcon (hThisInstance, "A");
- wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
- wincl.lpszMenuName = NULL; /* No menu */
- wincl.cbClsExtra = 0; /* No extra bytes after the window class */
- wincl.cbWndExtra = 0; /* structure or the window instance */
- /* Use Windows's default color as the background of the window */
- wincl.hbrBackground = (HBRUSH) hCouleur_blue;
-
- /* Register the window class, and if it fails quit the program */
- if (!RegisterClassEx (&wincl))
- return 0;
-
- /* The class is registered, let's create the program*/
- hwnd = CreateWindowEx (
- WS_EX_CLIENTEDGE|WS_EX_TOPMOST, /* Extended possibilites for variation */
- szClassName, /* Classname */
- "Chaine RADIO/TV", /* Title Text */
- WS_VISIBLE|WS_SYSMENU, /* default window */
- CW_USEDEFAULT, /* Windows decides the position */
- CW_USEDEFAULT, /* where the window ends up on the screen */
- 190, /* The programs width */
- 275, /* and height in pixels */
- HWND_DESKTOP, /* The window is a child-window to desktop */
- NULL, /* No menu */
- hThisInstance, /* Program Instance handler */
- NULL /* No Window Creation data */
- );
-
- /* Make the window visible on the screen */
- ShowWindow (hwnd, nFunsterStil);
-
-
- // Création du menu ------------------------------------------------------------
- hMenu = CreateMenu();
- hMenuPopup = CreateMenu();
- AppendMenu (hMenuPopup , MF_SEPARATOR, 0 ,NULL);
- AppendMenu (hMenuPopup , MF_STRING, WM_DESTROY , "&Quitter");
- AppendMenu (hMenu, MF_POPUP,(UINT)(hMenuPopup), "&Fichier");
- hMenuPopup = CreateMenu();
- AppendMenu (hMenuPopup , MF_STRING, IDM_APROPO ,"&A Propos");
- AppendMenu (hMenuPopup , MF_STRING, IDM_HELP ,"A&ide");
- AppendMenu (hMenu, MF_POPUP,(UINT)(hMenuPopup), "&Aide");
- hMenuPopup = CreateMenu();
- //afficher le menu
- SetMenu(hwnd, hMenu);
- /* Run the message loop. It will run until GetMessage() returns 0 */
- while (GetMessage (&messages, NULL, 0, 0))
- {
- /* Translate virtual-key messages into character messages */
- TranslateMessage(&messages);
- /* Send message to WindowProcedure */
- DispatchMessage(&messages);
- }
-
- /* The program return-value is 0 - The value that PostQuitMessage() gave */
- return messages.wParam;
- }
-
-
- /* This function is called by the Windows function DispatchMessage() */
-
- LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- switch (message) /* handle the messages */
- {
- case WM_CREATE :
-
- hButton=CreateWindowEx(0, "LISTBOX", "",
- WS_CHILD | WS_VISIBLE | LBS_STANDARD , //création d'un liste box
- 0,0,180,230,hwnd, (HMENU)0X0ff ,
- Inst, NULL);
- fStr.open("config.cfg", fstream::in);//ouverture du fichier config
- if(fStr)//si le fichier existe
- {
-
- while(getline(fStr, sCint) )//on le lit ligne par ligne
- {
- reteste :
- if(sCint.length()!=0)//si la ligne a quelque chose
- {
- if(sCint.substr(0,8)==ccCHAINE)
- {
- a=sCint.find_first_of('=')+1; //on cherche le premier =
- sTempo="\0";//on vide sTempo
- while((sCint[a]==';')==false)
- {
- sTempo+=sCint[a];
- a++;
- }
- //on écri le nom dans le listbox
- SendMessage(hButton,LB_INSERTSTRING,nbChaine,(LPARAM) (LPCTSTR)sTempo.c_str());
- nbChaine++;
- }
-
- if(sCint.substr(0,7)==ccTITRE)
- {
- a=sCint.find_first_of('=')+1;
- sTempo="\0";
- while((sCint[a]==';')==false)
- {
- sTempo+=sCint[a];
- a++;
- }
- SendMessage(hButton,LB_INSERTSTRING,nbChaine,(LPARAM) (LPCTSTR)sTempo.c_str());
- nbChaine++;
- vLien.push_back(ccNULL);
- }
-
- if(sCint.substr(0,6)==ccVIDE)
- {
- SendMessage(hButton,LB_INSERTSTRING,nbChaine,(LPARAM) (LPCTSTR)"");
- nbChaine++;
- vLien.push_back(ccNULL);
- }
-
- if(sCint.substr(0,5)==ccURL)
- {
- a=sCint.find_first_of('=')+1;
- sTempo2="\0";
- while((sCint[a]==';')==false)
- {
- sTempo2+=sCint[a];
- a++;
- }
- vLien.push_back(sTempo2);
- }
-
- if(sCint.substr(0,1)==ccECPACE)
- {
- sCint.erase(0,1);
- goto reteste;
- }
-
- }
- }
- if(!nbChaine)
- {
- error("config.cfg est vide");
- }
- }
- else
- {
- error("Impossible d'ouvrire config.cfg");
- }
- fStr.close();
- SendMessage(hButton,LB_SETCURSEL ,(WPARAM)0,0);
-
- break;
-
-
- case WM_COMMAND :
- {
- switch (LOWORD(wParam))
- {
- case IDB_BUTTON :
- infoSelect = SendMessage(hButton,LB_GETCURSEL,0,0);
- if(infoSelect==infomom)
- {break;}
- else
- {infomom=infoSelect;}
- if(vLien[infoSelect].compare(ccNULL)==1)
- {
- Sleep(300);
- ofstream fichier("TV.m3u");
- fichier<<vLien[infoSelect];
- fichier.close();
- ShellExecute(NULL,"open","TV.m3u",0,0,0);
-
- }
- break;
- case IDM_APROPO:
- MessageBox(NULL,"\nNom : Chaine RADIO/TV\nVersion N° 0.9.5\nCréateur : Andrey Galen\n\nAF(R)",
- "Chaine N°0.9.5",MB_OK);
- break;
- case IDM_HELP:
- MessageBox(NULL,"[!] = Source pas sur. (Peut ne pas diffuser)\n[-] = Source sur. (Diffuse no-stop)"
- "\n\nPour quitter le programme fair Fichier\\Quitter ou Double click droit quitte"
- " quand le programme est dans la bar des taches.",
- "Help",MB_OK);
- break;
- case WM_DESTROY:
- SendMessage(hwnd,WM_DESTROY,0,0);
- break;
-
-
- }
- }break;
-
- case WM_ICONE :
- if(lParam == WM_LBUTTONDOWN)
- {
- ShowWindow (hwnd, SW_SHOW);
- Deleticone(hwnd);
- }
- if(lParam == WM_RBUTTONDBLCLK)
- {
- Deleticone(hwnd);
- SendMessage(hwnd,WM_DESTROY,0,0);
- }
- break;
-
- break;
- case WM_CLOSE :
- ShowWindow (hwnd, SW_HIDE);
- add_icone(hwnd,"Chaine RADIO/TV\nClick gauche restore\nDouble click droit quitte");
- return 0;
- case WM_DESTROY:
- PostQuitMessage (0); /* send a WM_QUIT to the message queue */
-
- break;
-
-
- }
-
- return DefWindowProc (hwnd, message, wParam, lParam);
- }
-
- void error(std::string error)
- {
- MessageBox(NULL,error.c_str(),0,MB_OK);
- exit(0);
- }
-
- DWORD WINAPI add_icone(HWND fen,char *infobulle)
- //fen est la fenetre "mere"
- //infobulle est le texte qui s'affiche quand on passe dessus l'icone avec la souris .
- {
-
- NOTIFYICONDATA tnid;
- tnid.cbSize = sizeof(NOTIFYICONDATA);
-
- tnid.hWnd = fen;
-
- tnid.uID = 2;
- tnid.uFlags =NIF_MESSAGE|NIF_TIP|NIF_ICON ;
- tnid.uCallbackMessage = WM_ICONE;
- tnid.hIcon = LoadIcon(Inst,"A" );
- if (infobulle)
- lstrcpyn(tnid.szTip, infobulle, sizeof(tnid.szTip));
- else
- tnid.szTip[0]='\0';
- Shell_NotifyIcon(NIM_ADD, &tnid);
- return 0;
- }
-
-
- BOOL Deleticone(HWND fen)
- // fen est la fenetre "mere" de cette icone
- {
- BOOL res;
- NOTIFYICONDATA tnid;
-
- tnid.cbSize = sizeof(NOTIFYICONDATA);
- tnid.hWnd = fen;
- tnid.uID =2;
-
- res = Shell_NotifyIcon(NIM_DELETE, &tnid);
- return res;
- }
#include <windows.h>
#include <fstream>
#include <vector>
#define IDB_BUTTON 0X0ff
#define IDM_HELP 0x1ff
#define IDM_APROPO 0x2ff
#define WM_ICONE 0x3fff
HWND hButton,hButtont;
using namespace std;
/* Declare Windows procedure */
const HBRUSH hCouleur_blue = CreateSolidBrush(RGB(200,200,255));
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
HINSTANCE Inst;
ifstream fStr;
string sCint,sTempo,sTempo2;
int a,infoSelect,infomom;
int nbChaine=0;
vector<std::string> vLien;
HMENU hMenu,jmenupopup;
HBITMAP fond;
HRGN Rgn;
POINT point;
const char* ccNULL="NULL";
const char* ccCHAINE="[CHAINE]";
const char* ccTITRE="[TITRE]";
const char* ccVIDE="[VIDE]";
const char* ccURL="[URL]";
const char* ccECPACE=" ";
/* Make the class name into a global variable */
char szClassName[ ] = "Chaine RADIO/TV";
void error(std::string);
BOOL Deleticone(HWND fen);
DWORD WINAPI add_icone(HWND fen,char *infobulle);
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
Inst=hThisInstance;
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */
/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon (hThisInstance, "A");
wincl.hIconSm = LoadIcon (hThisInstance, "A");
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after the window class */
wincl.cbWndExtra = 0; /* structure or the window instance */
/* Use Windows's default color as the background of the window */
wincl.hbrBackground = (HBRUSH) hCouleur_blue;
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;
/* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
WS_EX_CLIENTEDGE|WS_EX_TOPMOST, /* Extended possibilites for variation */
szClassName, /* Classname */
"Chaine RADIO/TV", /* Title Text */
WS_VISIBLE|WS_SYSMENU, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
190, /* The programs width */
275, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
/* Make the window visible on the screen */
ShowWindow (hwnd, nFunsterStil);
// Création du menu ------------------------------------------------------------
hMenu = CreateMenu();
hMenuPopup = CreateMenu();
AppendMenu (hMenuPopup , MF_SEPARATOR, 0 ,NULL);
AppendMenu (hMenuPopup , MF_STRING, WM_DESTROY , "&Quitter");
AppendMenu (hMenu, MF_POPUP,(UINT)(hMenuPopup), "&Fichier");
hMenuPopup = CreateMenu();
AppendMenu (hMenuPopup , MF_STRING, IDM_APROPO ,"&A Propos");
AppendMenu (hMenuPopup , MF_STRING, IDM_HELP ,"A&ide");
AppendMenu (hMenu, MF_POPUP,(UINT)(hMenuPopup), "&Aide");
hMenuPopup = CreateMenu();
//afficher le menu
SetMenu(hwnd, hMenu);
/* Run the message loop. It will run until GetMessage() returns 0 */
while (GetMessage (&messages, NULL, 0, 0))
{
/* Translate virtual-key messages into character messages */
TranslateMessage(&messages);
/* Send message to WindowProcedure */
DispatchMessage(&messages);
}
/* The program return-value is 0 - The value that PostQuitMessage() gave */
return messages.wParam;
}
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) /* handle the messages */
{
case WM_CREATE :
hButton=CreateWindowEx(0, "LISTBOX", "",
WS_CHILD | WS_VISIBLE | LBS_STANDARD , //création d'un liste box
0,0,180,230,hwnd, (HMENU)0X0ff ,
Inst, NULL);
fStr.open("config.cfg", fstream::in);//ouverture du fichier config
if(fStr)//si le fichier existe
{
while(getline(fStr, sCint) )//on le lit ligne par ligne
{
reteste :
if(sCint.length()!=0)//si la ligne a quelque chose
{
if(sCint.substr(0,8)==ccCHAINE)
{
a=sCint.find_first_of('=')+1; //on cherche le premier =
sTempo="\0";//on vide sTempo
while((sCint[a]==';')==false)
{
sTempo+=sCint[a];
a++;
}
//on écri le nom dans le listbox
SendMessage(hButton,LB_INSERTSTRING,nbChaine,(LPARAM) (LPCTSTR)sTempo.c_str());
nbChaine++;
}
if(sCint.substr(0,7)==ccTITRE)
{
a=sCint.find_first_of('=')+1;
sTempo="\0";
while((sCint[a]==';')==false)
{
sTempo+=sCint[a];
a++;
}
SendMessage(hButton,LB_INSERTSTRING,nbChaine,(LPARAM) (LPCTSTR)sTempo.c_str());
nbChaine++;
vLien.push_back(ccNULL);
}
if(sCint.substr(0,6)==ccVIDE)
{
SendMessage(hButton,LB_INSERTSTRING,nbChaine,(LPARAM) (LPCTSTR)"");
nbChaine++;
vLien.push_back(ccNULL);
}
if(sCint.substr(0,5)==ccURL)
{
a=sCint.find_first_of('=')+1;
sTempo2="\0";
while((sCint[a]==';')==false)
{
sTempo2+=sCint[a];
a++;
}
vLien.push_back(sTempo2);
}
if(sCint.substr(0,1)==ccECPACE)
{
sCint.erase(0,1);
goto reteste;
}
}
}
if(!nbChaine)
{
error("config.cfg est vide");
}
}
else
{
error("Impossible d'ouvrire config.cfg");
}
fStr.close();
SendMessage(hButton,LB_SETCURSEL ,(WPARAM)0,0);
break;
case WM_COMMAND :
{
switch (LOWORD(wParam))
{
case IDB_BUTTON :
infoSelect = SendMessage(hButton,LB_GETCURSEL,0,0);
if(infoSelect==infomom)
{break;}
else
{infomom=infoSelect;}
if(vLien[infoSelect].compare(ccNULL)==1)
{
Sleep(300);
ofstream fichier("TV.m3u");
fichier<<vLien[infoSelect];
fichier.close();
ShellExecute(NULL,"open","TV.m3u",0,0,0);
}
break;
case IDM_APROPO:
MessageBox(NULL,"\nNom : Chaine RADIO/TV\nVersion N° 0.9.5\nCréateur : Andrey Galen\n\nAF(R)",
"Chaine N°0.9.5",MB_OK);
break;
case IDM_HELP:
MessageBox(NULL,"[!] = Source pas sur. (Peut ne pas diffuser)\n[-] = Source sur. (Diffuse no-stop)"
"\n\nPour quitter le programme fair Fichier\\Quitter ou Double click droit quitte"
" quand le programme est dans la bar des taches.",
"Help",MB_OK);
break;
case WM_DESTROY:
SendMessage(hwnd,WM_DESTROY,0,0);
break;
}
}break;
case WM_ICONE :
if(lParam == WM_LBUTTONDOWN)
{
ShowWindow (hwnd, SW_SHOW);
Deleticone(hwnd);
}
if(lParam == WM_RBUTTONDBLCLK)
{
Deleticone(hwnd);
SendMessage(hwnd,WM_DESTROY,0,0);
}
break;
break;
case WM_CLOSE :
ShowWindow (hwnd, SW_HIDE);
add_icone(hwnd,"Chaine RADIO/TV\nClick gauche restore\nDouble click droit quitte");
return 0;
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
break;
}
return DefWindowProc (hwnd, message, wParam, lParam);
}
void error(std::string error)
{
MessageBox(NULL,error.c_str(),0,MB_OK);
exit(0);
}
DWORD WINAPI add_icone(HWND fen,char *infobulle)
//fen est la fenetre "mere"
//infobulle est le texte qui s'affiche quand on passe dessus l'icone avec la souris .
{
NOTIFYICONDATA tnid;
tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hWnd = fen;
tnid.uID = 2;
tnid.uFlags =NIF_MESSAGE|NIF_TIP|NIF_ICON ;
tnid.uCallbackMessage = WM_ICONE;
tnid.hIcon = LoadIcon(Inst,"A" );
if (infobulle)
lstrcpyn(tnid.szTip, infobulle, sizeof(tnid.szTip));
else
tnid.szTip[0]='\0';
Shell_NotifyIcon(NIM_ADD, &tnid);
return 0;
}
BOOL Deleticone(HWND fen)
// fen est la fenetre "mere" de cette icone
{
BOOL res;
NOTIFYICONDATA tnid;
tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hWnd = fen;
tnid.uID =2;
res = Shell_NotifyIcon(NIM_DELETE, &tnid);
return res;
}
Fichier Zip
Historique
- 23 août 2008 22:57:07 :
- enlever le zip pour une mise à jour en rapport avec les commentaires
- 24 août 2008 20:19:24 :
- amélioration du traitement du fichier config.cfg
Sources du même auteur
Sources de la même categorie
Sources en rapport avec celle ci
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
VECTOR VECTOR VECTOR VECTOR !!!!!! [ par Kinamstrong ]
Salut,j'ai une classe Inscrit et une classe Liste Inscrit et je voudrai utiliser Inscrit comme tyde vecteur et ListeInscrit emploiereai cette classe
boutons radio [ par Xs ]
salut !j'ai appris a manier les check-box, c'est pas compliqué. maintenant, j'aimerais savoir utiliser les bouton-radio.comment on les utilise ? je pe
bouton radio [ par Xs ]
alors, j'utilise VC++ avec les ressources.je veux savoir comment faire pour controler des radio. c'est a dire : quand je selectionne le bouton-radio I
Radio Button - VC++6 [ par DivXPVobD ]
Bonjour, Voila mon probleme, je travaille sans les MFC et dans une de mes boites de dialogues j'ai des radios button et je souhaiterais simuler le
Check-box Radio-button [ par BsEtZeOpLhD ]
Salut.Je suis un débutant en api windows et j'aimerai savoir comment on utilise les Check-box et le Radio-button.J'utilise VC++.Merci.
Liste chainée en C++ sans STL (ni vector ni template) [ par Tamahome ]
Bonjour,je cherche un exemple de liste chainée (sans STL: ni vector ni template) enC++ (pas en C) permettant de chainer des objets héterogenes (par ex
vector [ par borgeomi ]
borgeomibonjouuuuuuur !!!!!j'ai crée un vectorstruct enregistrement {string zone_date;string zone_montant;string zone_nom;};typedef vector<enregist
Bus I2C [ par Kheo ]
Comment lire et ecrire une eeprom d'une carte TV via son bus I2C ? ( afin de corriger l'altération des eeprom des cartes TV Pinnacle PCTV Rave )/ Kheo
Pb vector de vector de char ! [ par nicolas66 ]
Ben g un pti pb avec ce prog en Cpp, à la compile ca passe mé à l'execution ca plante !! si vous savé pk merci d'avance !(c censé initialisé un buffer
méthode virtuelle et std::vector [ par tch0utch0u2 ]
Bonjour,J'ai un vector STL déclarer comme suit:vector<ClasseDeBase> m_vElement;auquel j'ajoute successivement des objets de classesderivées de C
|
Téléchargements
Logiciels à télécharger sur le même thème :
Comparez les prix Nouvelle version

LG KP501
Entre 9€ et 159€
|