Re: Asking Windows Specific Questions



Luc The Perverse wrote:
"Knute Johnson" <nospam@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:6QRdg.15272$RK4.83@xxxxxxxxxxxxxxx
Luc 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?

Maybe I need to start with a JNI tutorial.

Ask away!

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/
.



Relevant Pages

  • Re: Asking Windows Specific Questions
    ... This may not be windows specific, ... interacts which interacts with a windows program called winamp (A music ... I would need would be to invoke winamp if it is not already running. ... Provide uninstall functionality ...
    (comp.lang.java.programmer)
  • Re: No TextBox method for clearing the selection
    ... Windows messages exist for all programming languages which use the Win32 ... Normally if a Windows message exists for a control, ... provide a method, or property, which encapsulates the same functionality as ... usually MS is going to make things simple for a .NET programmer by replacing ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Missing WinMsg of OpenNETCF Application Ex
    ... A few common windows messages are contained in the ... functionality. ... Peter Foot ... > informs WinMsg not defined. ...
    (microsoft.public.dotnet.framework.compactframework)