Sparafucile
September 25th, 2002, 08:38 PM
Can someone explain to me why this code:
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsAPI
{
public class CProcess : Form
{
[ DllImport("KERNEL32.DLL") ]
public static extern int GetLastError();
public CProcess()
{
this.Text = "Error: " + GetLastError();
}
public static void Main( String[] args )
{
Application.Run( new CProcess() );
}
}
}
ALWAYS pops up a Form with the title 'Error: 126'? The problem is that error 126 means that the modul wasn't found - and since KERNEL32.DLL is the only module, I assume that's the one that wasn't found. But then again, the GetLastError() function is located in KERNEL32.DLL and returned the value... this seems to be a contradiction. Any and all help clearing this up will be greatly appreciated.
Spara
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsAPI
{
public class CProcess : Form
{
[ DllImport("KERNEL32.DLL") ]
public static extern int GetLastError();
public CProcess()
{
this.Text = "Error: " + GetLastError();
}
public static void Main( String[] args )
{
Application.Run( new CProcess() );
}
}
}
ALWAYS pops up a Form with the title 'Error: 126'? The problem is that error 126 means that the modul wasn't found - and since KERNEL32.DLL is the only module, I assume that's the one that wasn't found. But then again, the GetLastError() function is located in KERNEL32.DLL and returned the value... this seems to be a contradiction. Any and all help clearing this up will be greatly appreciated.
Spara