Windows Application

Forum for all sorts of software discussions. Operating systems, applications, utilities and other software are all here.

Moderators: CPUagnostic, MTX, Celt, Hammer_Time, Sauron_Daz, Tacitus, Anna

Windows Application

Postby Stupify » Thu Oct 24, 2013 1:58 pm

Can someone tell me how to create windows application that I can:

1) associate an extension to it - double-clicking it triggers the application
2) have a right-click context menu item in file browser like Windows Explorer
3) application becomes aware of the file (and the path) that was being "opened"
4) trigger another program passing it the memory content or a virtual file if there is such a thing
5) if this is doable using a language that's simple program, including the gui, and hopefully more cross-platform compatible
---- want to avoid java as i want to have it packaged up as an executable that does not depend on some other package to be installed or conflicts with.
---- the cross-platform compatibility can require different executable but as long as it is from one source code

may add more as I understand the above better.
What goes around comes around with interest!
User avatar
Stupify
Moderator
 
Posts: 9210
Joined: Wed Dec 31, 1969 4:00 pm

Re: Windows Application

Postby Celt » Thu Oct 24, 2013 2:19 pm

Stupify wrote:Can someone tell me how to create windows application that I can:

1) associate an extension to it - double-clicking it triggers the application
2) have a right-click context menu item in file browser like Windows Explorer
3) application becomes aware of the file (and the path) that was being "opened"
4) trigger another program passing it the memory content or a virtual file if there is such a thing
5) if this is doable using a language that's simple program, including the gui, and hopefully more cross-platform compatible
---- want to avoid java as i want to have it packaged up as an executable that does not depend on some other package to be installed or conflicts with.
---- the cross-platform compatibility can require different executable but as long as it is from one source code

may add more as I understand the above better.


The application per se is not responsible for this . . . #1 and 2 are the keys to the rest and this is donein the registry so your app will need an installer to write the correct registry entries. This will instruct Windows on what to do when the file type is double clicked (by adding an Application Class and a file type entry), and similarly adding entries to the right lick menu which tells Windows what to display and what to do if it is selected. #4 cannot be done using virtual memory as that is process protected, but this is what things like temp files were created for.

It is all down to the installer . . . As for cross-platform, then you have to use an environment that is cross-platform as you have to use the API for the OS and Linux is nothing like etc . . . That is a benefit of Java . . .
You don't have to be a megalomaniac to moderate this forum . . . but it helps!
Image
1123.6536.5321 - More than a number, it's our home!
User avatar
Celt
SpamCrusher Mod
 
Posts: 9723
Joined: Wed Dec 31, 1969 4:00 pm
Location: The Land of Concrete Cows

Re: Windows Application

Postby Tiggerz » Sat Oct 26, 2013 11:38 am

If you grab a copy of Visual Studio 2013 Express for Windows Desktop and choose to create a Windows Forms application in C#.

For basic menu stuff, drag a MenuStrip to the top of the form (under the title form1) and also a StatusStrip down to the bottom, this will create basic menu stuff for you. You can customise the menus you want to add here.

For a file menu, usually the way I have done it is to drop a vertical splitContainer onto the form (it defaults to vertical) and in the left side drop in a treeview and set it to dock with the parent container. One would assume you will display something in the right side panel, but for now that can be left blank.

To add the context menu on the treeView the control used is a ContextMenuStrip, however we create this is code not by using the visual designer, and we display it depending on which node is selected.

For the file browser functionality, it is just a matter of iterating through a DirectoryInfo[] item and creating the nodes in the tree. To Open files, the OpenFileDialog can be used. One can manipulate the working directory, current directory and target directories using this information.

To pass data to another program is doable but you need to know the other program and what interfaces it provides (for example, most Microsoft applications can use COM, but you need to know the interface so will require the appropriate SDK for that application).

A list of windows forms controls can be found here along with some walkthroughs. If I get time in the next day or two I will knock up the code for you (except for 5, which I will just show how to go about it).

Update: Info on how to register file types can be found here here however, to save editing the registry, it may be easier to do it in code.
My posts in X-Bit forums don't mean I condone racist or discriminatory comments made by forum members regarding any other individuals. I support the principles of the Universal Declaration of Human Rights & recognize that all people are born free & equal in dignity & rights & should be treated accordingly in the spirit of brotherhood, freedom, justice and peace in the world
User avatar
Tiggerz
X-bit Guru
 
Posts: 2700
Joined: Thu Apr 03, 2003 11:23 pm
Location: New Zealand


Return to General Software Forum

Who is online

Users browsing this forum: No registered users and 2 guests