Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #10  
Antiguo 12-11-2006
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Poder: 26
seoane Va por buen camino
Exactamente ¿que error te da?

Por otra parte a mi me quedaría una unit mas o menos así:
Código Delphi [-]
unit Unit2;

interface

uses Windows, Classes;

type
  TSound = class(TThread)
  private
    FList: TStringList;
    FMutex: THandle;
  protected
    procedure Execute; override;
  public
    constructor Create;
    destructor Destroy; override;
    procedure Add(Path: String);
  end;

implementation

uses mmsystem;

{ TSound }

procedure TSound.Add(Path: String);
begin
  WaitForSingleObject(FMutex, INFINITE);
  try
    FList.Add(Path);
  finally
    ReleaseMutex(FMutex);
  end;
end;

constructor TSound.Create;
begin
  FList:= TStringList.Create;
  FMutex:= CreateMutex(nil,FALSE,nil);
  FreeOnTerminate:= TRUE;
  inherited Create(FALSE);
end;

destructor TSound.Destroy;
begin
  FList.Free;
  CloseHandle(FMutex);
  inherited;
end;

procedure TSound.Execute;
var
  Path: String;
begin
  inherited;
  while not Terminated do
  begin
    WaitForSingleObject(FMutex, INFINITE);
    try
      if FList.Count > 0 then
      begin
        Path:= FList[0];
        FList.Delete(0);
      end else
        Path:= '';
    finally
      ReleaseMutex(FMutex);
    end;
    if Path <> '' then
      PlaySound(PChar(Path),0,SND_FILENAME or SND_SYNC)
    else
      Sleep(10);
  end;
end;

end.

Me compila y no me da error alguno.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
sonidos midi en delphi JefeNet Varios 4 14-10-2007 20:03:16
Sonidos en Safari (MAC) CHiCoLiTa HTML, Javascript y otros 5 11-10-2006 14:57:36
Como encadenar DropDownList selman .NET 10 30-06-2005 18:22:01
Sonidos con delphi el_enigma1 OOP 2 14-01-2005 00:31:30
Insertar sonidos egm1802 API de Windows 1 23-04-2004 18:05:39


La franja horaria es GMT +2. Ahora son las 14:53:45.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi