I'm trying to convert several documents to pdf via VB6. The documents are created by vb6 from a database and inserted into a report which I print using a pdf printer to a folder.
When I print a file I wish to move it and rename it to the correct filename. Got the code done to do so.
I've got a problem where the file isn't "printed" quick enough meaning I try to move a file which doesn't yet exist. I tried to sleep my program but that doesn't help, it seems the printing is done in the same thread as the program or something.
I've come up with several work arounds in my head but they all got their own problem. One was if I named the file differently then I could print one file, get the data and start printing the next one and then move back to the first one and do a move and rename. Basically trailing one print job all the time. But that is a no go atm because one problem is that I cant send an argument with what I want the filename to be. Bullzip which I use seems to take a window name as the filename, eg printing from notepad creates a file called notepad - openfile.pdf
My files gets named as MSDataReport.pdf. I'm curious if I can make this approach usable by getting the window using windows api?
The "best" results so far have been by adding a plain msgbox which pops up and then use a timed auto clicker to wait a few seconds and then press ok. It seems that the messagebox doesn't prevent the printing the same way as sleep does. This approach is risky and will lock my computer for the duration so it's not optimal either but atleast it saves me from a lot of manual labor.
Any thoughts on what I can do? Either improve my own solutions or other ways to work around this?