Re: Asking Windows Specific Questions
- From: Knute Johnson <nospam@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 27 May 2006 11:06:11 -0700
Luc The Perverse wrote:
"Knute Johnson" <nospam@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:6QRdg.15272$RK4.83@xxxxxxxxxxxxxxxLuc The Perverse wrote:If am writing a program in Java - and have a windows specific question - is it ok to ask that here? Or is there a different group for it? Should I x-post?Ask away!
Maybe I need to start with a JNI tutorial.
Ok! :)
Here are the questions I have had. (All of these questions relate to a music searching program that I have no intention of being cross platform.)
1. System Integration: I would like to "launch" a file using the system's default handler (identical functionality to double clicking a file in explorer or putting file in run menu) I can use Runtime.getRuntime().exec("explorer.exe " + filename) but I believe that has high overhead, and it prompts if you want to open the file. ("D:\media\Short Vids\Star Wars Kid Matrix Parody.wmv" loads default system handler, in this case VLC media player)
Haven't tried it so I don't know.
2. Configuration Management: This may not be windows specific, but it is a problem I have with virtuall every app I write. I need to store options - but the first piece of information I need is where the configuration file is. Knowing the path of my JAR file should be sufficient, but I don't know how to grab this. Some programs need to run with multiple configurations. What is the best way to handle settings/parameters/configuration management?
Look at the System property user.home. Each user can have different config files and it is platform independent. That way your jar archive can live anywhere.
3. Drag And Drop: I would like to be able to drag and drop selected items in a JList into another application and have the same effect as though I had dragged selected files from an instance of explorer. (I do not think I need the specific, though useful, right dragging which gives you a menu, because I will not be dragging to another instance of explorer)
I haven't done any D&D so I can't give you an answer on that one.
4. Windows Messaging: Right now I am writing an application which interacts which interacts with a windows program called winamp (A music player). I was forced to use a third party program called CLAmp to allow command line interaction for enqueue and playing songs. If I could send windows messages from my program directly the only command line interaction I would need would be to invoke winamp if it is not already running.
I think you will need JNI to send windows messages. I'm really curious to know is that mechanism is going to change in the new version of windows that is due out the end of the year.
5. Focus Question: In order for my program to work I need to invoke another program (winamp). As long as winamp is already running there is no problem, but when I invoke it my application loses focus and requires an Alt Tab or mouse click to regain focus. I looked through the available functions for a Gain Focus, Set Focus or Get Focus and I found MANY functions, none of which seemed to regain the window focus. Am I just misinterpriting the names - or has Gain Focus been deliberately removed from Java?
I think you would have to do that the same way you do #4 with windows messaging.
6. Installation Program Question: This had extensive redundancy with question #2. Basically I am looking for an installation program that can do all of the following:
a. Link an extension to my java application (a document extension, or in this unusual case, the document is a "configuration")
b. Check for JRE and direct user to a location to get it if they don't have it. (or allow a bundled JRE optionally)
You can exec java.exe and parse the command line for version. And you can package the JRE with your app and install it if necessary.
c. Install Start Menu/Desktop/Quick Launch shortcuts, with hotkeys if desired.
d. Provide uninstall functionality
e. Register DLLs or EXE files that my program interacts with
a - d are going to require you to write a windows program or script. The only time I played with any of the scripting I found it was very buggy. If you think you are going to make money off the program, I'd just buy a commercial installer.
Sorry I wasn't much help.
--
Knute Johnson
email s/nospam/knute/
.
- Follow-Ups:
- Re: Asking Windows Specific Questions
- From: Luc The Perverse
- Re: Asking Windows Specific Questions
- References:
- Asking Windows Specific Questions
- From: Luc The Perverse
- Re: Asking Windows Specific Questions
- From: Knute Johnson
- Re: Asking Windows Specific Questions
- From: Luc The Perverse
- Asking Windows Specific Questions
- Prev by Date: 2 multicast sockets on the same ports
- Next by Date: Log4j and Log Servers
- Previous by thread: Re: Asking Windows Specific Questions
- Next by thread: Re: Asking Windows Specific Questions
- Index(es):
Relevant Pages
|