How to detect new file download in Windows OS? - c++

I am making a program that scans any new file downloaded into the system.
Currently, I have used a file watcher that monitors a directory.
Whenever a file is downloaded from chrome then the following happens :
For example: Let's say a pdf file is being downloaded.
.tmp file created first
.tmp file is renamed to .crdownload
.crdownload is modified multiple times
.crdownload file is renamed to .pdf
.pdf file is modified multiple times.
The problem is when can I say a file is downloaded because it is modified multiple times after renaming from .crdownload to .pdf file.
Is there any way to detect a new file downloaded into a system?
Thanks for the help.
Platform: Windows
Language: C, C++

from what I understood you want it to get the file final extension,
for this you can check the file extension evrytime to see if it is a .tmp or
.crdownload; but not check for if it is a new file.
Sorry for my bad English,
Hope this helps.

Related

import adobe xd file to c++ project

so im working on a bot and made an interface for it in adobe xd. My question is: can I import it to a c++ project somehow to be an executable. Im asking this because Ive only seen it used in webpages and not in an actual exe
The AdobeXd project file is an actual zip file. If you rename it to a ".zip" you can open it and see a bunch of json files, folders and images.
The artboards are in the manifest file and each will have a PATH value
Each artboard is in artwork/PATH/graphics/graphicContent.agc
The symbols/components are in the resources/graphics/graphicContent.agc file
The images are in the resources folder
Unless you're willing to write a parser for the Adobe XD file format, code to render it and code to process events to this gui, you should consider it "not possible".

A Qt spreadsheet app shows stored files like unknown ones

Here is the program and below is the screenshot of the issue.
I using Qt Installer Framework (QtIFW2.0.1) created an installer for that Qt app (the spreadsheet). Then installed it on my PC. Now when I create a New File and then save it on the Desktop (Windows 7 x64), the app handles the file but its shape is like unknown files!
Here are some samples:
I searched on the web and did these:
I edited the package.xml file and changed all #component.addOperation to #component.addElevatedOperation in the installscript file.
There were three operations all for creating shortcuts.
Now I seemingly should add this line of code into the code:
addElevatedOperation("GlobalConfig", "SystemScope", "Company", "App", "key", "value")
My question is, is it sufficient to solve the issue? And if so, where in the code, what .h or .cpp file to use it into, please?
If any other file is needed I will pleasantly upload it.

How to get the extension of a file in windows

Is there any way so that i can get extension of a given file.
if suppose there is a file "abc.txt" but after renaming the file name is "abc.exe" now the extension is .exe is there any way that i can get the original extension of a file in which it was created.
I looked for GetFileInformationByHandle but that was not much of help
is there any way that i can get the original extension of a file in which it was created
No, not without any operating system add-ons or a simple backup of the file
.

Saving AVI files in C++ after creating

I'm using Wischik's example code for creating AVI files, however after I run the code and it exits successfully no AVI file is created. I looked through the code and cannot find where it writes/saves/creates an AVI file on your computer. Does anyone know where the code saves AVI file or if it doesn't, a way to make it save the AVI file created to your computer? Thanks
link to source code here
Wischik source code
You should find test.avi in the project directory. Since you know it's name, you could also use Windows explorer to search for it.
To examine further, (assuming you are using VC++), goto
Tools > Options > Projects and Solutions > VC++ Directories,
and Show Directories for Include files.
That will tell you where the headers are.
Alternatively, set a break point at the line where AVIFileOpen is called, and follow the execution path to see what it does.

VS2010 doesnot pick up file from resources folder

I am required to parse a text file in my VS project in mfc in c++. The text file is supposed to be a part of the entire exe product. For that purpose, I placed the text file in my resources folder and set the path in my code as:
char fileName[] = "../myFile.txt";
The problem I'm facing is that VS doesn't find this file in its Resources folder. I added the file in the project file, but that just gave me a corrupt file error. However, the file access works if I provide the absolute path to the file in my code i.e. "C/abc/myFile.txt"
I need the code running on all machines, hence need some method to get VS to read this file using a relative path. Can anybody please provide some assistance? I am a newbie and have tried all that's in my knowledge.
Actually, if it's a resource file it should be copied over to the bin folder, which means your fileName should just be:
char fileName[] = "myFile.txt";
if that doesn't work then, you might need to change the properties of your myFile.txt to ensure it does get copied over with the build process.
Here you can find an answer for your question: http://www.cplusplus.com/forum/general/54255/