I am interested to know how can I do the same thing that the apllication listed below does:
Start Menu Calculator
I want to know how can I create an custom tab in Start Menu Search and then handle it with my WPF application. It should only be enabled until my application is running.( Just like what The calculator does )
I read something about windows API Code Pack and I downloaded it but I don't know how can I use it. I searched through it but I didn't find anything.( If you know how I could do this using with Windows API Code Pack, please write an example that explains how to do it in C#)
The main exe "Start Menu Calculator.exe" installs a windows hook (using SetWindowsHookEx) into explorer.exe. The hook is implemented as usual in SBLib.dll which is then injected into Windows Explorer's memory space.
This hook searches for window handles belonging to the search box. See a discussion around this here:
How do I get a "handle" on the Windows Search textbox? and probably sub classes the search box windows (if you kill the "Start Menu Calculator.exe" process abruptly, it crashes Windows Explorer too... which kinda confirms this)
It then reacts to key presses, and I suppose it butchers up the result window. In the hierarchies of Windows, I think it's a Window named "Desktop Search Open View", you can get to it with SPY++ under "Start Menu", aside the windows mentioned in the msdn forum above.
So, no nice API behind this nice application. Massive hacks instead :-)
I think however, some level of integration is possible, using documented behavior, with the search box. I have not dug further, but there is the notion of federated search in Windows (Windows 7 Federated Search). I don't see if this would be capable of reacting instantaneously to what the user types in though...
As a side note, if you're also looking for a way to run javascript code from C#, there is a question here on SO that says it all: parse and execute JS by C#
When making Start Menu Calculator I initially tried to use federated search and Managed (.NET) code however you can't integrate into the start menu, only the shell search (for web service based search which lets you return custom results based on a search string). The problem is that the federated search is structured such that all the search data is pre-indexed so for the calculator to work I would have had to pre index every possible calculation! The reason it all works this way is to make sure that clicking the start menu is always fast and responsive (you don't want a web service call everytime you press start in the shell).
I ended up hiring someone to write a native windows app that places a IE control into the Start menu search area and passes the searched text in with the source. All the visual stuff is just css made to look like the start menu rendering and the calculations handled in javascript.
So yes, a bit of a hack but it seems to work and I havent had/heard of any crashing issues so far.
Related
Unlike others who wish to add items to the Windows Explorer, I want to display a context menu within my application. Now you may be thinking, the class you are looking for is ContextMenu. Let me show you what I am interested in doing. Please excuse the small images...
Here is what I currently have:
This is what I would like it to be:
Let's get the assumptions out of the way. I've already detected that the user has TortoiseSVN installed and the item they are selecting is under source control.
My research thus far:
Retrieving context menus - This is very useful. This is a c# library for the Windows Explorer (which can retrieve the context menu for a particular folder/file). However, even when testing out the example, it does not retrieve the TortoiseSVN options.
Another context menu retrieval - Almost identical to the previous link (C# code again). Gets the Windows Explorer context menu minus the TortoiseSVN options.
Process to add context menu - I have just started reading these in-depth posts. The answer may be within this text but it is going to take me some time to get through it. If I have any luck with these, I will post back an answer.
User appears to be able to accomplish this - This appears to be a email group that deals with SVN development. Why post it here? Perhaps to prove that this can be done. To quote: "I'm playing with the TSVN shell context menu. I'm using the IContextMenu.QueryContextMenu (C++ code) method to access TSVN shell context menu and then I'm browsing trough the returned menu."
All in all, this seems like it should be a fairly straight forward thing to do and I am just missing one step. Any and all suggestions are welcome. Thanks!
Edits: Trying to make better use of tags and a more focused title
Hopefully the following will get you started
Showing windows (file/directory) context menu in c# winforms
application
The above link contains the following answer that shows something similar to what you want
How do you show the Windows Explorer context menu from a C#
application?
Rather than trying to pull from the Windows Explorer, ultimately I re-implemented the ContextMenu myself. Adding in the direct calls to TortoiseSVN (as previously mentioned). Not the super elegant solution I wanted but it worked of course!
I will note that user oefe pointed out that the main issue could have been due to x86 vs x64 (TortoiseSVN was installed as x64 on my development machine). Other users may want to look into that if they try to accomplish a similar task.
I need to write a program that forces Google Chrome to be in the front and disable all other actions like opening another program etc... I just need to have Google Chrome in front of the screen and that's all. I can't allow other programs to pop up.
Any ideas how it can be done?
Thank you!
Im pretty sure as far as you can get is a popup window that has no scrollbar or top bar, and can't be resized, but JS wont let you manipulate stuff outside the current window, just like you cant auto-click links inside an iframe
I highly doubt this is possible in Windows, and if it is it won't be ethical if used on home PCs. Will this be a kiosk style app?
You can control what appears in the browser to some extent, such as scrollbar-less windows but much more than that is impossible.
Definitely not ethical at all but applications such as Fortress 101 can do this. I have done similar things in the past using C and the Win32 API. I won't write the code for you but I basically did the following:
Find the desktop and hide it
Find and hide the taskbar
Find and destroy the start button
Capture special keypresses and prevent them from working as expected
You would also need to poll a process list because even doing all of that doesn't prevent the user from downloading a file and executing it. Thus if you found a new application in the process list, you could destroy it.
You could do this using user32.dll with C# but such an application would better be left to commercial software packages.
I want to be able to use the .NET WebBrowserControl to record and repeat user actions to automate the collection and retrieval of text from web pages for a data extraction tool that I'm building, but am unsure about how to best approach this.
I specifically want to use the .NET WebBrowserControl as it can be embedded in a .NET form and also used within a server side process without a UI. I'm aware that there are other means of recording and repeating user actions such as Selenium, but for now I am interested in a solution around the web browser control (just to keep answers focused).
Actions to be recorded are those such as button clicks, drop down list selection, link clicks etc.
Potential solutions I have looked at so far:
(Please correct me if my notes based on brief evaluations are wrong)
iMacro (doesn't appear to have a component that can be used within a project, to record user actions, rather the GUI has to be used).
WaitN - Good for programmatic play back - but no recording facility that can be hooked up to the web browser control?
I'm presuming this is possible as services like Mozenda appear to make use of the WebBrowserControl, or some IE like version based on mshtml.dll.
Are there any other options I can look at?
Any insight would be appreciated.
yap, as in Mozenda ,when user create any action like goto mainpage>click on images>download image etc... the XPath is recorded with the each page url into XML file. So, use self learning algorithm to implement such kind of XML better way than mozenda.
i have developed one application using JSOUP and Regular Expression Parsing works same as mozenda do. i created the configuration file which contains the XPath of all the items you want . Which works great for me.
Hope this helps,
I have a process which I break into multiple processes and even when using threading it takes a very long time to complete.
I'd like to give the user an indication of the status of the execution in a cute way (for each process % complete). Maybe betting on the right horse will ease the pain :)
I found this project long ago: A Guided Tour of WPF (XAML)
I have two questions:
This article was written in 2007. Is there better way to achieve this graphic effect?
I have not understood yet, how the application is started, so I'd like to know if I can integrate such "window" in my window application?
Adam Robinson pointed out that the second question is not clear:
The application generates a window as in the picture below - I like to know if it possible to insert it in my "normal" windows application.
This article was written in 2007, is there better way to achieve this graphic effect?
WPF is the current "best" (or at least most feature-rich) way to develop a Windows Application for the desktop.
I have not understood yet, how the application is started, so I'd like to know if I can
integrate such "window" in my window application?
Make your application a WPF Application. This will automatically give you an application, Window class, and everything else you need to get started. Making a WPF application is just like any other application, except that you need to start the message pump, create the application, setup your startup window, etc. The "WPF Application" template in Visual Studio does all of that for you...
Until you understand what all is happening, I'd recommend starting with that, and customizing from there.
If you choose to stick with a win form for the main app, you can still host the desired window/control via an ElementHostControl. (hosts wpf inside winform).
Blessings,
Jeff
I want to set my application to be on desktop level, like Windows Gadgets. Is this possible to achieve?
Thing is, i have borderless application I want to run on desktop.
I tried to find the option, but I found only "always on top" which is opposite of what I want to achieve.
The good old SetWindowPos supports a HWND_BOTTOM to place your application as the last one in the order.
To use it in C# take a look at PInvoke.Net.
Write the app so that it runs as a service in the background, then implement an actual Windows Gadget as a front-end?
i think there is no way to do it same way as always on top. do you want to run your application under icons? the only way to do a really background application is to replace explorer.exe, but then you will not see icons and task bar.
You can implement an actual Windows Gadget using WPF by creating an XBAP. Just add a gadget.xml file and an .html file that contains only an IFRAME that loads the XBAP. That way your WPF application will actually be a gadget and will automatically follow all the rules.
Another option is to use Windows Sidebar Styler. This requires additional software to be installed alongside yours but also allows you to do things you can't do inside the XBAP sandbox without code signing certificates, user authorizaiton, etc.
A third option is to create a gadget that uses something recognizable in the HTML (such as a particular background color), then when your .exe starts up, scan for a hWnd under Explorer that has the attributes you are looking for, inject yourself into the Explorer.exe process, and set your window as a child of it.
A variation of the third option is to not inject into Explorer.exe but rather maintain your Z Index and location (using SetWindowPos) to track the Z Index and location of the hWnd you found.
So many choices...