Turan Can
-
Content Count
63 -
Joined
-
Last visited
Posts posted by Turan Can
-
-
procedure TfmBar1.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
OnBaseMove(Button, Self.Handle);
end;procedure TfmBar1.FormPaint(Sender: TObject);
begin
OnBasePaint(ClientWidth, ClientHeight, Canvas);
end;procedure TfmBar1.FormShow(Sender: TObject);
begin
FClSys.OnMenuEvent := MenuEvent;
BorderStyle := bsNone;end;
procedure TfmBar1.OnBaseMove(Button: TMouseButton; Handle: HWND);
begin
if Button = mbLeft then
begin
ReleaseCapture;
SendMessage(Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
end;
end;procedure TfmBar1.OnBasePaint(ClientWidth, ClientHeight: Integer; Canvas: TCanvas);
var
Rect: TRect;
begin
Rect.Left := 0;
Rect.Top := 0;
Rect.Bottom := ClientHeight;
Rect.Right := ClientWidth;
with Canvas do
begin
Pen.Width := 1;
Brush.Color := $00000000;
Pen.Color := $006B6B6B;
Rectangle(0, 0, ClientWidth, ClientHeight);
end;
end; -
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
private
procedure CreateFlatRoundRgn;
procedure CreateParams(var Params: TCreateParams); override;
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
{$R *.dfm}
procedure ExcludeRectRgn(var Rgn: HRGN; LeftRect, TopRect, RightRect, BottomRect: Integer);
var
RgnEx: HRGN;
begin
RgnEx := CreateRectRgn(LeftRect, TopRect, RightRect, BottomRect);
CombineRgn(Rgn, Rgn, RgnEx, RGN_OR);
DeleteObject(RgnEx);
end;procedure TForm1.CreateFlatRoundRgn;
const
CORNER_SIZE = 6;
var
Rgn: HRGN;
begin
with BoundsRect do
begin
Rgn := CreateRoundRectRgn(0, 0, Right - Left + 1, Bottom - Top + 1, CORNER_SIZE, CORNER_SIZE);
// exclude left-bottom corner
ExcludeRectRgn(Rgn, 0, Bottom - Top - CORNER_SIZE div 4, CORNER_SIZE div 4, Bottom - Top + 1);
// exclude right-bottom corner
ExcludeRectRgn(Rgn, Right - Left - CORNER_SIZE div 4, Bottom - Top - CORNER_SIZE div 4, Right - Left , Bottom - Top);
end;
// the operating system owns the region, delete the Rgn only SetWindowRgn fails
if SetWindowRgn(Handle, Rgn, True) = 0 then
DeleteObject(Rgn);
end;procedure TForm1.CreateParams(var Params: TCreateParams);
const
CS_DROPSHADOW = $00020000;
begin
inherited CreateParams(Params);
with Params do
begin
Style := WS_POPUP;
WindowClass.Style := WindowClass.Style or CS_DROPSHADOW;
end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
//BorderStyle := bsNone;
CreateFlatRoundRgn;
end;procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
begin
ReleaseCapture;
SendMessage(Self.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
end;
end;end.
-
Windows VCL
-
if IsActive then
SystemParametersInfo(SPI_SETDROPSHADOW, 0, nil, 0);
else
begin
SystemParametersInfo(SPI_SETDROPSHADOW, 0, PChar(''), 0);
end; -
Hi All,
My only problem is AEC. I couldn't find much information.
I'm dealing with voice transfer, I did everything. I have a problem. As the two sides begin to speak, voices begin to mingle. As I understand it, it echoes. Is there a code example that clears it?
Or "AEC Echo Cancellation" in a sdk. may be in paid product. -
I guess I will not find sample code. I gave freelancer as a job.
-
If you are using the above management, "" you don't need it.
remove.
Application.ProcessMessages;unit Sequence;
interface
uses
System.Classes, Winapi.Messages;type
TOnSequenceEvent = procedure(Text: string) of object;type
TSequence = class(TThread)
private
FHandle: THandle;
FOnSequenceEvent: TOnSequenceEvent;
procedure SequenceEvent(Text: string);
public
constructor Create; overload;
destructor Destroy; override;
published
property OnSequenceEvent: TOnSequenceEvent read FOnSequenceEvent write FOnSequenceEvent;
end;implementation
{ TSequence }
constructor TSequence.Create;
begin
inherited Create;end;
destructor TSequence.Destroy;
begininherited;
end;procedure TSequence.SequenceEvent(Text: string);
begin
if Assigned(FOnSequenceEvent) then
FOnSequenceEvent(Text);
end;end.
-
You probably get an authorization message from both.
I recommend you to close it one by one and try it.LogWrite(stat, true, true);
FrmMain.memStatus.Lines.Add(stat);
1,
First, the "log writer" write error might be returning. authorization may have changed. HDD or SSD permisssion ...!
LogWrite(stat, true, true);
2,
If the problem is here. New Windows updates have controls for "thread" access.
FrmMain.memStatus.Lines.Add(stat);
2, I suggest you look at the create line in "thread".
constructor TSequence.Create;
begin
inherited Create;
FHandle := AllocateHWnd(WndProc);
end;
I recommend changing the code by giving a few minutes.
As I understand you are posting a message from the "thread" to the forum.
unit Sequence;
interface
uses
System.Classes, Winapi.Messages;type
TOnSequenceEvent = procedure(Text: string) of object;type
TSequence = class(TThread)
private
FHandle: THandle;
FOnSequenceEvent: TOnSequenceEvent;
procedure WndProc(var Message: TMessage);
procedure SequenceEvent(Text: string);
public
constructor Create; overload;
destructor Destroy; override;
published
property OnSequenceEvent: TOnSequenceEvent read FOnSequenceEvent write FOnSequenceEvent;
protected
procedure Execute; override;
end;implementation
{ TSequence }
constructor TSequence.Create;
begin
inherited Create;
FHandle := AllocateHWnd(WndProc);
end;destructor TSequence.Destroy;
begin
if FHandle > 0 Then
DeallocateHWnd(FHandle);inherited;
end;procedure TSequence.WndProc(var Message: TMessage);
begin
try
Dispatch(Message);
except
if Assigned(ApplicationHandleException) then
ApplicationHandleException(Self);
end;
end;procedure TSequence.SequenceEvent(Text: string);
begin
if Assigned(FOnSequenceEvent) then
FOnSequenceEvent(Text);
end;procedure TSequence.Execute;
begin
{ Place thread code here }
end;end.
-
All,
Thank you very much for your answers.
I want the app to be active. Not in dropdown menu. I want to fix it to stand next to voice or wifi.
I want to activate the taskbar automatically.Sherlock, in the picture you sent;
Stormversorgung Ein or On enabled
sample : SendMessage(hwd, blaa blaa ... Shellnotify ..
I need a sample code.
-
-
Thank you very much for your support.
I did this, but bigint didn't work for me. I'll check again. -
Never mind everything.
I didn't ask anything.The real problem is this.
I need the code that converts IPV6 to digital number. -
Dear Lars,
Thanks for the quick response
I tried this, but it didn't work. He did not accept the big number.
....
var
b:BigInteger;
begin
b:=47875086426098177934326549022813196294; //does not run the project.
https://github.com/rvelthuis/DelphiBigNumbers
http://www.rvelthuis.de/programs/bigintegers.html
-
Is there a type that can hold a number larger than "int64"? A helper.pas or function etc.
"47875086426098177934326549022813196294" big lenght 38 or 50.
-
Hi All,
I want to convert IPV6 to digital number. I need to make "IP2Location" IPV4 and IPV6 database query. I need help with this.
I added a working example for IPV4.
The biggest problem here is that the integer value is a certain number.
Since IPV6 is longer than numbers, even string is sufficient.function GetIPNumberIPV4(ip: string): integer;
var
List: TStringList;
A, B, C, D, E, F: integer; //Biginteger...?
total: string;
begin
Result := 0;if ip = '::1' then
ip := '127.0.0.1';List := TStringList.Create;
try
List.Delimiter := '.';
List.StrictDelimiter := True;
List.DelimitedText := ip;A := strtoint(List[0]);
B := strtoint(List[1]);
C := strtoint(List[2]);
D := strtoint(List[3]);////Result := (A shl 40) + (B shl 32) + (C shl 24) + (D shl 16) + (E shl 8) + F; // BIG INTEGER PROBLEMS..
Result := (A shl 24) + (B shl 16) + (C shl 8) + D;
finally
List.Free;
end;
end;IPV4 and IPV6 An example of a code that works correctly, but in c #, :(
private void button1_Click(object sender, EventArgs e)
{
//string strIP = "64.233.191.255";
string strIP = "2404:6800:4001:805::1006";
System.Net.IPAddress address;
System.Numerics.BigInteger ipnum;if (System.Net.IPAddress.TryParse(strIP, out address))
{
byte[] addrBytes = address.GetAddressBytes();if (System.BitConverter.IsLittleEndian)
{
System.Collections.Generic.List<byte> byteList = new System.Collections.Generic.List<byte>(addrBytes);
byteList.Reverse();
addrBytes = byteList.ToArray();
}if (addrBytes.Length > 8)
{
//IPv6
ipnum = System.BitConverter.ToUInt64(addrBytes, 8);
ipnum <<= 64;
ipnum += System.BitConverter.ToUInt64(addrBytes, 0);
}
else
{
//IPv4
ipnum = System.BitConverter.ToUInt32(addrBytes, 0);
}
}
}
-
Remy, please read my first post and look at the example.
I have no problems with Windows socket.
My problem is the link on android. Select () gives the same result whether or not there is a link.All my problem is that the select does not give the correct result in andorid. Whether there is a connection or not, the result is 0.
-
This information is great.
So how do I do this on android? Is the connection active? How do I know this?
is there an example?I get the correct results with "tcp, select".
but can you enlighten me with an example of how to do it on android? -
I assume it's on the same computer.
1- And if you want to do the same user.
The easy way. Encrypt the password and sendmassage (..); you send it with.2- If you are going to communicate between programs in different users, you should use namepipe.
-
Hi Dave,
I prepared a sample that works for you.
a few days ago you solved my problem. now it's my turn 😉
uses
System.Win.Registry;function SetPrivilege(Privilege: PChar; EnablePrivilege: Boolean; out PreviousState: Boolean): DWORD;
var
Token: THandle;
NewState: TTokenPrivileges;
Luid: TLargeInteger;
PrevState: TTokenPrivileges;
Return: DWORD;
begin
PreviousState := True;
if (GetVersion() > $80000000) then
// Win9x
Result := ERROR_SUCCESS
else
begin
// WinNT
if not OpenProcessToken(GetCurrentProcess(), MAXIMUM_ALLOWED, Token) then
Result := GetLastError()
else
try
if not LookupPrivilegeValue(nil, Privilege, Luid) then
Result := GetLastError()
else
begin
NewState.PrivilegeCount := 1;
NewState.Privileges[0].Luid := Luid;
if EnablePrivilege then
NewState.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED
else
NewState.Privileges[0].Attributes := 0;
if not AdjustTokenPrivileges(Token, False, NewState, SizeOf(TTokenPrivileges), PrevState, Return) then
Result := GetLastError()
else
begin
Result := ERROR_SUCCESS;
PreviousState := (PrevState.Privileges[0].Attributes and SE_PRIVILEGE_ENABLED <> 0);
end;
end;
finally
CloseHandle(Token);
end;
end;
end;function RegSaveKeyToFile(Key: HKEY; const SubKey, FileName: string): DWORD;
const
SE_BACKUP_NAME = 'SeBackupPrivilege';
var
PreviousState: Boolean;
KeyHandle: HKEY;
begin
Result := SetPrivilege(SE_BACKUP_NAME, True, PreviousState);
if (Result = ERROR_SUCCESS) then
try
KeyHandle := 0;
Result := RegOpenKeyEx(Key, PChar(SubKey), 0, MAXIMUM_ALLOWED, KeyHandle);
if (Result = ERROR_SUCCESS) then
try
// FIXME: Short Filename on Win9x!
Result := RegSaveKey(KeyHandle, PChar(FileName), nil);
finally
RegCloseKey(KeyHandle);
end;
finally
if (not PreviousState) then
SetPrivilege(SE_BACKUP_NAME, PreviousState, PreviousState);
end;
end;function RegLoadKeyFromFile(Key: HKEY; const SubKey, FileName: string): DWORD;
const
SE_BACKUP_NAME = 'SeBackupPrivilege';
SE_RESTORE_NAME = 'SeRestorePrivilege';
var
PrevBackup: Boolean;
PrevRestore: Boolean;
KeyHandle: HKEY;
ShortName: array [0 .. MAX_PATH] of Char;
begin
Result := SetPrivilege(SE_BACKUP_NAME, True, PrevBackup);
if (Result = ERROR_SUCCESS) then
try
Result := SetPrivilege(SE_RESTORE_NAME, True, PrevRestore);
if (Result = ERROR_SUCCESS) then
try
if (GetVersion() > $80000000) then
begin // Win9x (FIXME: Test it! - and see RegReplaceKey)
if (GetShortPathName(PChar(FileName), ShortName, MAX_PATH) = 0) then
Result := GetLastError()
else
Result := RegLoadKey(Key, PChar(SubKey), ShortName);
end
else
begin // WinNT (FIXME: Load RegRestoreKey dynamically!)
KeyHandle := 0;
Result := RegOpenKeyEx(Key, PChar(SubKey), 0, MAXIMUM_ALLOWED, KeyHandle);
if (Result = ERROR_SUCCESS) then
try
Result := RegRestoreKey(KeyHandle, PChar(FileName), 0);
finally
RegCloseKey(KeyHandle);
end;
end;
finally
if (not PrevRestore) then
SetPrivilege(SE_RESTORE_NAME, PrevRestore, PrevRestore);
end;
finally
if (not PrevBackup) then
SetPrivilege(SE_BACKUP_NAME, PrevBackup, PrevBackup);
end;
end;procedure TForm1.Button1Click(Sender: TObject);
const
Key = HKEY(HKEY_LOCAL_MACHINE);
SubKey = 'Software\Microsoft\Notepad';
var
FileName: string;
ErrorCode: DWORD;
begin
SetLength(FileName, MAX_PATH + 1);
SetLength(FileName, GetTempPath(MAX_PATH, PChar(FileName)));
FileName := 'C:\build\notepad.reg';
ErrorCode := RegSaveKeyToFile(Key, SubKey, FileName);
if (ErrorCode <> ERROR_SUCCESS) then
ShowMessage('Save: ' + SysErrorMessage(ErrorCode))
else
begin
ErrorCode := RegLoadKeyFromFile(Key, SubKey, FileName);
if (ErrorCode <> ERROR_SUCCESS) then
ShowMessage('Load: ' + SysErrorMessage(ErrorCode))
else
ShowMessage(IntToStr(42));
end;
end; -
Have you tried to open your exe with administrator mode?
-
There is nothing wrong.
Command ptr
ipconfig /flushdns
-
Would you like to watch it on multiple screens? Or.
If you want to run remote connection and remote script.
My projects.https://www.deskgate.com/
There are 2 projects here, maybe someone can meet their needs.
Ask for the license issue. I grant free license to people on this site. -
FD_ZERO(FDSet);
_FD_SET(SockId, FDSet);
Tv.tv_sec := 0;
Tv.tv_usec := 0;I := select(0, @FDSet, nil, nil, @Tv);
I - I look before the connection. result = 0
sock..
connect..
I - After connecting, I see the result is still the same. result = 0
-
I have "recv -1" data, I check this. so I see if there is data or not :).
It's a nice method.
Job Voice AEC ECHO cancellation, helper
in Job Opportunities / Coder for Hire
Posted · Edited by Turan Can
Hi,
Audio Transfer AEC ECHO cancellation.
Vois Peer to peer, I did the sound transfer, but when the sound is turned on both sides, it starts mixing after a certain time.
This is because the microphone listens to the sound coming from the speaker.
An expert friend who can write paid, clean code is required.
The echo is created due to the reflow of the incoming sound during mutual voice communication. To prevent this, I need the AEC eco function.
As seen in the pictures below, this is my problem.
I need a cleaner like the one below.
Delphi Sample: InEchoClean(microphone, speaker, out.... bla bla
Auxiliary documents are available in the links below.
MSDN: https://docs.microsoft.com/en-us/windows-hardware/drivers/audio/aec-system-filter
https://github.com/RuudErmers/DelphiASIOVST-64-bit-Examples-2018/tree/master/DelphiASIOVST-v1.4
http://www.voip-sip-sdk.com/p_373-how-to-implement-voip-acoustic-echo-cancellation-voip.html
http://startrinity.com/OpenSource/Aec/AecVadNoiseSuppressionLibrary.aspx
https://github.com/xiph/speexdsp/tree/master/libspeexdsp