Skip to content

Commit

Permalink
fix the program not working for windows 7
Browse files Browse the repository at this point in the history
  • Loading branch information
bemxio committed Aug 14, 2023
1 parent e1c04d2 commit 6ede4c2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ void GetVideoResource(LPWSTR* path) {
GetTempPathW(MAX_PATH, *path);
StringCbCatW(*path, MAX_PATH, L"video.wmv");

// create the file handle
// create the file handle and the variable for number of written bytes
HANDLE file = CreateFileW(*path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD written = 0;

// write the video data to the temporary path
WriteFile(file, data, size, NULL, NULL);
WriteFile(file, data, size, &written, NULL);
CloseHandle(file);

// free the resource
Expand All @@ -43,7 +44,7 @@ void InitializeDirectShow(LPCWSTR* path) {
CoInitialize(NULL);

// create the filter graph manager
HRESULT result = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void**)&graph);
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void**)&graph);

// get all needed addition interfaces
graph->QueryInterface(IID_IMediaControl, (void**)&control);
Expand Down

0 comments on commit 6ede4c2

Please sign in to comment.