VB Skip Filename Prompt

Hi there,
I am editing code in VB that needs to automatically save an image from a webcam without having the file name prompt dialogue box to appear.  The program should just accept the default filename.

<b>The file name prompt cannot appear</b> because the program is to be controlled without a user present at the desktop.

Here is the code:

Private Sub mnuSaveFrame_Click()
Dim FileName As String
Dim retVal As Boolean
Dim i As String
Dim j As Integer

j = NumberOfFiles("E:\My docs\Semester 4\Project\Pictures\")
FileName = CStr(j)

retVal = VBGetSaveFileName(FileName, _
                            FileTitle:="1", _
                            filter:="*.bmp", _
                            InitDir:="E:\My Docs\semester 4\project\pictures\", _
                            DlgTitle:="Save Single Frame", _
                            DefaultExt:="bmp", _
                            Owner:=Me.hWnd)

If False <> retVal Then
    retVal = capFileSaveDIB(hCapWnd, FileName)
    If True <> retVal Then
        MsgBox "Problem saving frame", vbInformation, App.Title
    End If
End If
End Sub

Thank you very much for your help, and it is anticipated!

Androo
Wank-A-LanksAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jmundsackCommented:
I don't see why you can't just skip the call to the VBGetSaveFileName function, and pass whatever default filename you want to capFileSaveDIB.  I'm guessing VBGetSaveFileName is a function that brings up the default "Save As" dialog.

HTH-Jon
Wank-A-LanksAuthor Commented:
no such luck just removing the VBGetSaveFileName function.

if anyone has any suggestions using a different function i'd be willing to try that out as well!
Wank-A-LanksAuthor Commented:
another option i've been reading about is to get the handle of the button i want to push (which would be the "save" button on the prompt), and then use:
PostMessage(hwndbutton,WM_LBUTTONDOWN,0,0);
PostMessage(hwndbutton,WM_LBUTTONUP,0,0);

i have no knowledge of how to do this, but am willing to try!  getting very very urgent!

thank you!
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Wank-A-LanksAuthor Commented:
600 Points for an answer :)
mikemCommented:
Here is the code:

Private Sub mnuSaveFrame_Click()
Dim FileName As String
Dim retVal As Boolean
Dim i As String
Dim j As Integer

Dim InitDir as string

j = NumberOfFiles("E:\My docs\Semester 4\Project\Pictures\")
FileName = "E:\My Docs\semester 4\project\pictures\" & CStr(j)

open filename for output as #1

mikemCommented:
'(Sorry I pressed TAB followed by enter!)

'Code Continued:

   print #1, filename
close #1
mikemCommented:
Sorry a typo

FileName = "E:\My Docs\semester 4\project\pictures\" & CStr(j)

should read
FileName = "E:\My Docs\semester 4\project\pictures\" & CStr(j) &".bmp"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Wank-A-LanksAuthor Commented:
The program IS outputting a file without a dialog box very well, but the problem is that it is just a 47 byte file, not the desired image.  SO CLOSE :)

I appreciate the help mikem,

Androo
Wank-A-LanksAuthor Commented:
Open FileName For Output As #1
    retVal = capFileSaveDIB(hCapWnd, FileName)
Close #1

i did this and i got it working! thank you SO much mikem, if i could give you 2000 points i would!

Androo
mikemCommented:
I'd need to look at your input routines. If the files are coming in in chunks, then you would need to read each chunk then write it to the open file..

Mike
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.