• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

accessing Windows API

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
Is it possible to access the windows api like one does in VB through java.
regds.
Rahul.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi rahul_mkar,
Yes it is possible to access Windows API in Java, but not directly. You must first create a C/C++ dll which calls Windows API, then use the Java Native Interface (JNI) to call functions of this dll.
Regards, Olivier
 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You cant make native calls from your applets. However you can do so from a java application . But then if you are writing applications its probably platform specific. In that case who needs Java ?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Has anyone done this (besides Microsoft of course)...
Has there been C++ programmers who have made API dlls and JNI wrappers so there can be open source Windows API calling?

Originally posted by Olivier Rouvi�re:
Hi rahul_mkar,
Yes it is possible to access Windows API in Java, but not directly. You must first create a C/C++ dll which calls Windows API, then use the Java Native Interface (JNI) to call functions of this dll.
Regards, Olivier


 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this scenario may exist in case where there is an integration of
tools developed in java with tools develpoed in vc++,c++.In this
case we have to use JNI to get the functionality of windows API
in java.any suggestions,
 
Sahir Shibley
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

There are other ways to integrate tools developed in other languages with Java. However if you are still set on using JNI this link will be of some help http://www.geocities.com/sahirshah/javapapers/jni_nf.html
Though the article is about calling VB dlls from Java. The technique is the same, instead of wrapping the VB calls in your intermediary dll you wrap the WINAPI calls. I have had this up since last year but I did not post the link in my previous message because I did not see any point in using this technique. I wrote that and put it up as a sort of joke and did not intend it to be taken seriously . Nevertheless if you think you cant live without JNI, there it is.
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi johnjohn,
Please read the JavaRanch Name Policy and re-register using a name that complies with the rules.
Thanks for your cooperation.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
Onion rings are vegetable donuts. Taste this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic