

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
4 messages in net.java.dev.jna.usersRe: Re: [jna-users] [Fwd: Re: Calling...| From | Sent On | Attachments |
|---|---|---|
| rzo | Dec 10, 2008 7:48 am | |
| Timothy Wall | Dec 10, 2008 9:07 am | |
| Linus Ericson | Dec 10, 2008 1:10 pm | |
| rzo | Dec 10, 2008 10:43 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: Re: [jna-users] [Fwd: Re: Calling CreateProcessW] | Actions... |
|---|---|---|
| From: | rzo (rz...@gmx.de) | |
| Date: | Dec 10, 2008 10:43:31 pm | |
| List: | net.java.dev.jna.users | |
Timothy,
thanks for your comment. I will try it out.
- Ron
Timothy Wall wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">Note that you can write a single mapping for A/W versions of window APIs by making use of the options set up in the W32API interfaces. You can avoid the A/W suffix and explicit use of WString, using String instead.
On Dec 10, 2008, at 10:49 AM, rzo wrote:
Linus,
here is how to get it to work:
Declaration:
boolean CreateProcessW(WString lpApplicationName, WString lpCommandLine, Structure lpProcessAttributes, Structure lpThreadAttributes, boolean bInheritHandles, int dwCreationFlags, Structure lpEnvironment, WString lpCurrentDirectory, Structure lpStartupInfo, Structure lpProcessInformation);
Call:
WString cmd = new WString(_cmd); WString wDir = getWorkingDir() == null ? null : new WString(getWorkingDir()); result = MyKernel32.INSTANCE.CreateProcessW(null, cmd, null, null, _pipeStreams, creationFlag, null, wDir, _startupInfo, _processInformation);
It works for me. Pls advise if this works for you.
Regards - Ron
http://sourceforge.net/projects/yajsw/
Linus Ericson wrote:
Thanks Ron,
This does almost exactly what I want. Now I just need support for CreateProcessW instead of CreateProcessA. I tried simply replacing CreateProcessA with CreateProcessW in WindowsXPProcess, but the process failed to start. Why isn't CreateProcessW always used?
Regards /Linus
On Tue, Dec 9, 2008 at 8:21 AM, rzo <rz...@gmx.de> wrote:
Linus,
you may take a look at
http://sourceforge.net/projects/yajsw/
Download the project, which includes the source code and take a look at the class WindowsXPProcess
- Ron
Linus Ericson wrote:
Hello,
I would like to call CreateProcessW [1] in win32 in order to avoid a bug in Java for windows [2]. Since I am totally new to JNA (and the win32 api) a little bit of assistance (well a lot actually!) would be great. I would like to be able to detect when the process has finished running and if possible be able to grab on to the stderr and stdout streams. Does this sound doable?
Has anyone done this before and is willing to share the code? I'm having trouble figuring out the correct type mappings for the various datatypes (LPTSTR, LPBYTE, LPSECURITY_ATTRIBUTES, etc).
Any help would be greatly appreciated.
[1] http://msdn.microsoft.com/en-us/library/ms682425.aspx [2] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4947220
Regards /Linus
</div>







