Autor Beitrag
snowy1980
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Fr 08.05.09 07:42 
Hallo,

Ich habe eine Klasse und verwende dort mehrere DLLImports. Die möchte ich aber jeweils in einen try catch Block einfügen.
per intellisense wird try aber nicht angeboten.

Funktioniert das nur direkt in einer Funktion?
JüTho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2021
Erhaltene Danke: 6

Win XP Prof
C# 2.0 (#D für NET 2.0, dazu Firebird); früher Delphi 5 und Delphi 2005 Pro
BeitragVerfasst: Fr 08.05.09 08:59 
try wird in der SDK-Doku/MSDN als Anweisung bezeichnet. Wo kommen Anweisungen vor? Richtig, nicht im Rumpf einer Klasse, sondern innerhalb von Methoden (das ist in NET die richtige Bezeichnung; Funktionen und Prozeduren gibt es hier nicht). Jürgen
snowy1980 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Fr 08.05.09 09:31 
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
public class Test
    {
        //try-catch Blöcke verwendbar?
        
        [DllImport("test.dll", EntryPoint = "bla")]
        public static extern void Bla();


        [DllImport("test.dll", EntryPoint = "blabla")]
        public static extern void BlaBla();
    }


In dieser Klassen sollen ja diese Methoden zur Verfügung gestellt werden.
Ich möchte aber sauber testen ob der Import evtl. Probleme gemacht hat.

Wie lös ich das?
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Fr 08.05.09 10:57 
Dann brauchst du für jede eine Wrapper-Methode.

_________________
>λ=
snowy1980 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Fr 08.05.09 11:13 
...bitte mehr Infos..hab keinen Plan davon...