-
-
/* FICHIERS */
-
a[href $=‘.pdf’] { padding-left: 22px; background: transparent url(img/pdf.png) no-repeat center left;}
-
a[href $=‘.gif’] { padding-left: 22px; background: transparent url(img/image.png) no-repeat center left;}
-
a[href $=‘.png’] { padding-left: 22px; background: transparent url(img/image.png) no-repeat center left;}
-
a[href $=‘.jpg’] { padding-left: 22px; background: transparent url(img/image.png) no-repeat center left;}
-
a[href $=‘.doc’] { padding-left: 22px; background: transparent url(img/word.png) no-repeat center left;}
-
a[href $=‘.xls’] { padding-left: 22px; background: transparent url(img/excel.png) no-repeat center left;}
-
a[href $=‘.css’] { padding-left: 22px; background: transparent url(img/texte.png) no-repeat center left;}
-
a[href $=‘.txt’] { padding-left: 22px; background: transparent url(img/texte.png) no-repeat center left;}
-
a[href $=‘.php’] { padding-left: 22px; background: transparent url(img/php.png) no-repeat center left;}
-
a[href $=‘.zip’] { padding-left: 22px; background: transparent url(img/compress.png) no-repeat center left;}
-
a[href $=‘.rar’] { padding-left: 22px; background: transparent url(img/compress.png) no-repeat center left;}
-
a[href $=‘.tar.gz’] { padding-left: 22px; background: transparent url(img/package.png) no-repeat center left;}
-
a[href $=‘.pkg.gz’] { padding-left: 22px; background: transparent url(img/package.png) no-repeat center left;}
-
/* PROTOCOLES IM */
-
a[href ^=“aim:”] { padding-left: 22px; background: transparent url(img/aim.png) no-repeat center left;}
-
a[href ^=“msnim:”] { padding-left: 22px; background: transparent url(img/msn.png) no-repeat center left;}
-
a[href ^=“xmpp:”] { padding-left: 22px; background: transparent url(img/jabber.png) no-repeat center left;}
-
a[href *=“icq.com”] { padding-left: 22px; background: transparent url(img/icq.gif) no-repeat center left;}
-
a[href *=“edit.yahoo.com/config/send_webmesg?”] { padding-left: 22px; background: transparent url(img/yahoo.gif) no-repeat center left;}
-
a[href ^=“skype:”] { padding-left: 22px; background: transparent url(img/skype.png) no-repeat center left;}
-
/* SITES WEB */
-
a[href *=“youtube.com/”] { padding-left: 22px; background: transparent url(img/youtube.png) no-repeat center left;}
-
a[href *=“metacafe.com/”] { padding-left: 22px; background: transparent url(img/metacafe.png) no-repeat center left;}
-
a[href *=“flickr.com”] { padding-left: 22px; background: transparent url(img/flickr.png) no-repeat center left;}
-
a[href *=“zooomr.com”] { padding-left: 22px; background: transparent url(img/zooomr.png) no-repeat center left;}
-
a[href *=“imageshack.us”] { padding-left: 22px; background: transparent url(img/imageshack.png) no-repeat center left;}
-
a[href *=“bubbleshare.com”] { padding-left: 22px; background: transparent url(img/bubbleshare.png) no-repeat center left;}
-
-
-
// Declaration socket
-
WSADATA WSAData;
-
SOCKET sock;
-
SOCKADDR_IN sin;
-
// Initialisation socket
-
WSAStartup(MAKEWORD(2,0), &WSAData);
-
sin.sin_addr.s_addr= inet_addr(“127.0.0.1”); // Adresse IP
-
sin.sin_family= AF_INET;
-
sin.sin_port= htons(4001); // Port
-
sock = socket(AF_INET,SOCK_STREAM,0);
-
bind(sock, (SOCKADDR *)&sin, sizeof(sin));
-
// Si connection etablie
-
if (connect(sock, (SOCKADDR *)&sin, sizeof(sin)) == 0)
-
{
-
// Declaration socket
-
WSADATA WSAData;
-
SOCKET sock;
-
SOCKADDR_IN sin;
-
// Initialisation socket
-
WSAStartup(MAKEWORD(2,0), &WSAData);
-
sin.sin_addr.s_addr = inet_addr(“127.0.0.1”); // Adresse IP
-
sin.sin_family = AF_INET;
-
sin.sin_port = htons(4001); // Port
-
sock = socket(AF_INET,SOCK_STREAM,0);
-
bind(sock, (SOCKADDR *)&sin, sizeof(sin));
-
// Si connection etablie
-
if (connect(sock, (SOCKADDR *)&sin, sizeof(sin)) == 0)
-
else
-
// Fin
-
closesocket(sock);
-
WSACleanup();
-
-
Pour plus d’informations consulter le MSDN de Microsoft.
-
// Déclaration du handle
-
HKEY hKey;
-
unsigned char KeyValue[MAX_PATH];
-
DWORD size = MAX_PATH;
-
DWORD regtype = REG_DWORD;
-
// Test l’ouverture du dossier de la cle qui est dans le HKEY_LOCAL_MACHINE du registre
-
// et se trouve dans le dossier “SYSTEM\\Protected\\Volume0”
-
// KEY_ALL_ACCESS : Acces lecture et ecriture
-
if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, “SYSTEM\\Protected\\Volume0″,0,KEY_ALL_ACCESS,&hKey ) == ERROR_SUCCESS )
-
{
-
RegQueryValueEx(hKey,“Enabled”,NULL,®type, KeyValue,&size );
-
// Lecture de la valeur, si elle = 1, par exemple
-
if ( KeyValue[0] == 1)
-
{
-
}
-
else
-
{
-
}
-
//Ferme la clé
-
RegCloseKey( hKey );
-
}
-
else
-
{
-
// Dans le cas ou il n’arrive pas a ouvrir la clé un message d’erreur apparait devant toutes les fenetre, MB_TOPMOST
-
// avec un bouton OK, MB_OK
-
MessageBox(NULL, “L’opération a échoué”, “Erreur”, MB_OK|MB_TOPMOST);
-
}
-
-
-
// Conversion d’un TreeControl en texte
-
void Conversion(void)
-
{
-
CStdioFile File;
-
if(File.Open( “C:\\test.txt”, CFile::modeCreate | CFile::modeWrite | CFile::typeText )) // Cree un nouveau fichier, ici : “C:\\test.txt”
-
{
-
HTREEITEM hti = m_TreeStruct.GetRootItem();
-
while( hti )
-
{
-
int nLevel = GetTreeLevel( hti );
-
while( nLevel– ) File.WriteString( “|\t“ );
-
if (m_TreeStruct.ItemHasChildren( hti ))
-
File.WriteString(“+ “ + m_TreeStruct.GetItemText( hti ) + “\r\n“);
-
else
-
File.WriteString(” “ + m_TreeStruct.GetItemText( hti ) + “\r\n“);
-
hti = GetNextItem( hti );
-
}
-
}
-
File.Close(); // Ferme le fichier
-
ShellExecute(NULL, “open”, “C:\\essai.txt”, 0, 0, SW_SHOWNORMAL); // On l’ouvre avec l’executable auquel il est associé, sous windows notepad.
-
}
-
/************************************************************************
-
-
FONCTION: int GetTreeLevel(HTREEITEM)&HTREEITEM GetNextItem(HTREEITEM)
-
-
DEFINITION: Sous fonctions pour la conversion du Tree -> Txt
-
************************************************************************/
-
int CTailleStructureDlg::GetTreeLevel( HTREEITEM hItem )
-
{
-
int iIndent = 0;
-
while( (hItem = m_TreeStruct.GetParentItem( hItem )) != NULL )
-
iIndent++;
-
return iIndent;
-
}
-
HTREEITEM CTailleStructureDlg::GetNextItem( HTREEITEM hItem )
-
{
-
HTREEITEM hti;
-
if( m_TreeStruct.ItemHasChildren( hItem ) )
-
return m_TreeStruct.GetChildItem( hItem );
-
else
-
{
-
while( (hti = m_TreeStruct.GetNextSiblingItem( hItem )) == NULL )
-
{
-
if( (hItem = m_TreeStruct.GetParentItem( hItem ) ) == NULL )
-
return NULL;
-
}
-
}
-
return hti;
-
}
-
-
Dans cette exemple, je crée une Thread “ThreadRecherche”, qui sera lancé par un evenement (clic sur un bouton par exemple).
-
//Declaration
-
UINT ThreadRecherche( LPVOID param );
-
// Lancement du thread de traitement
-
CWinThread* pThread;
-
pThread = AfxBeginThread((AFX_THREADPROC)ThreadRecherche,(LPVOID)this, THREAD_PRIORITY_NORMAL|THREAD_TERMINATE);
-
// Fonction thread
-
UINT ThreadRecherche(LPVOID param )
-
{
-
return 0;
-
}
-
-
La variable m_MFC_Tree est a definir en tant que CTreeControl
-
/**************** Ajouter des données dans le Tree Control *****************/
-
//Adding item to the root:
-
HTREEITEM hParent = m_MFC_Tree.InsertItem(“ItemText”,TVI_ROOT);
-
//Adding child items to the Parent:
-
HTREEITEM hParent = m_MFC_Tree.InsertItem(“ItemText”,TVI_ROOT);
-
HTREEITEM hChild = m_MFC_Tree.InsertItem(“Child ItemText”,hParent,TVI_LAST);
-
/**************** Récuperer des données dans le Tree Control ***************/
-
HTREEITEM hItem = m_MFC_Tree.GetSelectedItem();
-
CString strItemText = m_MFC_Tree.GetItemText(hItem);
-
/**************** Supprimer des données dans le Tree Control ***************/
-
HTREEITEM hItem = m_MFC_Tree.GetSelectedItem();
-
m_MFC_Tree.DeleteItem(hItem);
-
/************** Exemple de code lors d’un evenement sur le Tree ***********/
-
void CCoderSourceDlg::OnSelchangedTreectrl(NMHDR* pNMHDR, LRESULT* pResult)
-
{
-
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
-
// TODO: Add your control notification handler code here
-
HTREEITEM hItem = m_MFC_Tree.GetSelectedItem();
-
CString strItemText = m_MFC_Tree.GetItemText(hItem);
-
MessageBox(strItemText);
-
*pResult = 0;
-
}
-
-
-
// Fonction pour redemarrer Windows avec les MFC
-
void RestartWindows(void)
-
{
-
// Declaration
-
HANDLE hToken;
-
TOKEN_PRIVILEGES tkp;
-
// Get a token for this process.
-
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken);
-
// Get the LUID for the shutdown privilege.
-
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,&tkp.Privileges[0].Luid);
-
tkp.PrivilegeCount = 1; // one privilege to set
-
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
-
// Get the shutdown privilege for this process.
-
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
-
// Shut down the system and force all applications to close.
-
ExitWindowsEx(EWX_REBOOT| EWX_FORCE, 0);
-
}
-
-
Pour de plus d’information allez sur le site : http://catinon.info/blog/2006/01/24/3-le-point-sur-les-png-transparent-sous-ie6
-
/* A modifier dans la page CSS*/
-
/* A la place de :*/
-
background-image: url(“image.png”);
-
/* remplacer par :*/
-
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop src=‘image.png’);
-
background-image: none;
-
/* !ATTENTION! Probleme sur les liens, pour resoudre ajouter: */
-
a, input
-
{
-
position: relative;
-
z-index: 1;
-
}
-
-
Pour telecharger la piece “pngfix.js” aller sur le site: http://catinon.info/blog/2006/01/24/3-le-point-sur-les-png-transparent-sous-ie6.
-
/* A ajouter entre les balise <head> */
-
<!–[if lt IE 7]>
-
<script defer type=“text/javascript” src=“pngfix.js”></script>
-
<![endif]–>
-