Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 8th, 2004, 10:50 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Programmatically close a message box

Hello -

I need to be able to automatically click the OK button everytime a certian message box shows up in a given windows application.

I've been reading a few articles about using the Windows API to automatically do stuff like this, but I was wondering what the best way to go about it is. Should I use the mouse_event message to move the mouse over the button and click it? Or should I send tabs and enters via the keyboard to hit the button? Or is there a way to trigger the click event on the button directly?

Also most of the API commands require the hWnd of the given window or control, how can I find that? Will it always be the same for a given button in one application (I would assume not)?

Any input would be most appreciated.

Thanks in advance,
Mike
Reply With Quote
  #2 (permalink)  
Old June 10th, 2004, 06:53 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Does this do the trick?

http://p2p.wrox.com/topic.asp?TOPIC_ID=14576

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
  #3 (permalink)  
Old June 24th, 2004, 01:26 AM
Authorized User
 
Join Date: Jun 2004
Location: Islamabad, Sindh, Pakistan.
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes Greg is right but .....
Why not this... :)

DoCmd.SetWarnings 0 or 1

I know both are the same but SetWarnings save space ... and easy ..too

Stay Beautiful,

Abdul Salam

There is no moving creature on Earth whose sustenance is not provided by Allah. He knows its living and its resting place,
and all that is recorded in a glorious Book. (Al-Quran)
Reply With Quote
  #4 (permalink)  
Old June 25th, 2004, 05:44 PM
tnd tnd is offline
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you are using messagebox in your code then the answer is NO. The reason is messagebox is a modal form. APIs will not work unless they are in another process.

If you want to write another program to close messagebox of a different program then start with FindWindow API call.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Message box basie Classic ASP Basics 1 September 4th, 2008 01:09 PM
close window with out message box cesemj ASP.NET 1.0 and 1.1 Basics 10 October 2nd, 2007 09:23 AM
Close box zaghmout ASP.NET 2.0 Basics 2 September 5th, 2007 03:54 AM
message box nalla ASP.NET 2.0 Professional 4 December 23rd, 2005 03:00 AM
close window with out message box nutrino ASP.NET 1.0 and 1.1 Basics 2 December 6th, 2005 04:26 PM



All times are GMT -4. The time now is 01:36 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.