Solved

automatic closing of msgbox

Posted on 2001-06-16
5
143 Views
Last Modified: 2010-05-02
friends,

  I have nearly 30 bmp files to be converted to tiff files
It is possible to convert this .bmp files to tiff files only by using picconverter which i've downloaded from net.
In this case we can select more than one file at a time and convert. but for each and every files, msg box opens.
Is it possible to close the message box automaticall after getting the outputs.
 if so how.

Please give the answer quickly if you know,
        thank u,
               bye
               anu.
0
Comment
Question by:radhasri
5 Comments
 
LVL 4

Accepted Solution

by:
mcmahon_s earned 100 total points
ID: 6197825
I had to do a similar thing for a program so created a simple app to simulate hitting the OK button. You will need to change the values marked with ****:

Option Explicit

Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Public Declare Function SendNotifyMessage Lib "user32" Alias "SendNotifyMessageA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Public Declare Function GetDlgCtrlID Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const WM_COMMAND = &H111
Public Const BN_CLICKED = 0

Public psImportOpen As Boolean

Public Sub main()
    Dim h As Long, res As Long
    psImportOpen = True
    While psImportOpen
        psImportOpen = False
        res = EnumWindows(AddressOf EnumWindowsProc, 255)
        DoEvents
    Wend
End Sub

Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
    Dim res As Long, tempstr As String, temp2 As String
   
    tempstr = String$(255, 0)
    temp2 = "*** CHANGE THIS - MSGBOX WINDOW CAPTION/NAME ***"
    temp2 = temp2 & Right(tempstr, 255 - Len(temp2))
    res = GetWindowText(hwnd, tempstr, 256)
    If Left(tempstr, 14) = "*** CHANGE THIS - NAME OF WINDOW OF YOUR CONVERTER APP ****" Then
        ' This App will keep checking for msgbox
        psImportOpen = True
    End If
    If tempstr = temp2 Then
        res = EnumChildWindows(hwnd, AddressOf EnumChildProc, 255)
    End If
    EnumWindowsProc = True
End Function

Public Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
    Dim res As Long, tempstr As String, temp2 As String
    Dim button As Long
   
    tempstr = String$(255, 0)
    temp2 = "OK"
    temp2 = temp2 & Right(tempstr, 255 - Len(temp2))
    res = GetWindowText(hwnd, tempstr, 256)
    If tempstr = temp2 Then
        button = GetDlgCtrlID(hwnd)
        res = GetParent(hwnd)
        res = PostMessage(res, WM_COMMAND, button, BN_CLICKED * &H10000 + hwnd)
    End If
End Function
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6199157
0
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 6200991
Hi radhasri, here is another sample: http://www.mvps.org/vbnet/code/hooks/index.html
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7136194
Hi radhasri,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept mcmahon_s@devx's comment(s) as an answer.

radhasri, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7173318
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now