You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

A1880

Intermediate

  • "A1880" is male
  • "A1880" started this thread

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

1

Sunday, July 26th 2009, 2:05pm

Shell and Process ID

Hi,
in VB6 one could start external processes using "Shell()". The same is possible using "Interaction.Shell()" in Jabaco. There is one difference, though. The VB6 Shell returns the process ID and thus makes it possible to deal with the newly created child process later on. Standard Java APIs in general do not provide this type of information. Runtime.exec() returns a "Process" without exhibiting the process handle or ID.

Any ideas how to create a "Shell()" with proper PID result?
I've been experimenting with "CreateProcess()" via WINAPI. But without luck yet. I could not persuade NativeCall() to digest Type/Structure parameters.

Greetings!

A1880

This post has been edited 1 times, last edit by "A1880" (Jul 26th 2009, 7:47pm)


turkulainen

Beginner

  • "turkulainen" is male

Posts: 20

Date of registration: Jun 30th 2009

Location: Turku, Finland

Occupation: engineer

  • Send private message

2

Monday, July 27th 2009, 5:20pm

It might be too much to ask Jabaco to do everything that VB 6 does and with exactly the same syntax. In my opinion, the basic commands and features of VB 6 should work in Jabaco soon, and later more advanced functions can be implemented. This would allow more people to shift their work to Jabaco with less resistance and less effort. This is why I wrote earlier that it would be good if someone maintains a wish list of changes/features for the next few versions, and let Manuel decide on the priority. I am still waiting for 1.4.3 which is likely to work on this computer (1.4.2 and my special version do not work on this PC).

I think file opening, closing and reading/writing/printing commands are a part of most VB 6 software, and Format and Format$ are heavily used in my software. I consider these are basic things which should work. If these do not, it will mean a hell of a task for me to convert my codes.

  • "StefanSchnell" is male

Posts: 102

Date of registration: Mar 13th 2009

Location: Oberirsen - Germany

Occupation: Senior Software Engineer

Hobbies: Programming aund Photography

  • Send private message

3

Saturday, August 1st 2009, 8:41am

How to get a PID

Hi A1880,
try this to get the PID:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'-Begin-------------------------------------------------------------------

  Private WinAPI Function CreateProcess Lib "kernel32.dll" _
    Alias "CreateProcessA" (ByVal lpApplicationName As String, _
    ByVal lpCommandLine As String, lpProcessAttributes As Long, _
    lpThreadAttributes As Long, bInheritHandles As Long, _
    dwCreationFlags As Long, lpEnvironment As Long, _
    lpCurrentDriectory As Long, lpStartupInfo As Long, _
    lpProcessInformation As Long) As Long

  Private Const NORMAL_PRIORITY_CLASS As Long = &H20

  Public Sub main(ByJava args() As String)
    Dim myArgs() As String
    myArgs = args
   
    Dim VarPtr As New VarPtr()
    VarPtr.Init()

    '>Startupinfo<
      Dim si As Long
      si = VarPtr.CreateVar("si", "Array", 68)
      VarPtr.SetArrayLong("si", 0, 68)

    '>Processinformation<
      Dim pi As Long
      pi = VarPtr.CreateVar("pi", "Array", 16)
   
    Dim res As Boolean
    res = CreateProcess(Null, "notepad.exe", 0, 0, False, _
      NORMAL_PRIORITY_CLASS, 0, 0, si, pi)
   
    '-Here you get the PID-----------------------------------------------
      Debug.Print(VarPtr.GetArrayLong("pi", 8))
   
    Sleep 5000
   
    VarPtr.DestroyVar("si")
    VarPtr.DestroyVar("pi")
    VarPtr.UnInit()
  End Sub

'-End--------------------------------------------------------------------

Cheers
Stefan
Visit my personal or commercial site
If you have questions or suggestions, write me an eMail or
meet me here

Posts: 14

Date of registration: Feb 16th 2009

  • Send private message

4

Wednesday, August 12th 2009, 11:50am

Hello Stefan,





Dim VarPtr As New VarPtr() => class not found ?

  • "StefanSchnell" is male

Posts: 102

Date of registration: Mar 13th 2009

Location: Oberirsen - Germany

Occupation: Senior Software Engineer

Hobbies: Programming aund Photography

  • Send private message

5

Wednesday, August 12th 2009, 2:10pm

Hello Gerome,
look here for VarPtr class and library.

Cheers
Stefan
Visit my personal or commercial site
If you have questions or suggestions, write me an eMail or
meet me here

Rate this thread
WoltLab Burning Board