Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

suppressing command line dialogs

Posted on 1999-08-02
11
Medium Priority
?
371 Views
Last Modified: 2010-04-16
I am running a reg file using winexec() or system().
I would like to suppress the dialog box, and automatically press OK.
0
Comment
Question by:monkey3
[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
  • 3
  • 3
  • 3
  • +1
11 Comments
 
LVL 3

Expert Comment

by:Laminamia063099
ID: 1201640
Get the id of the Ok button from the dialog box using
HWND hwndOKBtn = GetDialogItem (IDOK);
Then, simulate a user press on that button sending the BM_SETSTATE with the wParam = TRUE and lParam = 0.

SendMessage ( hwndOKBtn, BM_SETSTATE, TRUE, 0 );

This should do it so that the dialog box has a simulated press of ok and the program continues :)  If you have more questions, ask :)

Laminamia


0
 
LVL 1

Author Comment

by:monkey3
ID: 1201641
there's no function called GetDialogItem, and I can't find a different function call which is suitable. Also, I am executing a system command and therefore the command generating the dialog box is from a DOS window. I would have thought that this would make a difference, am I mistaken?
0
 
LVL 3

Expert Comment

by:Laminamia063099
ID: 1201642
The function was mistyped, as I meant GetDlgItem, not GetDialogItem.  I thought you were using Windows, so I don't know if this will work for a console program.  Sorry :)

Laminamia
0
Industry Leaders: 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!

 
LVL 4

Expert Comment

by:yowkee
ID: 1201643
monkey3,

   If your purpose is to import the reg file and without the dialog box come out, you could use regedit.exe to import your
reg file. Regedit.exe have a command line switch could suppress any information dialog (silent mode). Execute
"regedit.exe /s your.reg" to import your reg file.
   Regards.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1201644
Something weird here.
I distinctly remember posting to this thread but I can't see it now.
0
 
LVL 4

Expert Comment

by:yowkee
ID: 1201645
alexo, FYI, I also did not see your post when I post my comment.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1201646
>> alexo, FYI, I also did not see your post when I post my comment.
yea, I know, as it was basically the same as yours...
Probably a problem with my connection.

Anyway, monkey3, I second yowkee's solution.
0
 
LVL 1

Author Comment

by:monkey3
ID: 1201647
OK, that works.
Thanx alot.
I will round up the points to 70,
and alexo, if you would like to answer the question points for alexo.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1201648
Nope, give it to yowkee.  He posted the correct answer and f my post didn't make it through it is my problem.
0
 
LVL 4

Accepted Solution

by:
yowkee earned 280 total points
ID: 1201649
Thankx for both kindness...have a nice day :)
0
 
LVL 1

Author Comment

by:monkey3
ID: 1201650
nice 1.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

664 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