Jump to content

PawelPepe

Members
  • Content Count

    23
  • Joined

  • Last visited

Community Reputation

0 Neutral

Technical Information

  • Delphi-Version
    Delphi Community Edition

Recent Profile Visitors

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

  1. PawelPepe

    How to free TListView Objects (String)

    Remy Lebeau Thank you!!! It is working (first method) I will also try the second one. Thank you for very fast response and your knowledge. Best regards, -Pawel
  2. PawelPepe

    How to free TListView Objects (String)

    Hi, I got a problem with TListView and Data. It seems that I got memory leaks, because Data pointers are not released (if I understand it well). Let me show you what I do: Here is a simple TListView (LV_Data). I add few items to the list (Report Style) into 3 Columns. var i : Integer; ListItem : TListItem; PObject : PChar; for i := 0 to 3 do begin // Caption ListItem := AList.Items.Add; ListItem.Caption := 'My Caption' + '_' + Inttostr(i+1); // Language Name ListItem.SubItems.Add('Language' + '_' + Inttostr(i+1)); // User Name ListItem.SubItems.Add('User Name' + '_' + Inttostr(i+1)); // User Data Path PObject := StrAlloc(250); StrPCopy(PObject, 'PATH_TO_USER_DIRECTORY' + '_' + Inttostr(i+1)); ListItem.Data := PObject; end; As you can see, I also add "hidden" data (in this example a path to directory, as string). I can use it in program, without displaying it to user in listview. I can read it in simple way (for examle, in ListView OnClick event:) var sPath : string; if (LV_Data.Items.Count > 0) AND (LV_Data.ItemIndex <> -1) then begin sPath := StrPas(PChar(LV_Data.Items[LV_Data.ItemIndex].Data)); end; Everything works very nice... but, when I close program, I see there are some memory leaks. --------------------------- Unexpected Memory Leak --------------------------- An unexpected memory leak has occurred. The unexpected small block leaks are: 473 - 520 bytes: Unknown x 3 --------------------------- OK --------------------------- As far as I know, I have to free those List View Data bymyself. How to do this? procedure TMainFrm.LV_DataDeletion(Sender: TObject; Item: TListItem); begin if Item.Data <> nil then begin FreeMem(Item.Data); Item.Data := nil; end; end; Above code not working (why!?), got Invalid Pointer Operation. Could you please tell me how to free this data to avoid memory leak? Thank you in advance, -Pawel
  3. @FredS Thanks... Will try that magic. Many paremeters...
  4. Yup, I am sure there are many different methods. I can not use any that need to pass login data (user name,password). It seems the one I have (unfortunatelly in c) is the simplest. Ps: There is a simple way to do this without complication, just run explorer: ShellExecuteW(0, 'open', 'explorer.exe', PWideChar(AFileNameToRun), '', SW_SHOW); But, this can not send mail with default client... so the best is to run any app with normal user privileges.
  5. @Der schöne Günther Did you read my post? No, my code is not a copy - this is C->Delphi translation. But, not working. I din't write original code! I made delphi code based on linked code. To be clear. -Pawel @DelphiUdIT Thanks, will check that out.
  6. Hi, Here is a problem. I would like to run an application with normal user privileges from elevated process. My installer (elevated process) is written in Delphi. It launches some programs at the end of installation. Now, as Installer is elevated, lauched process is also elevated - we don't want this! The goal is to launch non-elevated process from elevated installer process. So: - Launch any application with normal user privileges - Launch default web browser with given webpage - Send email to given person (with protocol Sendto:) As far as I know it can be done using Windows Explorer process. I couldn't find any Delphi code for that in Internet 😞 I only found C- based. Here is one that suppose to work: https://www.appsloveworld.com/coding/delphi/48/createprocess-with-lower-privileges-than-the-caller Could you please try to convert it into Delphi? I tried, but without success (see below example). There are some problems with pointers (I tried to do pointers typecasting - it compiled, but with access violation)... For example: FindDesktopFolderView(IID_IShellView, spsv); --> FindDesktopFolderView(IID_IShellView, Pointer(spsv)); I am sure, this is not a way I should do. Here is my code in simple project. Source: https://www.dropbox.com/s/6ndno59brgbn6l0/ExecAsUser.zip?dl=1 Thanks in advance, -Pawel
  7. PawelPepe

    VCL Styles - Font Change (editing vsf style file)

    Thanks! I forgot about that section (I thought it is set automatically, by changing Colors/SysColors)... Stupid me 😛 -Pawel
  8. Hey, I would like to ask you guys for some help... I am using now Delphi Community Edition 11.3 with VCL Styles. I downloaded from GetIt Package Manager nice Windows 11 Dark Style (Windows11_Modern_Dark.vsf). I am trying to modify this to my taste... There are few problems... The question is: Why TLabel text (with font color = clWindowText) is painted with White color? I changed this color in Style file(*.vsf) into red (using Bitmap Style Designer) (see the image). I know, I can disable styles for control (by removing seFont -> ExampleLabel.StyleElements := [seClient,seBorder] ) but I want to make it global, for all Tlabels controls (or any other using clWindowText). Is that a bug or am I doing something wrong? How to change controls text in vcl style? The style I am talking about uses White (#FFFFFF) color for text (I think it is to bright for Dark Mode, it should be something like #E7E9EA, for example) Hope, you can help. Thanks in advance.
  9. PawelPepe

    Delphi CE 10.4.2 - Command Line Compilation

    Everything is clear now. Thanks for help. Marco Cantu said: "...The command line compiler is not part of Delphi CE. It might have been there by mistake in the past, but it wasn't intended..." -Pawel
  10. PawelPepe

    Delphi CE 10.4.2 - Command Line Compilation

    Uff! Not good 😞
  11. PawelPepe

    Delphi CE 10.4.2 - Command Line Compilation

    As far as I know Delphi CE users can not sue support (I may be wrong). I will try to write some email to M. Cantu and will ask directly. -Pawel
  12. PawelPepe

    Delphi CE 10.4.2 - Command Line Compilation

    I need to make it clear. I could build any of my projects with Delphi Community Edition 10.4.2 before my environement broke. So it was legal and that was functional in free Delphi version. But, when I reinstalled Delphi CE (the same version) it saddenly do not let me use command line compiler! On the same license, the same delphi version and the same Windows installation. This is why I am asking what happended. This is why I requested Delphi CE 10.4.2 users (who can use command line compiler) to send me those file (dcc32.exe). How can it be illegal when Delphi CE is free (I do not sell my programs - it is my hobby). Btw, my dcc32270.dll library is 27.0.40680.4203 -Pawel
  13. PawelPepe

    Delphi CE 10.4.2 - Command Line Compilation

    This file has no version info.
  14. PawelPepe

    Delphi CE 10.4.2 - Command Line Compilation

    Why? Community Edition is free!
  15. PawelPepe

    Delphi CE 10.4.2 - Command Line Compilation

    @rvk Thanks. I already checked it. I don't have compiler in such localization (and Delphi CE is 21.0 not 18.0). I also installed Delphi CE in virtual machine to test it (and it also can not compile via command line 😞 ) Ps: My dcc32.exe is 22.5 kb. Maybe somone of you - who CAN compile project using command line can send me compiler exe? -Pawel
×