AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Delphi Seltsames verhalten mit Units DC

Seltsames verhalten mit Units DC

Ein Thema von EWeiss · begonnen am 25. Aug 2018 · letzter Beitrag vom 26. Aug 2018
Antwort Antwort
Seite 2 von 2     12
Schokohase
(Gast)

n/a Beiträge
 
#11

AW: Seltsames verhalten mit Units DC

  Alt 26. Aug 2018, 01:10
Und dein Mixer-Projekt hat keine Projekt-Datei (*.dpr/*.dproj)?

Ich sehe dort auch kein implementation oder ein end. in deinem Code-Schnipsel, somit ist das weit entfernt von komplett.

Also bitte ein komplettes Beispiel (wohl am besten in einer zip-Datei).
  Mit Zitat antworten Zitat
EWeiss
(Gast)

n/a Beiträge
 
#12

AW: Seltsames verhalten mit Units DC

  Alt 26. Aug 2018, 01:13
Und dein Mixer-Projekt hat keine Projekt-Datei (*.dpr/*.dproj)?

Ich sehe dort auch kein implementation oder ein end. in deinem Code-Schnipsel, somit ist das weit entfernt von komplett.

Also bitte ein komplettes Beispiel (wohl am besten in einer zip-Datei).
Ach lass mal.. Ich sehe hier und weis was los ist von daher ist das Thema für mich erledigt.
Mein bestreben war nur das verhalten mitzuteilen ich muss hier nichts beweisen.
Wie ich schon sagte mir ist es egal.

Aber hier dein implementation und end Beispiel.

Delphi-Quellcode:
{ ' UNIT uMain.pas
  '--------------------------- uMain -----------------------------
  ' Sample for SKAero API Module.. Main Application
  ' Copyright © 2018 BrewIdeas@Emil Weiss, All Rights Reserved
  '
  ' Author(s) of this Unit: Emil Weiss
  '
  '---------------------------------------------------------------------------- }


unit uMain;

interface

{$R '_resources\Mixer.res' '_resources\Mixer.rc'}

{$IFDEF WIN64}
  {$R '_resources\Manifest64.res'}
{$ELSE}
  {$R '_resources\Manifest.res'}
{$ENDIF}

{$REGION 'Uses'}

uses Classes, Windows, Messages, ShellApi, CommCtrl, StrUtils, ShlObj, SysUtils, SKAeroAPI, ActiveX,
  uGlobal, Graphics, uControls, uIni, Dialogs, mmsystem, AudioVolume, StdCtrls, MMDevice, Math,
  SimpleAudioVolume, AudioSessionControl, AudioSessionControl2, ProcessList;
{$ENDREGION}
{$REGION 'Functions / Procedures'}
function WinMain(hInstance: HINST; hPrevInstance: HINST; lpCmdLine: PChar; nCmdShow: integer)
  : LRESULT; stdcall;
procedure DetectBackground;
function WndProc(WinHandle: HWND; Msg: UINT; wP: WParam; lP: LParam): LRESULT; stdcall;
procedure PlaySoundSlide;
procedure PlaySoundPush;
procedure PlaySoundBlup;
// AudioVolume
{$ENDREGION}
// TMainClass
{$REGION 'TMainClass'}

type
  TMainClass = class
    procedure MasterDefaultDeviceChange(NewDefaultDevice: TDeviceInfo);
    procedure MasterDeviceStateChange(DeviceId: string; NewDeviceState: Cardinal);
    procedure MasterVolumeEvent(Volume: Single; Mute: Boolean);
    procedure AudioVolumeInitialize;
    function CreateHBitmapFromImg(Img: LONG_PTR; var imgW, imgH: integer): HBitmap;
    procedure CreateMasterIcon(x, y: integer; IconHandle: UINT = 0);
    procedure CreateSessionIcon(Index: integer; x, y: integer; IconHandle: UINT = 0);
    function CreateImgFromIcon(wsFile: WideString; IconHandle: UINT = 0): LONG_PTR;
    procedure CreateSession;
    function GetHIconFromFile(AFileName: String; ASmall: Boolean = false; AIndex: integer = 0)
      : HICON;
    procedure SessionCreated(const NewSession: IAudioSessionControl);
    procedure SessionDisconnectedEvent(Sender: TCustomAudioVolume; DisconnectReason: UINT);
    procedure SessionStateEvent(Sender: TCustomAudioVolume; NewState: integer);
    procedure SessionVolumeEvent(Sender: TCustomAudioVolume; Volume: Single; Mute: Boolean);
    procedure PropertyIconChanged(IconPath: string);
    procedure ShowOutputAttribute;
    procedure RemovefromList(DeviceId: string);
  private
    OldMute: Boolean;
    { private-Deklarationen }
    OldSessionMute: Boolean;
    SimpleVolume: ISimpleAudioVolume;
    tmpAudioVolume: TAudioVolume;
  public
    { public-Deklarationen }
    DeviceName: string;
    Hint: WideString;
  end;
{$ENDREGION}
{$REGION 'Global Variable'}

var
  MainClass: TMainClass;
  // MyThread: TSessionThread;
  bMyVolSet: BOOL;
  bAttribute: BOOL;
  AudioVolume1: TAudioVolume;
  AudioVolumeArr: array of TAudioVolume;
  GotChannelCount: Boolean = false;
  ChannelCount: UINT;
  Peaks: array of Single;
  lRes: integer;
  Restart: BOOL;
  m_Initialize: BOOL;
  Second: DWORD;
{$ENDREGION}

implementation

// Animation
{$REGION 'RenderClock'}

procedure RenderClock;
var
  Tick: DWORD;
begin

  Tick := GetTickCount;
  if (Second = 0) then
    Second := Tick + 1000;

  if (Tick > Second) then
  begin
    Second := 0;
    gSprBackground.GD_SetObjectTextEx(ID_TIME_FRONT, PWideChar(TimeToStr(Now)), true);
  end;
end;
{$ENDREGION}
// Sound
{$REGION 'Sound'}
Ich schreibe bestimmt jetzt keine neue Anwendung extra für dich sorry..
Könnte das end. jetzt noch anhängen aber 45K hier rein zu klatschen wäre Schwachsinn.

gruss

Geändert von EWeiss (26. Aug 2018 um 01:17 Uhr)
  Mit Zitat antworten Zitat
Schokohase
(Gast)

n/a Beiträge
 
#13

AW: Seltsames verhalten mit Units DC

  Alt 26. Aug 2018, 01:41
Ich denke mal du verstehst den Begriff komplett nicht.

Komplett bedeutet minimal eine *.dpr und eine *.dproj Datei. Eine wilde Anwendung ist da gar nicht notwendig, sondern eher mit ein paar Klicks erledigt.

Beispiel:

mcve.dproj
XML-Code:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <Base>True</Base>
        <AppType>Console</AppType>
        <Config Condition="'$(Config)'==''">Debug</Config>
        <FrameworkType>None</FrameworkType>
        <MainSource>mcve.dpr</MainSource>
        <Platform Condition="'$(Platform)'==''">Win32</Platform>
        <ProjectGuid>{D051179F-2FDA-4DF0-B901-0DEBE384F9E6}</ProjectGuid>
        <ProjectVersion>18.4</ProjectVersion>
        <TargetedPlatforms>1</TargetedPlatforms>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
        <Base_Win32>true</Base_Win32>
        <CfgParent>Base</CfgParent>
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
        <Cfg_1>true</Cfg_1>
        <CfgParent>Base</CfgParent>
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
        <Cfg_1_Win32>true</Cfg_1_Win32>
        <CfgParent>Cfg_1</CfgParent>
        <Cfg_1>true</Cfg_1>
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
        <Cfg_2>true</Cfg_2>
        <CfgParent>Base</CfgParent>
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Base)'!=''">
        <SanitizedProjectName>mcve</SanitizedProjectName>
        <DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
        <DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
        <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
        <DCC_UsePackage>RESTComponents;FireDAC;FireDACSqliteDriver;soaprtl;FireDACIBDriver;soapmidas;FireDACCommon;RESTBackendComponents;soapserver;CloudService;FireDACCommonDriver;inet;$(DCC_UsePackage)</DCC_UsePackage>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Base_Win32)'!=''">
        <BT_BuildType>Debug</BT_BuildType>
        <DCC_ConsoleTarget>true</DCC_ConsoleTarget>
        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
        <DCC_UsePackage>DBXSqliteDriver;IndyIPCommon;bindcompdbx;DBXInterBaseDriver;vcl;IndyIPServer;vclactnband;vclFireDAC;IndySystem;tethering;svnui;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;vclimg;vcltouch;vcldb;bindcompfmx;svn;FireDACPgDriver;inetdb;DbxCommonDriver;fmx;fmxdae;xmlrtl;fmxobj;vclwinx;rtl;DbxClientDriver;fdk;CustomIPTransport;vcldsnap;IndyCore;dbexpress;vclx;bindcomp;appanalytics;dsnap;TDD.Lib;IndyIPClient;bindcompvcl;VCLRESTComponents;dbxcds;VclSmp;adortl;vclie;bindengine;DBXMySQLDriver;dsnapxml;FireDACMySQLDriver;dbrtl;IndyProtocols;inetdbxpress;FireDACCommonODBC;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
        <UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
        <UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
        <VerInfo_Locale>1033</VerInfo_Locale>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Cfg_1)'!=''">
        <DCC_DebugDCUs>true</DCC_DebugDCUs>
        <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
        <DCC_Optimize>false</DCC_Optimize>
        <DCC_RemoteDebug>true</DCC_RemoteDebug>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
        <DCC_RemoteDebug>false</DCC_RemoteDebug>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Cfg_2)'!=''">
        <DCC_DebugInformation>0</DCC_DebugInformation>
        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
    </PropertyGroup>
    <ItemGroup>
        <DelphiCompile Include="$(MainSource)">
            <MainSource>MainSource</MainSource>
        </DelphiCompile>
        <BuildConfiguration Include="Base">
            <Key>Base</Key>
        </BuildConfiguration>
        <BuildConfiguration Include="Debug">
            <Key>Cfg_1</Key>
            <CfgParent>Base</CfgParent>
        </BuildConfiguration>
        <BuildConfiguration Include="Release">
            <Key>Cfg_2</Key>
            <CfgParent>Base</CfgParent>
        </BuildConfiguration>
    </ItemGroup>
    <ProjectExtensions>
        <Borland.Personality>Delphi.Personality.12</Borland.Personality>
        <Borland.ProjectType>Application</Borland.ProjectType>
        <BorlandProject>
            <Delphi.Personality>
                <Source>
                    <Source Name="MainSource">mcve.dpr</Source>
                </Source>
            </Delphi.Personality>
            <Deployment Version="3">
                <DeployFile LocalName="Win32\Debug\mcve.exe" Configuration="Debug" Class="ProjectOutput">
                    <Platform Name="Win32">
                        <RemoteName>mcve.exe</RemoteName>
                        <Overwrite>true</Overwrite>
                    </Platform>
                </DeployFile>
                <DeployClass Name="AdditionalDebugSymbols">
                    <Platform Name="Win32">
                        <RemoteDir>Contents\MacOS</RemoteDir>
                        <Operation>0</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="DebugSymbols">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="DependencyFramework">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="DependencyModule">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                        <Extensions>.dll;.bpl</Extensions>
                    </Platform>
                </DeployClass>
                <DeployClass Required="true" Name="DependencyPackage">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                        <Extensions>.bpl</Extensions>
                    </Platform>
                </DeployClass>
                <DeployClass Name="File">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Required="true" Name="ProjectOutput">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="ProjectUWPManifest">
                    <Platform Name="Win32">
                        <Operation>1</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="UWP_DelphiLogo150">
                    <Platform Name="Win32">
                        <RemoteDir>Assets</RemoteDir>
                        <Operation>1</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="UWP_DelphiLogo44">
                    <Platform Name="Win32">
                        <RemoteDir>Assets</RemoteDir>
                        <Operation>1</Operation>
                    </Platform>
                </DeployClass>
                <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
            </Deployment>
            <Platforms>
                <Platform value="Android">False</Platform>
                <Platform value="OSX32">False</Platform>
                <Platform value="Win32">True</Platform>
                <Platform value="Win64">False</Platform>
                <Platform value="iOSDevice32">False</Platform>
                <Platform value="iOSDevice64">False</Platform>
                <Platform value="iOSSimulator">False</Platform>
            </Platforms>
        </BorlandProject>
        <ProjectFileVersion>12</ProjectFileVersion>
    </ProjectExtensions>
    <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
    <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
    <Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>
mcve.dpr
Delphi-Quellcode:
program mcve;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  SysUtils;

begin
  try
    { TODO -oUser -cConsole Main : Code hier einfügen }
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.
Und in der dproj Zeile 47 DCC_NAMESPACE sorgt dafür, dass SysUtils gefunden wird, obwohl die Unit eigentlich System.Sysutils heißt.

Also gib mir so ein Beipiel, wo es nicht funktioniert und ich sage dir wo der Fehler liegt.
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:06 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz