• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do java use Windows API  RSS feed

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can someone tell me how java can call Windows API.
for example, i wanna open Winamp application on windows 2000
how should i code that ?
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are u from china?
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch, kok seong chen and Peng Yaodong!
I'm moving this thread to the Intermediate forum...
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if you simply want to be able to execute files, you can just use this code:

If you want to actually call windows API's (for example the BitBlt function or other functions from dll's), you'll need to look into JNI (Java Native Interface)
Hope this helps.
 
kok seong chen
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thks donny ~
Before i look into JNI, i want to ask you one question.
is it possible to activate any function of winamp or even power point by calling Windows API via java?
actually i m developing a mobile phone remote PC system.
i plan to send some signal using Bluetooth stack then a server on PC that received the signal will then call Windows API to activate Winamp function according to the signal sent.
Is it possible to do that? or is there another way to do so ?
and thanks for the idea & thks for the coding as well~

btw.. Peng Yaodong. i m from Malaysia
 
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use sockets and send either SOAP messages or your own made-up message format. On the phone (or bluetooth machine) have java and send info to a socket on the target machine. On the target machine just have a C, C++ or VB component listening to the socket. Then that windows program can directly talk to the windows API.
 
Donny Nadolny
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, one way of activating some WinAmp function would be using the SendMessage API to make WinAmp think that a button has been pressed (eg play, pause, next, etc).
You'll need to find a program to spy on the messages winamp recieves (eg Spy++ included with MS Visual Studio 6 (perhaps lower vers too)). Then you can find out what message to send winamp. If you need more help, just post. Good luck.
 
kok seong chen
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thks to Robert and Donny ~i will look into what you guyz suggest ~
 
kok seong chen
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mr.Donny,
can you tell me more about spy++ ?
i still cannot figure out what is spy++
By the way, how the server on PC can initially understand(read) the message?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!