Solved

automatic closing of msgbox

Posted on 2001-06-16
5
149 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 52

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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 (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
Suggested Courses
Course of the Month8 days, 6 hours left to enroll

617 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