开发者

File Open/Save Dialog

开发者 https://www.devze.com 2022-12-28 23:56 出处:网络
I\'m trying to browse a directory in File Open/Save dialog. I could able to get the handle of common dial开发者_如何学运维og as well as its control window. But I don\'t know how to provide a filename

I'm trying to browse a directory in File Open/Save dialog. I could able to get the handle of common dial开发者_如何学运维og as well as its control window. But I don't know how to provide a filename and click the Save/Open button to Save/Open a file. I couldn't find the SendMessage parameters needed to perform these actions. Any suggestions?


Why are you using SendMessage? Why not use the built in OpenFileDialog and SaveFileDialog classes?

See here for details about OpenFileDialog:

http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx


I'm assuming that you are trying to control a different application, and that's why you are getting the handle of the window etc.

If that's the case, you could use SendKeys to send Alt-N to select the name field, then the filename, then Alt-S to hit save.

If you are just trying to use an Open or Save dialog in your own program, then you should use the built-in OpenFileDialog and SaveFileDialog components.


What actions are you trying to do? You have the post tagged as C#, but I can't think of a reason to get the hwnds and use SendMessage.

For example, in the WPF OpenFileDialog/SaveFileDialog you can set the property FileName (or FileNames) or set the InitialDirectory.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号