-
Content Count
2982 -
Joined
-
Last visited
-
Days Won
134
Everything posted by Remy Lebeau
-
Are you sure you are actually running in debug mode?
-
Are you sure you are supposed to be using implicit TLS on port 143, and not explicit TLS instead? Implicit TLS sends the TLS handshake as soon as the TCP connection is established, before exchanging any other data, thus all protocol data is encrypted. Explicit TLS (aka STARTTLS) sends the TLS handshake after first establishing an unencrypted TCP connection and greeting the server, and then asking the server for permission to start a TLS session (such as before authenticating). For IMAP, implicit TLS is typically used on port 993, and explicit TLS is used on port 143.
-
DEC and FPC compatibility
Remy Lebeau replied to TurboMagic's topic in Algorithms, Data Structures and Class Design
Can you be more specific? What is the actual issue? Indy uses a mix of IFDEF/ENDIF and IF/IFEND, and it works fine in both Delphi and FPC. You might consider turning on LEGACYIFEND in Delphi XE3+, if you are not already doing so. -
Storing a large amount of elements in a 50k lines unit
Remy Lebeau replied to Clément's topic in Algorithms, Data Structures and Class Design
Why not? The user won't notice a difference, and your code/project will be easier to manage. You are loading the Dictionary at runtime anyway, so what does it matter where the data originates from at runtime? Make things easier on yourself. -
It is not a bug, and it is not the SSLIOHandler that is changing the Port. It is actually the UseTLS property setter that does it. You are initializing the Port to the standard IMAP port 143, then setting UseTLS to utUseImplicitTLS, so the property setter changes the Port to the standard IMAP implicit TLS port 993. This is working as designed. If you need to use implicit TLS on port 143 (why?), then you need to set the Port after setting the UseTLS.
-
communicate between 2 progs with sendmessage.
Remy Lebeau replied to JeanCremers's topic in Windows API
Sorry, my bad. I left out the part where the overriden WndProc() needs to pass unhandled messages to the default handler. I have corrected my example. What I showed applies to all C++Builder versions. That won't work. That event is triggered only for messages that are posted to the main thread message queue. Which your example message is not. That likely won't work, either, because your MainForm's class name is TMainForm not TAstroclockMainForm (unless what you have shown is not your real code). -
Storing a large amount of elements in a 50k lines unit
Remy Lebeau replied to Clément's topic in Algorithms, Data Structures and Class Design
Why are you hard-coding so much data directly in your source code to begin with? Why not simply store the data in an external file or database and then load it from there at runtime? If you absolutely need the data to be present statically in your app's executable, I would suggest having the auto-generator store the data in a separate file that is then linked into the app's resources at compile time, and then you can load the data from that resource at runtime. This much data really DOES NOT belong in the source code directly at all. Another benefit of this approach (using either a file, database, resource, etc) is that you can update the data on the user's machine without having to deliver a new executable from your dev machine every time (in the case of using a resource, there are plenty of 3rd party tools available to update an app's resources directly). You can, of course, also update the data on your dev machine and recompile if you really want to. -
PDF File Send as Base64 from c# to Delphi REST
Remy Lebeau replied to mazluta's topic in Network, Cloud and Web
That should only happen if you are sending the data in the URL query string, or in the HTTP body in 'application/x-www-webform-urlencoded' format. You need to show your actual C# and Delphi codes for the REST request, you are clearly not setting up and/or processing the request correctly. DO NOT employ the workaround you have described, that is the wrong solution. You need to fix the underlying bug in your code that is messing up the data in the first place. -
communicate between 2 progs with sendmessage.
Remy Lebeau replied to JeanCremers's topic in Windows API
Is "myprog" the title for your program's TApplication window or TForm window? It makes a big difference. I'm suspecting the latter. You are installing a message handler for the TApplication window. To handle messages for the TForm window, override the TForm's virtual WndProc() method instead: void __fastcall TMainForm::WndProc(TMessage &Message) { if (Message.Msg == WM_USER) { Application->MessageBox("", "", MB_OK); Message.Result = 1; } else TForm::WndProc(Message); } That being said, WM_USER is not a good choice for inter-process communications. Use WM_APP or RegisterWindowMessage() instead. -
TThread.Queue() runs asynchrously - it returns to the caller immediately and its passed procedure is executed in the main thread at some future time. So, your first example is mostly correct - the anonymous procedure will have to transfer ownership of the TStringList to the main thread so it can free the TStringList after updating the UI. However, be sure to move your try..finally into the procedure as well to ensure the TStringList is actually freed even if something goes wrong, eg: procedure TForm16.ShowComputedDetail; begin TTask.Run( procedure var lTstrings: TStrings; begin lTstrings := TStringList.create; try ComputeDetail(lTstrings); TThread.Queue(nil, procedure begin try MyTMemo.BeginUpdate; try MyTMemo.Lines.Assign(lTstrings); finally MyTMemo.EndUpdate; end; finally lTstrings.Free; end; end); except lTstrings.Free; raise; end; end); end; In your 2nd example, you will need to change TThread.Queue() to TThread.Synchronize() to ensure the TStringList is not freed before the main thread has a chance to use it, eg: procedure TForm16.ShowComputedDetail; begin TTask.Run( procedure var lTstrings: TStrings; begin lTstrings := TStringList.create; try ComputeDetail(lTstrings); TThread.Synchronize(nil, procedure begin MyTMemo.BeginUpdate; try MyTMemo.Lines.Assign(lTstrings); finally MyTMemo.EndUpdate; end; end); finally lTstrings.Free; end; end); end;
-
PDF File Send as Base64 from c# to Delphi REST
Remy Lebeau replied to mazluta's topic in Network, Cloud and Web
Can you provide a concrete example of such a difference? -
PDF File Send as Base64 from c# to Delphi REST
Remy Lebeau replied to mazluta's topic in Network, Cloud and Web
Why are you using Base64 at all? REST runs over HTTP, and HTTP handles binary data without needing to encode it. -
Prevent Multiple Instance from running at the same time
Remy Lebeau replied to new_x's topic in Windows API
You should also set the bInitialOwner parameter to False in the CreateMutex() call. You don't need ownership of the mutex just to create it and test for its existence. You can then remove the call to ReleaseMutex() as well. -
Call for Delphi 12 Support in OpenSource projects.
Remy Lebeau replied to Tommi Prami's topic in Delphi Third-Party
Embarcadero already has private channels/forums available for its beta testers and MVPs/TPs. -
I need advice on converting a 500k lines 32bit Delphi 7 application to 64bit
Remy Lebeau replied to Yaron's topic in General Help
Just note that WideString is very inefficient in general, since it is an ActiveX/COM string type managed by the OS, not the Delphi RTL. But you also said a lot of your strings are UTF-8, and you can't store UTF-8 in a WideString. But you can use UTF8Encode()/UTF8Decode() to convert strings between UTF8String and WideString as needed. I doubt it, and if I'm not mistaken, TNT isn't even around anymore. Not to mention it is largely unnecessarily anyway, as the core Delphi classes are now Unicode capable since 2009. So many/most of the TNT classes you are using can be replaced with the native RTL/VCL counterparts (TForm, TListBox, TStringList, etc). Hard to say without seeing your actual code, and what kind of workarounds you are using. You can still use ASM coding in modern Delphi, although 64bit does have some additional restrictions on its usage. -
I need advice on converting a 500k lines 32bit Delphi 7 application to 64bit
Remy Lebeau replied to Yaron's topic in General Help
Possibly. Depends on the context in which it's being used. In any case, if you need UTF-8 strings, you should use the native UTF8String type instead of AnsiString (even in Delphi 7, you should have been doing that). If you must use UTF8 encoded AnsiString in D2009+, at least use SetCodePage() to make sure the CP_UTF8 (65001) codepage is assigned to its data. UTF8String and UnicodeString are assignment-compatible in D2009+, the RTL will automatically convert between them without any data loss (in Delphi 7, you would have had to use the UTF8Encode()/UTF8Decode() functions for that). At least with SetCodePage(), you can make sure not to lose any data if a UTF8 encoded AnsiString is assigned to a UnicodeString (the reverse is not true, though). -
Insert text value into form with webbrowser android Delphi FMX with function WEBBROWSER.EvaluateJavaScript
Remy Lebeau replied to Alisson's topic in FMX
Already covered on StackOverflow: https://stackoverflow.com/questions/77326298/trouble-inserting-text-value-into-html-input-with-twebbrowser-evaluatejavascript -
I need advice on converting a 500k lines 32bit Delphi 7 application to 64bit
Remy Lebeau replied to Yaron's topic in General Help
None of that has anything to do with migrating from 32-bit to 64-bit. Only with migrating from ANSI to Unicode. You can still use the ANSI types in 64-bit code if you need to, albeit more explicitly than before. -
Didn't say there is one. From the get go, the discussion has been about compiling with <windows.h> in general, and how Microsoft doesn't force the alignment but Embarcadero does. Yes, a shame (FreePascal does). Even Marco agreed it would be a useful feature to add, but they still haven't added it yet.
-
That header is modified by Embarcadero, as evident by the check for __CODEGEARC__. Microsoft doesn't care about checking for CodeGear/Embarcadero compilers. The question is, what does Microsoft's native SDK version of the header look like?
-
Use of dynamic control names
Remy Lebeau replied to Bart Verbakel's topic in Algorithms, Data Structures and Class Design
That "works" but may be overkill, as you would potentially be iterating through a lot of other controls that you are not interested in. -
Use of dynamic control names
Remy Lebeau replied to Bart Verbakel's topic in Algorithms, Data Structures and Class Design
Don't do that! You are invoking undefined behavior. You can only iterate using a pointer like that if the values are in an array, Otherwise, you can't be sure the compiler is not adding padding between them inside the class. If you want to use a pointer to iterate the members, you have to put them into an array first and iterate that instead. -
Searching Edit component with autocomplete for Directory/Files
Remy Lebeau replied to Carlo Barazzetta's topic in VCL
Ah. No, it does not. In that case, you would indeed need a custom enumerator. -
I would just stick with using the <pshpack#.h>/<poppack.h> headers, since they support multiple compilers, and will use #pragma pack(push) if the compiler supports it. I have never seen that warning before when using #pragma pack directly. But then, I don't ever wrap the standard Win32 headers with it, either. I doubt it, but anything is possible, I guess. You will have to review the headers for yourself.
-
Searching Edit component with autocomplete for Directory/Files
Remy Lebeau replied to Carlo Barazzetta's topic in VCL
Why implement a custom IEnumStrings class for directories/files? There is already a pre-made data source provided by the OS for that exact purpose - CLSID_ACListISF, which can be created with CoCreateInstance(), configured via IACList2::SetOptions(), and then passed to IAutoComplete::Init().