Solved

automatic closing of msgbox

Posted on 2001-06-16
5
146 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 51

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

740 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