You are not logged in.

  • "StefanSchnell" is male
  • "StefanSchnell" started this thread

Posts: 102

Date of registration: Mar 13th 2009

Location: Oberirsen - Germany

Occupation: Senior Software Engineer

Hobbies: Programming aund Photography

  • Send private message

1

Tuesday, May 19th 2009, 11:44pm

SetLastError und GetLastError

Hallo Manuel, hallo Community,
vorab folgender Code:

Jabaco Source

1
2
3
4
5
6
Private WinAPI Sub SetLastError Lib "kernel32.dll" (ByVal dwErrCode As Long)
Private WinAPI Function GetLastError Lib "kernel32.dll" () As Long
Public Sub Command1_Click()
   SetLastError 16
   java#lang#System.out.println(Str(GetLastError()))
End Sub


In VB sieht er fast genauso aus:

Source code

1
2
3
4
5
6
7
Private Declare Sub SetLastError Lib "kernel32.dll" (ByVal dwErrCode As Long)
Private Declare Function GetLastError Lib "kernel32.dll" () As Long

Private Sub Command1_Click()
  SetLastError 16
  Debug.Print Str(GetLastError())
End Sub


Mit VB wird die erwartete 16 über GetLastError auch wieder ermittelt. Mit Jabaco erhalte ich eine kühle Null. ;(

Ist meine Annahme richtig, dass SetLastError resp. GetLastError nicht verwendet werden können, aufgrund der JavaVM-Abstraktion über dem Betriebssystem? Eine bessere Erklärung habe ich sonst für dieses Verhalten nicht. Bin für Erleuchtung dankbar.

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