also erstmal vielen dank für die antwort, nur es geht immer noch nicht. also ich denke nicht, dass es an der wait-funktion liegt, da ich es auch schon ganz einfach mit waitforsingleobject probiert hab... ich denk irgendwie, dass es entweder am erstellen des events hakt oder das die funktion RasConnectionNotification haut nicht richtig hin, hab schon ganz schön viel probiert... vielleicht hat ja jemand noch nie idee. hier nochmal mein jetziger code:
Delphi-Quellcode:
pCanRead:=AllocMem(2*sizeof(THandle));
pCanRead[0]:=CreateEvent(nil,True,False,'RASStatusNotificationObject1');
RasConnectionNotification(INVALID_HANDLE_VALUE, pCanRead[0], RASCS_Connected);
if pCanRead[0] = 0 then showmessage('geht net');
pCanRead[1]:=CreateEvent(nil,True,False,'RASStatusNotificationObject2');
if pCanRead[1] = 0 then showmessage('geht net');
RasConnectionNotification(INVALID_HANDLE_VALUE, pCanRead[1], RASCS_Disconnected);
fExit := false;
while not fExit do begin
dwResult := WaitForMultipleObjects(2,@pCanRead[0],False, 20);
case dwResult of
WAIT_OBJECT_0 : begin
ShowMessage('online');
fExit := true;
end;
WAIT_OBJECT_0 + 1 : begin
ShowMessage('offline');
fExit := true;
end;
end;
end;