• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 734
  • Last Modified:

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
0
Wank-A-Lanks
Asked:
Wank-A-Lanks
  • 5
  • 4
1 Solution
 
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
0
 
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!
0
 
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!
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Wank-A-LanksAuthor Commented:
600 Points for an answer :)
0
 
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

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

'Code Continued:

   print #1, filename
close #1
0
 
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"
0
 
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
0
 
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
0
 
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now