Je cherche à détecter les nouveaux disques amoviblent qui arrivent.
Pour cela, je voulais ouvrir
>LRESULT CALLBACK Handler_procedure(HWND hWnd,unsigned int uiMsg,WPARAM wparam,LPARAM lParam){
> return 0;
>}
>
>int main(int argc,char **argv){
> SERVICE_STATUS_HANDLE hServiceStatus = NULL;
> char *service="srv_a_moi";
> WCHAR *monserviceW=malloc((strlen(Char)+1)*sizeof(WCHAR));
> mbstowcs(monserviceW, service , strlen(service)+1 );
> hServiceStatus=RegisterServiceCtrlHandlerEx(monserviceW,(LPHANDLER_FUNCTION_EX)Handler_procedure,0);
> if ( hServiceStatus == NULL) fprintf(stderr,"Error");
>}
Ca affiche "Error", comment je peux fais pour avoir un registerServiceCtrlHandlerEx.
J'ai testé aussi le retour erreur avec getError(), ca retourne un peu n'importe quoi :p.
Je me sert de cette doc : http://tombell.org.uk/papers/usb-detection.pdf autre referance de mon inspiration http://www.codeproject.com/w2k/usbdisks.asp
Avez-vous une idée ?
Partager