Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#66

AW: TAudioVolume Komponente incl. System Mixer

  Alt 14. Mai 2018, 07:47
Vielleicht ist ja doch noch jemand bereit zu helfen.

Ich habe immer noch Probleme mit den Events.
Zitat:
The MSDN says, Make sure that the application initializes COM with Multithreaded Apartment (MTA) model by calling CoInitializeEx(NULL, COINIT_MULTITHREADED) in a non-UI thread. If MTA is not initialized, the application does not receive session notifications from the session manager. Threads that run the user interface of an application should be initialized apartment threading model.
I think the default operation mode of COM object is (if compiled with Delphi) COINIT_APARTMENTTHREADED.So, we should create seperate thread which operates COM object in COINIT_MULTITHREADED mode to receive session creation event.
Wenn ich in TAudioVolume CoInitializeEx aufrufe schlägt es immer fehl das selbe in der Anwendung selbst, bevor ich mein Window erstelle.

Delphi-Quellcode:
HR := CoInitializeEx(nil, COINIT_MULTITHREADED);
if HR <> S_OK then
  raise Exception.Create('Error : Unable to initialize Component Object Model');
Knalle ich jetzt vorher ein CoUninitialize rein dann geh es aber die Events werden trotzdem nicht verarbeitet.

Delphi-Quellcode:
CoUninitialize;
HR := CoInitializeEx(nil, COINIT_MULTITHREADED);
if HR <> S_OK then
  raise Exception.Create('Error : Unable to initialize Component Object Model');
Was bleibt mir noch übrig?
Bzw.. Wie kann ich das Problem beheben.

Es scheint mit der Initialisierung des Com-Objects zu tun zu haben.

Zitat:
we should create seperate thread which operates COM object in COINIT_MULTITHREADED mode to receive session creation event.
Wie kann ich das machen jemand ein Beispiel?
Und vor allem wo?
TAudioVolume wäre kein Problem ist keine DLL deshalb könnte das gehen.

Habe ich mich noch nicht mit beschäftigt. einen Thread extra für das Com object zu erschaffen.

gruss

Geändert von EWeiss (14. Mai 2018 um 08:22 Uhr)
  Mit Zitat antworten Zitat