C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 12-12-2005, 11:40 AM   #1
Registered User
 
Join Date: May 2005
Posts: 39
Automatically enter text in a dialog box

Hi all,

Is there any API that will enable me to enter a string in the text area of a dialog box?
As shown in the attached figure, I would like to enter the text c:\temp.ps in the text area as and when the dialog appears. I heard it is possible using SetText() but it doesn't seem very clear in MSDN if it really is possible that way. Is anybody aware of any possible method?

Also, after the text is entered, I would like to enter the OK button in a similar manner

Thanks
Attached Images
 
leojose is offline   Reply With Quote
Old 12-12-2005, 11:42 AM   #2
Registered User
 
Join Date: Jan 2005
Posts: 847
SetDlgItemText or get a handle to the edit control and send WM_SETTEXT.
Quantum1024 is offline   Reply With Quote
Old 12-12-2005, 12:20 PM   #3
Registered User
 
Join Date: May 2005
Posts: 39
Quote:
Originally Posted by Quantum1024
SetDlgItemText or get a handle to the edit control and send WM_SETTEXT.
The window is not created by me, so I don't have the handle to the edit control (only the handle to window). Can I still use SetDlgItemText?
leojose is offline   Reply With Quote
Old 12-12-2005, 12:39 PM   #4
Registered User
 
Join Date: Jan 2005
Posts: 847
If you have the control ID of the edit box then you should still be able to use SendDlgItemText. You could aslo use FindWindowEx to get the edit control handle.
Quantum1024 is offline   Reply With Quote
Old 12-13-2005, 12:40 AM   #5
Registered User
 
Join Date: May 2005
Posts: 39
Quote:
Originally Posted by Quantum1024
If you have the control ID of the edit box then you should still be able to use SendDlgItemText. You could aslo use FindWindowEx to get the edit control handle.
I used the FindWindowEx to get the handle of the edit text box, but what I actually need to enter a text in it is its ID which is of type int. How do I find this ID then?
leojose is offline   Reply With Quote
Old 12-13-2005, 09:27 AM   #6
Registered User
 
Join Date: Jan 2005
Posts: 847
If you have the handle of the edit control then you can use SendMessage to send the WM_SETTEXT message. I don't know which function returns an ID from a handle value.
Quantum1024 is offline   Reply With Quote
Old 12-13-2005, 11:59 AM   #7
erstwhile
 
Join Date: Jan 2002
Posts: 2,226
Quote:
Originally Posted by leojose
I used the FindWindowEx to get the handle of the edit text box, but what I actually need to enter a text in it is its ID which is of type int. How do I find this ID then?
GetDlgCtrlID.
__________________
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Ken Fitlike is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help With a BlackJack Program in C Jp2009 C Programming 15 03-30-2009 10:06 AM
Display text in a Dialog Box Dark_Phoenix Windows Programming 9 01-02-2009 06:30 AM
Set Printer Prior To Loading Print Dialog Box Beaner Windows Programming 3 10-10-2008 01:02 PM
struct question caduardo21 Windows Programming 5 01-31-2005 04:49 PM
New Theme XSquared A Brief History of Cprogramming.com 160 04-01-2004 08:00 PM


All times are GMT -6. The time now is 12:03 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22