How to control an application's control(?) in c#?
I am trying to make an application that puts a url into an opened chrome's address bar. I am making it for myself because chrome does not allow me to enter a new url in full screen mode.
So...in c#, I can get handle of chrome. The problem i开发者_运维百科s...I have no idea how to put url into chrome's address bar in c# code.
is it even possible?
I am not looking for a working source code. Any idea would be helpful.
Thanks!
If you're not set on C#, try looking into AutoIt... you should be able to find some way of entering text into the right place and pressing enter... that's at least where I'd start.
When i was young, i used delphi's tool called "Process Viewer" or something like that. It could show main controls in opened windows. Knowing control's name you can get its handle. Having its handle you can do everything =) Here is a bit more info =)
This appears to be possible. Start a new process and set the -url argument to the address you wish to open. You can validate this from a command prompt or start menu, so I don't see any reason it wouldn't work in code, assuming the assembly has the appropriate level of trust.
chrome.exe -url www.mysite.com
Chrome apparently can be started with a variety of command line arguments, although I didn't see the -url
switch on the list.
http://www.waltercedric.com/component/content/article/261-google/1713-google-chrome-exhaustive-command-line-switches.html
Quick article on spawning new processes w/ arguments in c#: http://www.csharp-station.com/HowTo/ProcessStart.aspx
MSDN documentation and samples: http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx
精彩评论