Download + Ausführen
-
Hey leute ich arbeite mit Visual C++ und würde gerne einen download machen und diesen dan auch automaitisch ausfüren wen der download beendet wurde...
Das mit dem download war kein problem:
int main() { if ( FAILED( CoInitialize(NULL) ) ) return -1; HRESULT hResult = URLDownloadToFile( NULL, TEXT("http://www.bla.de/blabla.mp3"), TEXT("C:\\blabla.mp3"), 0, NULL ); CoUninitialize(); if ( FAILED(hResult) ) return -1; }
Wie bekomme ich es jetzt hin das die datei ausgeführt wird wenn sie fertig runtergeladen wurde ?
Greetz
-
ShellExecute(Ex)!
-
Verhsteh ich jetzt nicht...
Shellexecute war mir klar nur halt dann wenn der download zu 100% abgeschlossen is und nit dann wen das prog geöffnet wird
-
OK! Habe ich missverstanden.
Aber dann ist es noch einfacher:
Wie wäre es mit dem Lesen der Doku?
URLDownloadToFile
http://msdn.microsoft.com/en-us/library/ms775123(VS.85).aspxlpfnCB
A pointer to the IBindStatusCallback interface of the caller. By using OnProgress, a caller can receive download status. URLDownloadToFile calls the OnProgress and OnDataAvailable methods as data is received. The download operation can be canceled by returning E_ABORT from any callback. This parameter can be set to NULL if status is not required.Siehe IBindStatusCallback
http://msdn.microsoft.com/en-us/library/ms775060(v=VS.85).aspxThis method is always called, whether the bind operation succeeded, failed, or was aborted by a client. The moniker client can use IBinding::GetBindResult to query for protocol-specific information about the outcome of the bind operation. When this method has completed, the moniker client must call Release on the IBinding pointer that it received in IBindStatusCallback::OnStartBinding.