본문 바로가기

Programming/Delphi

#01. 녹스플레이어 타이틀 가져오기

녹스 플레이어의 경우 Multi-Drive를 이용해 멀티 플레이어를 지원하죠.


멀티 플레이어 지원이라고는 하지만 녹스 플레이어마다 각각 타이틀은 다릅니다.



위의 그림과 같이 HIT1이라는 녹스 플레이어 입니다. 만약 1개가 아닌 2개 이상의


녹스가 실행 되어 있다면, 타이틀의 목록들을 가져오는 함수입니다.


function GetNoxTitle : TStringList;
var
  strList : TStringList;
  hNox: THandle;
  szText: array[0..255] of Char;
  nLenText: Integer;
begin
  try
    strList := TStringList.Create;

    hNox := FindWindow('Qt5QWindowIcon', nil);
    while (hNox > 32) do
    begin
      if (FindWindowEx(hNox, 0, 'Qt5QWindowIcon', nil) > 32) then
      begin
          FillChar(szText, SizeOf(szText), 0);
          Winapi.Windows.GetWindowText(hNox, szText, 255);
          strList.Add(szText);
      end;
      hNox := FindWindowEx(0, hNox, 'Qt5QWindowIcon', nil);
    end;

    Result := strList;
  finally
    strList.Free;
  end;
end;