Remy Lebeau

Member since: Tuesday, 18 March 2014
Last login: 11 hours 29 minutes ago
Profile viewed: 2,334 views

Your Rank: 52
Points: 44

Remy Lebeau replied to the topic 'Where would I get BORLNDMM.DLL ?' in the forum. 11 hours 30 minutes ago

Frank wrote: This DLL does not seem to come with the product Delphi 10.2


It should be, in the "$(BDS)\bin" folder.

Read More...

Remy Lebeau replied to the topic 'Environment variable pointing to Delphi project's source folder..?' in the forum. 19 hours 6 minutes ago

Emailx45 wrote: the basic function to "catch" variables from MSWindows is: GetEnvironmentVariable(PChar(VarName), PChar(Result), BufSize);
from "System.SysUtils.GetEnvironmentVariable"


Example more used and easy:


You are calling the Win32 API GetEnvironmentVariable() function. The SysUtils unit has its own overloaded GetEnvironmentVariable() function that uses that Win32 API function internally on Windows (and uses getenv() on Posix). So your GetEnvVarValue() function is redundant, not to mention your example doesn't even call it anyway.

Read More...

Remy Lebeau replied to the topic 'Ttreeview alphabetical sort problem' in the forum. 19 hours 10 minutes ago

Rubeena Khan Pathan wrote: what am i missing ??


We don't know, since we can't see your JSON data, or your code that is populating the TreeView.

Read More...

Remy Lebeau replied to the topic 'Support for iOS12' in the forum. 19 hours 34 minutes ago

Remy wrote: No official word about this has been publicly announced yet


Now there has been:

Targeting iOS 12 with RAD Studio

Read More...

Remy Lebeau replied to the topic 'using Vb.net dll with Delphi 2010' in the forum. 2 days ago

Like any other COM object, the DLL needs to be registered on every machine it is going to be used on. Unless you create a Registration-less COM manifest for your app (I don't know if that works for COM interop to .NET assemblies, though).

Read More...

There is no variable specifically for that purpose, unless your project is in the default projects folder referred to by the $(BDSPROJECTSDIR) variable. Otherwise, you could create your own custom environment variable for your needs.

But, why not simply extract the folder from the Application.ExeName property at runtime? You could detect the app running in the IDE debugger (DebugHook <> 0, etc), and then adjust the folder path according to how your project is configured. For instance, if your project is located in '<SomeFolder>', and your project is configured to output the EXE to '<SomeFolder>\Win32\Debug', then the Application.ExeName would be '<SomeFolder>\Win32\Debug\MyApp.exe', so just remove '\Win32\Debug\MyApp.exe' from the end of the path.

Read More...

Remy Lebeau replied to the topic 'Support for iOS12' in the forum. 2 days ago

No official word about this has been announced yet.

Read More...

Remy Lebeau replied to the topic 'Editing Properties of Run-time Created Components' in the forum. 5 days ago

Karl wrote: I'm ... unable to edit properties of these components. For Eg, I can't change the Caption of label or the Port of a com port component.


Why not? What happens when you try? Are you getting a compiler error? A runtime error? Does anything happen at all? You need to be more specific. Please show your actual code you are having trouble with.

Read More...

Remy Lebeau replied to the topic 'firemonkey right to left apps' in the forum. 6 days ago

Maher wrote: I want to ask embarcadero firemonkey managers about ...


This is not the place to do that. Contact them directly, vote on existing reports in Quality Portal, etc.

Maher wrote: supporting RTL languages in firemonkey what about this problem ? when you will release a patch to fix this problem ?


There has been no information published about that.

Read More...

Remy Lebeau replied to the topic 'Instantiate Android SipManager in c++ builder' in the forum. 6 days ago

Pedro wrote: In Java it is like this:

public static SipManager manager;
manager = SipManager.newInstance(context);
//Context is the application context for creating the manager object.


It SHOULD be something as simple as this in C++Builder:
#if defined (_PLAT_ANDROID)
_di_JSipManager manager = TJSipManager::JavaClass->newInstance(SharedActivityContext());
// use manager as needed...
#endif

But in actuality, this doesn't work (at least in Seattle, don't know about later versions) because the static newInstance() method is MISSING from the JSipManagerClass interface in Androidapi.JNI.Net.hpp!

You could try using Java2OpJava2Op to re-import the SipManager class, but I don't know if that will end up suffering from the same problem or not.

Read More...

Remy Lebeau replied to the topic 'Launching Photo Viewer' in the forum. 6 days ago

Andrew wrote: I'd like to be able to launch Microsoft Photo Viewer or "Photos" (Win10) to display a jpg file (when it may not be the default viewer).


Why does it have to be the Photo Viewer specifically, and not the user's default viewer? You can use the Win32 ShellExecute/Ex() function to load the image file in the user's default viewer without having to know what that viewer actually is.

Andrew wrote: Alternatively, I don't mind changing the default viewer if this can be done programmatically, although that also may not be possible in a protected environment.


In which case, all the more reason to load the image file in whatever the user's default viewer actually is.

Andrew wrote: It *is* possible to set the default viewer in this environment when opening a jpg file, but the user may not have a jpg file to open (even if they knew how to open it so that it sets the default).


If the user does not have a default viewer registered, ShellExecute/Ex() will fail with an appropriate error code that you can check for, and then you can ask the user what to do, or fall back to displaying the image in your own app, etc.

Read More...

Emailx45 wrote: ask to REMY, I believe that he is good in CBuilder!


Only when it comes to writing code, using the VCL, etc. I'm not good with troubleshooting problems with the linker itself. The final workaround mentioned at the bottom of community.embarcadero.com/article/articl...em-and-workarounds-2 is the only one I know, and I can't even use it myself when my linker fails (as the -GH flag doesn't exist in my version of CBuilder)

Read More...

Remy Lebeau replied to the topic 'shorten code like a boss' in the forum. 2 weeks ago

Can you show examples of what recipe actually looks like upon entry? Rather than taking a bunch of substrings and trimming them, you might consider calculating the starting and ending positions and then do a single call to System.Copy() . Or have a look at TRegEx . Hard to say for sure without seeing the actual input.

Read More...

Remy Lebeau replied to the topic 'How do I get a Windows Service to turn on the monitor?' in the forum. 2 weeks ago

Ted wrote: One littlle oddity: The SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, ms_poweron); message always reports a failure with GetLastError()=5 - but the monitor is still turned on.

I get the same error in my supporting app that I use to forcefullly turn off the monitor when I test the service, but the monitor is still turned off.


That might make sense when the app runs on a secure desktop like WinLogon. But even on a user's desktop, I could see this potentially happening, too.

HWND_BROADCAST sends a message to every top-level window, so it is possible that the message first arrives at whatever window is responsible for processing monitor requests, then get delivered to another window later on that UIPI says "uh uh, you can't send to this window" and fails subsequent sends with an "access denied" error.

Ted wrote: I wonder what access it was denied since the message clearly turns on/off the monitor? Could it be that it couldn't reach exactly all top-level Windows in the system, but still reached those waking up the monitor?


That is what I'm thinking.

Ted wrote: Would it be possible to find out which HWND I need to send the message to and only send it to that one?


Just about any window should do, provided you have adequate integrity level access to send messages to it. Typically, you should create your own window, or use GetDesktopWindow().

Also, just to note, SC_MONITORPOWER(-1) cannot *turn on* the monitor on Windows 8+. But you could use SendInput() to "nudge" the mouse a few pixels to turn on the monitor (see stackoverflow.com/questions/25011141/ ), or maybe use SC_MONITORPOWER(1) to put the monitor into low-power mode (might not work on Win10, though).

Read More...

Remy Lebeau replied to the topic 'How do I get a Windows Service to turn on the monitor?' in the forum. 2 weeks ago

Ted wrote: CreateProcessAsUser() says the process is started but the first thing I do in WinMain is to create a log ... and that doesn't show anything except for the normal /install, /uninstall and the actual service process with not arguments.


Make sure you exit the process when done with the work, eg:
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR x, int)
{
    if (should do helper work)
    {
        // do work here...
        return 0; // <-- ADD THIS!!!
    }

    // normal service code here ...
}


Read More...

Remy Lebeau replied to the topic 'How do I get a Windows Service to turn on the monitor?' in the forum. 2 weeks ago

Ted wrote: Would it be ok to start the services own exe file with CreateProcessAsUser with a new option that I intercept in WinMain?


Yes, that will be fine.

Ted wrote: Or is it possible to add user defined options to a TService decendant or the TServiceApplication somehow?


You can pass startup parameters to a service (TService has ParamCount and Param[] properties), but that only works when running the EXE as a service, not a standalone app.

Ted wrote: Edit: I just noticed this in the WTSQueryUserToken help: "If the function succeeds, receives a pointer to the token handle for the logged-on user".


The logged on user of the session that you query, yes. The same user that you would need to use when calling CreateProcessAsUser(), so ensure the new process runs in that user's session and not in the service's session. Which is the whole point of this exercise, as window messages cannot pass across session boundaries.

Ted wrote: The service displays messages even when noone is logged on and I wish to turn the monitor on then too. :-/ Perhaps impossible.


Maybe, maybe not. WTSSendMessage() has to display its UI on SOME visible desktop. Even when no user is logged in, there is still at least one desktop available, the one that the WinLogon UI is running on, so someone can walk up and login to the computer. You can retrieve the user token of that Winlogon process (if it is running), make a duplicate of it, use SetTokenInformation() to change the duplicate's session id, then use the duplicate with CreateProcessAsUser().

Read More...

Remy Lebeau replied to the topic 'Delphi TCP Socket Component not Show in Multi Device Application' in the forum. 2 weeks ago

matrix wrote: How to enable TsocketServer and TSocketClient in the Multi-Device Application?


TClientSocket and TServerSocket are only available in VCL (and even then, they are legacy components that are not installed by default anymore). They are intimately tied to the WinSock API on Windows and are not cross-platform, so they are simply not available in FMX.

You will have to switch to a cross-platform socket library instead, such as Indy (look at its TIdTCPClient and TIdTCPServer components), which has a very different programming model than TClientSocket/TServerSocket, so you will have to adjust your socket code accordingly.

Read More...