Solved

automatic closing of msgbox

Posted on 2001-06-16
5
142 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
Comment Utility
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
Comment Utility
0
 
LVL 49

Expert Comment

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

Expert Comment

by:DanRollins
Comment Utility
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
Comment Utility
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

772 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

10 Experts available now in Live!

Get 1:1 Help Now