Re: Asking Windows Specific Questions
- From: Chris Smith <cdsmith@xxxxxxx>
- Date: Sat, 27 May 2006 12:56:44 -0600
Luc The Perverse <sll_noSpamlicious_z_XXX_m@xxxxxxxxxx> wrote:
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)
Try running the command "start filename". This is Windows-specific,
though, so you should check the os.name system property and perhaps
offer an alternative.
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?
Have you considered the Preferences API, in java.util.prefs. That's the
good portable Java programmer answer, and if it meets your needs it's
better than anything else you could do.
Otherwise, see this long answer:
http://www.javamoderator.org/Java%20White%20Papers/05%20-%20Miscellaneous/Finding%20Application%20Intrinsic%20Data.doc
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.
This would require native code, and I'm not aware of an existing API to
do it. Does winamp implement a COM automation API? If so, then JACOB
is pretty easy to use to talk to automation servers.
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?
Try Window.toFront(). I seem to recall that it flashes the title bar,
but it whould bring the window to the font of the system, and give it
focus.
Note that Window "focus" is different from normal component focus. Each
window has its own focused component. Using requestFocus will only
change which component is focused in that window, and not which window
is active.
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:
I've used WISE to build install kits. It will do most of this, as I
imagine anything else would, too. I have heard good things about
http://www.jrsoftware.org/isinfo.php.
Two things, though.
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)
Are you sure? By far the safest thing to do when distributing a Java
app is to bundle a copy of the JRE in a subdirectory of where you
install the application, and invoke that JRE by its full path. Unless
you're distributing a developer tool (in which case you would want to
let the developer specify the location of the JRE), your users shouldn't
care whether reinstalling Java in FireFox breaks your app.
e. Register DLLs or EXE files that my program interacts with
This is only necessary if they contain COM components. Do they?
--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
.
- 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: Log4j and Log Servers
- Next by Date: Re: I found a bad error: queue overflow, no 281 lenth = 2b8c, can you help me?
- Previous by thread: Re: Asking Windows Specific Questions
- Next by thread: Re: Asking Windows Specific Questions
- Index(es):
Relevant Pages
|