Jump to content

vhanla

Members
  • Content Count

    35
  • Joined

  • Last visited

Community Reputation

2 Neutral

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I'm using MonkeyMixer IDE plugin to allow inserting a new FMX form inside my VCL project. I'm launching the FMX form using: Form2.Parent := Form1; Form2.Show; However, the Form2 (FMX form), its FormStyle is set to StayOnTop. But the new child windows won't show inheriting the WS_EX_TOPMOST GWL_EXSTYLE from the Form2 (fmx window), which indeed, it is TOP MOST. So the result is something like this: - The context menu shows behind the form. - The ShowMessage also shows behind that form. - And if I close that Form2, the ShowMessage window still remains there. Important: The context menu (PopupMenu) and the ShowMessage box belongs to the Form2 (FMX form). Notice that this works correctly in a pure FMX project, but this issue only happens in the mixed methods. I guess it has something to do with the VCL forms interfering with the FMX forms handling, since using VCL styles, seems to be applied in the FMX form but partially, as shown in the following picture: Do you know how to fix that? [EDIT] I found a hardcoded "workaround", which is to modify the FMX.Platform.Win.pas file modifying the function TPlatformWin.CreateAppHandle:HWND; adding WS_EX_TOPMOST 😅, it "works as expected" now, but it will turn all TOPMOST: Result := CreateWindowEx(WS_EX_WINDOWEDGE or WS_EX_TOPMOST or WS_EX_TOOLWINDOW, FMAppClass.lpszClassName, PChar(FTitle), WS_POPUP or WS_GROUP, 0, 0, 0, 0, GetDesktopWindow, 0, hInstance, nil)
  2. vhanla

    CustomTitleBar bug

    I know this is not the correct place to report a bug. And I would like to know if this occurred to your applications too. I am trying TTitleBarPanel, as follows: Create a new VCL application, enable custom title bar, add TTitleBarPanel and assign it to TForm. Run application and, when hitting ALT key twice or more just after launch, application hangs and shows stack overflow then terminates. NOTICE: that I tested it on Windows 10 x64 Pro (21H1 and 21H2) and Windows 11. But if ALT key bug is not reproducing this error (as mentioned above), most likely, it always (at least in my case), if the application switches between an exclusive DirectX Fullscreen applicaiont (game), this error shows. specially when fullscreen application blocks the modern Alt+Tab window (that list with thumbnails) and it forces the OS to use the classic Alt+Tab, switching back and forth between your custom titlebar application and that directx application (many times/repeatedly) causes that bug, for instance, I'm testing it with Riot's game League of Legends, which captures/modifies the Alt+Tab behavior. Here are some snapshots. And if I use MadExcept component it shows: exception number: 1 exception class: EStackOverflow exception message: Stack overflow. Using this third party component, to continue the application is possible, otherwise, the application just terminates, since there is no alternative. I have tried with non patched Sydney and patched Sydney (from GetIt manager), this happens everytime, whether installed Madshi's exception handler, or without it (uninstalled). IMPORTANT: If removed TTitlebarPanel this error is gone 🙂.
  3. Thank you! 😀 AddStrings is way faster. The issue occurred by calling: zip.Filenames[i] many times inside that loop because the reason you mentioned, specillay on big zip files which has many files compressed.
  4. var vZipContents := TStringList.Create; var zip := TZipFile.Create; try if TZipFile.IsValid(fZipFilename) then begin zip.Open(fZipFilename, zmRead); for I := Low(zip.FileNames) to High(zip.FileNames) do begin vZipContents.Add(zip.FileNames[I]); end; Memo1.Lines := vZipContents; end; finally zip.Free; vZipContents.Free; end;
  5. Hello, everyone. How do I list zip file contents? I tried using a loop `for Low(vZip.Filenames) to High(vZip.Filenames)......... fList.Add(vZip.Filenames)` it works, but it is very slow.
  6. I need to change language and disable CSP in WebView2, I've read it can be done on CoreWebView2EnvironmentOptions, there is a sample for C# at StackOverflow CoreWebView2EnvironmentOptions options = new CoreWebView2EnvironmentOptions("--disable-web-security"); CoreWebView2Environment environment = await CoreWebView2Environment.CreateAsync(null, null, options); // EnsureCoreWebView2Async must be called before any other call // to EnsureCoreWebView2Async and before setting the Source property // since these will both cause initialization of the CoreWebView2 property // but using a default CoreWebView2Environment rather than your custom one. await webview2.EnsureCoreWebView2Async(environment); And in Edge.pas there is InitializeWebView which creates it, but it passes nil to CoreWebView2EnvironmentOptions argument. var hr := CreateCoreWebView2EnvironmentWithOptions(PChar(BrowserExecutableFolder), PChar(UserDataFolder), nil, Callback<HResult, ICoreWebView2Environment>.CreateAs<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler>( CreateEnvironmentCompleted)); So, I'm trying to pass that parameter instead of nil, how can I create/initialize ICoreWebView2EnvironmentOptions with those custom arguments? I'm injecting JS code (like custom user scripts/extensions to one of my projects) and it is blocked each time due to content security policy. Maybe I'm not in the right direction, but I guess this is the reason it doesn't load/inject scripts from public CDNs. I don't know how to initialize it, official documentation has some examples, like this at https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environmentoptions?view=webview2-1.0.961.33 auto options = Microsoft::WRL::Make<CoreWebView2EnvironmentOptions>(); CHECK_FAILURE(options->put_AllowSingleSignOnUsingOSPrimaryAccount( m_AADSSOEnabled ? TRUE : FALSE)); if (!m_language.empty()) CHECK_FAILURE(options->put_Language(m_language.c_str())); HRESULT hr = CreateCoreWebView2EnvironmentWithOptions( subFolder, m_userDataFolder.c_str(), options.Get(), Callback<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler>( this, &AppWindow::OnCreateEnvironmentCompleted) .Get()); Can you help me, please? I guess it is not using CoInitialize(IID_ICoreWebView2EnvironmentOptions,.... etc), I'm lost here. As of now, I'm still using to CEF4Delphi, but I guess WebView2 might be more useful since user's won't worry on updating as it is part of Edge Browser, which comes in Windows, so that might be more convenient. 😁
  7. I tried modifying installation to add features I opted out in previous installation, but installer shows -1 bytes If I mark a new feature to add, it counts negatively Why is that? I have free space almost 100GB. Something is wrong here.
  8. Thanks, actually changing GWL_EXSTYLE with SetWindowLong is for hiding it from Alt Tab list. Tried that too, it still shows the taskbar button for a very little amount of time, then it disappears. Unlike VCL applications, FMX applications somehow still tries to show its taskbar icon. `ApplicationHWND` itself without even creating form neither running it, shows its taskbar icon. e.g. in projects file (dpr) I uncomment Application.CreateForm... and Application.Run; but add var Handle := ApplicationHWND; after Application.Initialize; the taskbar icon is created and obviously hidden since application terminates after that. When that incompleted FMX application is launched, current foreground application (e.g. explorer) is lost and focuses on a non visible application (our app) just to return to the original foreground window (since it terminates), weird thing is taskbar still shows its icon "flashing" to fastly disappear. Another interesting thing is, that creating a FMX application (in this case 2D mutidevice application) it always creates a Unit2 /TForm2 as main initial form even though there is no Unit1, at least here on my Delphi 10.3 Update 3 Rio installation. So debuggin it with IDA shows a call to FMX::Platform::Win::TPlatformWin::CreateAppHandle which indeed calls Winapi.Windows.ShowWindow just by calling ApplicationHWND function. Notice the icon in the taskbar, it belongs to that FMX application. Anyhow, I tried using the non ApplicationHWND method, which is the one finding the current process id window to hide, which also works. Calling HideAppInTaskbar(Form Handle) from FormCreate shows that before even processing that call, its icon is already added to explorer's taskbar. This procedure does what is expected, to hide the taskbar's icon, but it doesn't avoid its creation in the first place, so it is always visible after launching, at least for a very short period of time. That's because after Application.Run, FMX.Platform.Win.TPlatformWin.Run procedure calls Fmx.Forms.TApplication.RealCreateForms, which also calls Fmx.Forms.TApplication.CreateForm -> Fmx.Forms.TCommonCustomForm.Create -> public Fmx.Forms.TCommonCustomForm.InitializeNewForm -> Fmx.Forms.TCommonCustomForm.CreateHandle which as similar as ApplicationHWND it is called from Fmx::Platform::Win::TPlatformWin::CreateWindow GetApplicationHWND -> Fmx.Platform.Win.TPlatformWin.UpdateApplicationHwnd ends up calling Fmx.Platform.Win.TPlatformWin.CreateAppHandle Which indeed calls ShowWindow with nCmdShow parameter using argument 1 (SW_SHOWNORMAL), then it follows other calls to finally end up with FormCreate procedure in our main form, so those suggested tricks to hide the taskbar icon are finally applied, after it was shown in the first place. However, since every application is a binary, it can be patched, so I tried patching it in the binary to 0 (SW_HIDE) and it worked, no more issues. push 1 in hex 6a 01 (BA 01 00 00 00 in x64), just replaced with 64 00 in the binary/executable using a hex editor, and voilà it finally worked as I was requiring. No more tiny little amount of time showing the taskbar icon just to hide it afterwards. Notice that it might differ in your project, but mine was located at this hex pattern location in my binary/executable (which was not found more than once). ff 8b d8 6a 01 53 e8 so I just look for it and patch after each build. Only 32 bit builds. 48 89 4d 70 ba 01 00 00 00 e8 in x64 builds (debug&release mode). At least with Delphi Rio 10.3.3 Finally, the culprit seems to be function TPlatformWin.CreateAppHandle: HWND in FMX.Platform.Win.pas file, which calls Winapi.Windows.ShowWindow(Result, SW_SHOWNORMAL) instead of SW_HIDE). However it was called from TPlatformWin.CreateWindow function when ParentWnd = 0, which means no parents are found. Then it follows ParentWnd := ApplicationHWND; <--- this function, as mentioned before, leads to create and show a non visible window, just to get the application handle, the procedure in question is TPlatformWin.UpdateApplicationHwnd when there is no parent handle. But modifying those delphi source code files don't work, so I ended patching it after the binary is created. [Update] Thanks to this answer at SO https://stackoverflow.com/a/10471855/537347 the solution was just a matter to copy the FMX.Platform.Win.pas file to your project's directory and make the changes to CreateAppHandle function: function TPlatformWin.CreateAppHandle: HWND; var ... begin ... Result := CreateWindowEx(WS_EX_WINDOWEDGE or WS_EX_APPWINDOW, FMAppClass.lpszClassName, PChar(FTitle), WS_POPUP or WS_GROUP, 0, 0, 0, 0, GetDesktopWindow, 0, hInstance, nil); if FApplicationHWND = 0 then // this is checked by ApplicationHWND function Winapi.Windows.ShowWindow(Result, SW_HIDE) // make sure our application never shows in taskbar icon in this case else Winapi.Windows.ShowWindow(Result, SW_SHOWNORMAL); end; Originally, there is no conditional and uses the SW_SHOWNORMAL argument only, this fixes that. Now, I'm not worried about patching the created binary/exe anymore. Just remember to remove it from public repositories as it is a copyrighted material. However, I left the patching method incase your Delphi license/edition doesn't include FMX source code.
  9. Hello, I was trying to use `Application.MainFormOnTaskbar := False` in a FMX application, but it doesn't exits there. So after looking for answers, I found this one: uses ... FMX.Platform.Win, Winapi.Windows,... begin Application.Initialize; ShowWindow(ApplicationHWND, SW_HIDE); ... This kind of works, but it is not as "silent"ish as the VCL counterpart, because it still shows a blank button being added to the taskbar then disappears before completely showing its icon. This is more noticeable when FMX application it not pinned. It shows it in small amount of time, before hiding it but is noticeable. Is there any way to completely hide it on launch? I'm writing a tool to center the taskbar's icons, and also another one to pin icons and launch from its position (pinned .lnk with different arguments are allowed more than once) like mac's stacks but with fancy FMX effects and animations, but launching them (being it a FMX application and as stated before it has that taskbar issue) is noticeable since my other tool rearranges its position and it looks weird, but normal VCL application doesn't do that. I also tried mixing VCL with FMX as MonkeyMixer method suggests, with main application VCL which is hidden and launches the FMX form, yet it still has the same issue, it shows an incomplete icon in the taskbar to fastly disappear, and since my other tool center icons, it is expected that it rearranges taskbar's icons giving an effect like shaking, which is very annoying. In this gif animation I show what I mean. The FMX version is the last icon, when it is launched the taskbar's icons restart due to that mentioned issue (might fix in the centering application, but without injecting code is hard, though is planned for distant future, I don't want to deal with explorer.exe unexpected crashes yet), while the other launches from pinned icons is a VCL application, and as you can see it doesn't try to create a taskbar button, just remains hidden from the beginning. Notice that I don't want those applications to be visible because (otherwise) taskbar's thumbnail will interfere in "usability", and that is not wanted. However, I might fix the centering application with delaying and etc ways, but the original question is regarding to hide it completely from taskbar on launch, and to keep it running in background is an option, but I still want it to solve that issue as is (required).
  10. vhanla

    Using the New Edge browser control

    None of them worked, I also tried recommended version from http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_TEdgeBrowser_Component_and_Changes_to_the_TWebBrowser_Component 0.9.430 which fails with access error, newer versions don't show any error messages, just creates a directory called appname.exe.WebView2 which is empty unlike previous one, which fills with a bunch of files and directories but fails. I installed and copied files from fixed cab too (from https://developer.microsoft.com/en-us/microsoft-edge/webview2/ to include EmbeddedBrowserWebView.dll I have Edge canary and stable installed, both 64 bits. MyApps compiled and tried x86 and x64. dlls respectively, none of them works. --- IMHO, new fixed approach (from that installer page) seems just like CEF embedded, almost like shipping your own web browser, wasting more RAM unless you take full advantage of web technologies, I'd prefer old EdgeHTML approach (aka. WebView1.0 for Win32) it works nicely for simple tasks. https://stackoverflow.com/a/52788855/537347 I wish they'd give more freedom like CEF4Delphi, specially when using system notifications (from webpage), which is still attached to its runtime executables, also audio sessions. Both versions are like that, WebView for Win32 v1.0 and newer v2. https://github.com/MicrosoftEdge/WebView2Feedback/issues/4 CEF4Delphi as far as I remember allows to identify web notifications from your application. While Edge's embedded gives Win32WebViewHost (for previous version), and for this new one, it shows a description for desktop notification from web viewer (in your locale) which doesn't give any way to notify users which application's the notification came from, i.e. all programs using WebView2 will notifiy (web notifications) with the same application identifier (hardcoded by Microsoft).
  11. vhanla

    borderless with aero shadow

    type TForm1 = class(TForm) Panel1: TPanel; procedure FormCreate(Sender: TObject); private { Private declarations } procedure WMNCCalcSize(var Msg: TWMNCCalcSize); message WM_NCCALCSIZE; public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin // to hide white 1px line in top DoubleBuffered := True; Panel1.Align := alClient; Panel1.BevelOuter := TBevelCut.bvNone; Panel1.Caption := ''; // enable DWMApi Shadow GlassFrame.Top := 1; GlassFrame.Enabled := True; end; procedure TForm1.WMNCCalcSize(var Msg: TWMNCCalcSize); begin // to hide caption bar Msg.Msg := WM_NULL; inherited; end; I was playing with this in Windows 10/Rio. I don't know if on other versions requires more adjustments (I guess so), but this was short code to achieve that. And it keeps system context menu, aero snap response too. I tried painting canvas to remove the 1 pixel white line at the top, no success, but `doublebuffered` set to true along a component occupying that part was enough.
  12. Thank you. Is there any way to know why the IDE crashed and closed itself without any warning? A log file or something? It just keeps closing itself for no reason, I start the IDE and after a while it hungs and closes right away, no warnings, nothing, it just closes randomly, no special steps.
  13. I just uninstalled Delphi 10.4 (trial ended) and reinstalled Delphi 10.3.3 CE, (had to activate again 2/3 because I reinstalled Windows 10 on the same machine "sigh SSD died" I lost the downloaded slip). Anyway, after reinstalling, windows registry were not updated TO 20.0 FROM 21.0 for each delphi files, I had to mannually update each registry in HKEY_CLASSES_ROOT, because opening those files from File Explorer tried to use 10.4 executable, file associations were kept from latest version. I had to pick BDS for each filetype from File Explorer (double click). At the end I'm reinstalling Delphi 10.3.3 once more, now this uninstaller (InstallAware) seems to delete registry entries for file associations, I'm doing it in case other registry entries not related to file associations are still trying to use 10.4's sadly, this old Installer/Uninstaller is slower than newer. Reinstalled and an error message shows on first launch. Definitely I'm having lot of issues with Delphi, I'm sad. I'm starting to believe that I have to switch to another programming language, which I don't want. OMG, second reinstall, file associations and launching them still not working. Maybe I should reinstall Windows 10 (2004 BTW). As usual, I'm backuping registry entries to reapply incase the license manager fails on IDE crash, which usually happens to me, restoring from registry entries saved me a lot of times, and migration tool was useless in that case, which forced me to reinstall (the nth times) I ended up with these icons using Open always with option, I can't differentiate them, maybe I will try to find out which icon index to update to on registry. Thanks for reading.
  14. vhanla

    Your RAD Studio 10.4 Sydney issues

    Classic Undocked layout is buggy, sometimes it causes to restart the IDE without any prompt, and LSP is slower to popup than previous version, maybe is just my installation.
×