Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

automatic closing of msgbox

Posted on 2001-06-16
5
Medium Priority
?
155 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 400 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 54

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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 Month11 days, 22 hours left to enroll

916 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