Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using Windows API in JAVA

0 views
Skip to first unread message

Brett

unread,
Jun 23, 2003, 6:39:46 PM6/23/03
to
Specifically I wanted to write an application to help a user change
the screen resolution of Windows. I already have a similar program
written in VB, but thought it would be cool to possibly turn it into a
Java applet so it could easily be accessed through the web.

Can Java use Windows API? Has anyone changed screen resoultion in
Windows with a Java app or applet?

Thanks...

Chris Smith

unread,
Jun 23, 2003, 7:16:39 PM6/23/03
to

Well, you *could* use the Win32 API through an adapter layer written in
JNI... but if you've got Java 1.4 or better, just look into
java.awt.GraphicsDevice and its setDisplayMode method.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

KC Wong

unread,
Jun 23, 2003, 9:44:53 PM6/23/03
to

Is changing resolution really that difficult, you need to write
programs to do that?!

If you choose to support Microsoft's VM only (which is dead long ago),
then may be you can (I'm not sure what's in J++'s API). But you'll
probably have to sign the cab file for using such functionality.

Otherwise a Java application / signed applet can call a native program
via JNI to do the same.

To tell the truth, I don't want any program mess with my desktop (I
have placed my desktop icons manually. Changing resolution will most
likely rearrage them all). I'd also concern about security. I also
*hate* web pages that changes my browser windows' size. I view pages
my own way.

If you want to do that to your users, ask them first.


KC.

Michel Gallant

unread,
Jun 23, 2003, 10:53:47 PM6/23/03
to
You can do this very easily with MS JVM, signed cab file and
the following Win32 API calls:
"EnumDisplaySettings"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_84oj.asp

and "ChangeDisplaySettings":
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_7gz7.asp

I had a version of the display-settings a while back.

It is also possible to use .NET with embedded controls and P/Invoke to do the same thing.

- Michel Gallant
MVP Security

"Chris Smith" <cds...@twu.net> wrote in message news:MPG.1961383f5...@news.altopia.com...

0 new messages