

DelphiUdIT
-
Content Count
822 -
Joined
-
Last visited
-
Days Won
18
Posts posted by DelphiUdIT
-
-
In Delphi 11, when I changed some $IFDEF a lot of time the source code not changed. But the compile (full compile, not RUN hoping that IDE compile the right code) always does the correct work.
In Delphi12, by now, changing $IFDEF always change the source code too.
I use some $DEFINE and I never notice malfunctions.
-
May be, now is working, like the example in the Embarcadero unit .... but there are some facets to evaluate.
program Project2; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; type IFoo = interface ['{5DEC09C5-FADC-46A5-814F-9ED91259A37F}'] function GetEmptyName: string; function GetFooName: string; end; IBar = interface(IFoo) ['{5DEC09C5-FADC-46A5-814F-9ED91259A37F}'] function GetBarName: string; end; //TFooBar = class(TInterfacedObject, IBar) //This is working too TFooBar = class(TInterfacedObject, IFoo, IBar) function GetEmptyName: string; function GetFooName: string; function GetBarName: string; end; function TFooBar.GetEmptyName: string; begin Result := 'Empty'; end; function TFooBar.GetFooName: string; begin Result := 'Foo'; end; function TFooBar.GetBarName: string; begin Result := 'Bar'; end; var i: IInterface; begin try { TODO -oUser -cConsole Main : Insert code here } i := TFooBar.Create; Writeln((i as IFoo).GetEmptyName); Writeln((i as IFoo).GetFooName); Writeln((i as IBar).GetBarName); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; readln; end.
-
4 hours ago, Stefan Glienke said:RTTI does have nothing to do with it but TObject.GetInterfaceEntry - try the following code:
......
....
The interesting thing with those two interfaces in the RTL is that coincidentally they will not cause any harm because of how they are implemented and related to each other - the one inherits from the other and they are also implemented by classes that inherit from each other.
Uhmmm for me it's not working, but maybe I'm missing something...
I'm almost certain that the "as" and "is" don't work if the GUIs are identical... -
9 minutes ago, David Heffernan said:I think the asker knows what GUIDs are used for. However the question is whether the use of the same GUID for two distinct interfaces is a bug or not.
I agree with you, I just wanted to point out some sources on where to possibly look for further useful information on the topic.
I've already seen double GUIDs in interfaces in COM environments, and they worked correctly (or at least I never detected problems), but I never looked into them further.
-
You must use GUIDs when there is a need to use RTTI "as" and "is". Like you told, each interface should have a unique GUID, but I have already see that.
Start from here: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Object_Interfaces_(Delphi)
(may be the link is wrong ... wiki is down at the time of writing)
P.S.: You can read also these books (with examples)
- Hodges Nick - Coding in Delphi (year 2013)
- Hodges Nick - More Coding in Delphi (year 2015)
I don't know if there are something that can help you ...
-
Yes since Friday evening.
-
1 hour ago, dormky said:Except that I'm putting the timer in a thread for a reason. If it's on the main thread, it runs the risk of getting delay by other work (namely, heavy drawing). If the timer is delayed, the event is delayed too.
If the system is overloaded all activities and processes including threads, events, etc ... will inevitably be delayed.
To mitigate this you can just "play" with the thread priority.
Using sleep in a thread at a higher priority than normal is usually a satisfactory solution.
However, if the timer needs to be triggered (i.e. it is not always active), then you should use sleep in combination with a WaitFor.
As @Dalija Prasnikar says, it is not possible to provide you with further solutions if you do not present code or delve deeper into the topic. -
5 hours ago, amidis said:Will do this, thanks. I think this is an issue with Windows 11, because apparently you didn't face similar problem.
As I wrote earlier, after closing the app, you need to press Ctrl+Alt+Del to show lock screen, and then click Cancel. You will then return to original desktop. On rare cases though (at least for me) this is failed, you might need to repeat cancelling lock screen a few times, or if you run the exe through a cmd line (not directly from Delphi), you need to kill the cmd task that running the script. Afterward, try repeat the lock screen method again.
Uhmm ... you used a wrong words .... for me is "many times", not "few times"
, 4 times I went in the lock screen. Like you wrote, something about Windows 11 is wrong. I cannot help 'cause I have not experience in this case. I never used CreateDesktop or similar api.
Good luck and let us knows if you'll resolve the question.
-
1
-
-
1 hour ago, dormky said:This is the VCL subforum 😕 And this is async, so disabling the timer in-between would have no effect. And this is a metronome, so I need to be as exact as possible.
To be more exact as possible you can use MMSystem:
timeBeginPeriod(1); timeEndPeriod(1);
These affect the timer resolution in Windows ... in this example the resolution is set to milliseconds between timeBeginPeriod and timeEndPeriod. You can find more information on: https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod.
You can set (timebegin) at the start of application and reset (timeend) at the end.
P.S.: normally this is the accuracy ... thanks to Mark: https://learn.microsoft.com/it-it/sysinternals/downloads/clockres
-
QuoteYou can use the PlaySound function to play waveform audio if the sound fits into available memory. (The sndPlaySound function offers a subset of the capabilities of PlaySound. To maximize the portability of your Win32-based application, use PlaySound, not sndPlaySound.)
I use PlaySound in async way (and with more then 10 seconds) in all my applications without any issue.
I use it with RESOURCE identifier, but with old app I used also with media file.
PlaySound('Alarm_Sound', HINSTANCE, SND_RESOURCE OR SND_ASYNC);
-
Terrible 😱 ... in Windows 11 23H2 that produce a black screen with application, but when you close the application there is no way (or better, I don't know how) to come back to previous Desktop ... close some process, launch new explorer ... all shortcuts ... only shutdown and restart Windows (from Task Manager -> "New operation") ... also everything I launch is not visible, may be is attached to old Desktop ...
This is a good and simple hacking app ...
-
Like most events, the OnTimer event executes on the main thread. It might be what you do in the OnTimer procedure that is "asynchronous" and the procedure "OnTimer" exits before the async operations complete.
-
If you think the functions are "failing" try testing their return parameter and detect the "getlasterror" to see if there are more precise indications.
-
1
-
-
20 hours ago, ErikT said:At the moment I'm struggling with the Indy Ping procedure, that apparently has a problem. After running a seemingly random number of times (e.g. 20), it raises an exception: Socket Error #10040 Message too long. This seems to be a known issue with Indy Ping, and I am searching for a functioning work-around for it.
After raising the exception, I can't get Ping going again without restarting the application. Will continue the search for a fix tomorrow.
1 hour ago, ErikT said:It seems that poeple have been complaining about the Indy Ping problem for more than a decade, and apparently nothing has happened.
I'm not aware of those. I have some applications that call PING and TCP alternate, thousands of times a day to various devices (over the Internet), and I have no such error reports.
And they are applications that run for years without ever being turned off.
They use TIdICMP (for ping) (WIN32 version) and are multithread applications but all the PINGs are running only from one thread.
-
May be you can use the ARP protocol ... finding MAC Add is its function:
Uses WinApi.Winsock2, WinApi.IpHlpApi, WinApi.IpExport; procedure TForm1.Button1Click(Sender: TObject); var DestIP, SrcIP: IPAddr; AddrLen: ULong; MacAddr: array[0..5] of byte; s: AnsiString; i: integer; begin SrcIp := 0; s := '192.168.2.10'; //ROTATE IP DestIP := inet_addr(PAnsiChar(s)); AddrLen := SizeOf(MacAddr); SendARP(DestIP, SrcIP, @MacAddr[0], AddrLen); s := ' MacAddress : '; if AddrLen > 0 then for i := 0 to AddrLen-1 do begin s := s + IntToHex(MacAddr[i], 2) + '-'; end; SetLength(s, length(s)-1); ShowMessage(s); end;
-
1
-
-
Have you tried the math package RudysBigNumbers https://github.com/TurboPack/RudysBigNumbers ? It's in Getit too.
-
2 hours ago, Yaron said:So my only option to develop an Android app for free is to abandon Pascal as a language?
No, you can use Lazarus / FPC but you must rewrite your application. Before that you must be sure that they support last Android SDK.
-
30 minutes ago, Yaron said:How practical would it be to try converting my app to a Lazarus project?
It's useless. Lazarus approach to Android is totally different from FMX. You must rewrite all your code. And I don't know if last Android api level 33 are supported ...
-
1 hour ago, kosovali said:In Win32 Pointer size is 4, can be this size 8 bytes?
There is not only a problem of the length of the "pointers" but also of the arrangement of the data within the record.
The compiler "fills" the record structure with zero bytes to align the data to the defined alignment (which can be the standard one or one defined in that section of code).
Therefore, the transmission of that data (whatever it is) is still at risk even if it were performed within programs made with Delphi. A change of alignment (even the standard one) for example between different platforms or different compiler releases could lead to different results. -
"MS_SMART_CARD_KEY_STORAGE_PROVIDER" is useless with smartcard.
All the smartcards I have used are not read through that provider, but only through their own provider, which can be listed via CNG (CryptoApi Next Generation). So far I've only used Common Name (CN) access without using the password key for my purposes, and I was planning to move forward to specifically use a smartcard with Indy (but obviously it could work for ICS too). But time is running out and I don't know when I will be able to continue.
-
It has little to do with the topic, but with the entry into force of the DMA (European Digital Markets Act) in Europe the automatic login of applications linked to a particular account will most likely be changed. It seems that when you start the application you will be asked for the account to use for that application, effectively eliminating the possibility of automatic login. So if a "CreateOleObject" is executed, further operator action may be required. All this is a hypothesis for now, we are waiting for what and how the service provider companies (such as Microsoft for e-mail for example) will implement everything.
This is relevant in my sector (industries), because all activities should be automatic... let's hope that the changes do not imply a distortion of the authentication logic.
-
Thank you, Daniel, for your commitment to the forum. Delphi-PRAXiS is truly a place where you can find professional advice and members are always available to resolve other people's doubts and problems.
Happy continuation in your career.-
1
-
-
I used Zeos with Delphi 11 only for test purpose (vs. Lazarus). But I didn't find any issue. I don't remember what version was (7.2 or 8).
Reading on Zeos forum seems that is compatible with Delphi 11.
Try to download from: https://github.com/frones/ZeosLib
-
May be FastReport is not available for Community Edition.
D12 CatalogRepository Problem!
in Delphi Third-Party
Posted
Why don't you set your new path for CatalogRepo ? In TOOL menu you can set you own path for that. And if that path need to be the same for all user every user can do the same.
I have mine own path to a more accessible folder. It's simple and better also when you migrate the IDE.