gioma
Members-
Content Count
136 -
Joined
-
Last visited
-
Days Won
1
Everything posted by gioma
-
sorry, I was wrong to answer.
-
I just emptied the folder, kept only "Layout.ini" and "PfPre_a24c160c.mkd" but the behavior doesn't change. In that folder the program generated by Delphi doesn't seem to have the right manifest and therefore if I change the resolution it gets deformed.
-
Greetings, I would need that my program to be able to detect that a print has been launched in the operating system and to which printer. I was thinking of using HOOKs, like I do for keyboard and mouse events. I was studying the hooks available on Windows but I still haven't been able to figure out which one can do for me. Can any of you give me some suggestions? Thank you
-
I found SpyPrinter for Delphis on the embarcadero site that is right for me, if someone else will need it here is the link: http://cc.embarcadero.com/item/20307 🤩 DAJE!
-
Sounds like a good start, thanks.
-
I created two visual components, one referencing the other in the published properties. Example: TComponentA = class(TComponent, IComponentAl) [weak] _ComponentB: TComponentB; //...other code private procedure SetCopmponentB ( const Value: TComponentB); //.. other code published property ComponentB: TComponentB read _ComponentB write SetCopmponentB; //.. other code procedure TComponentA.SetCopmponentB(const Value: TComponentB); begin try _ComponentB := Value; //.. other code except on e:exception do WriteLog('[TComponentA.SetCopmponentB] EX: ' + e.Message); end; end; in the design phase, I add the two components ComponentA: TComponentA and ComponentB: TComponentB in the form. By Deisngh i set the property ComponentA.ComponentB: = ComponentB. Then if I delete ComponentA from design I have no problems, if instead I delete componentB (which is associated with the property of componentA) then Delphi goes into an exception unended loop. What should I add to the code to prevent this from happening?
-
Custom Component : onDestroy delphi creates endless error messages
gioma replied to gioma's topic in VCL
It's a great idea, I did a similar thing, but the IDE got stuck anyway. -
Custom Component : onDestroy delphi creates endless error messages
gioma replied to gioma's topic in VCL
I was a hobbyist when I was 12 and I was programming in Basic with the Vic20.. Visual studio professional has a lower price base. Yes, I understand that the error was caused by me, the IDE must rightly report it to me, but then it cannot go into an infinite loop of errors. I have been developing with Delphi for many years (more than 16), but there are many aspects of programming and you never stop learning. I don't often have to create a component, I usually buy them, use them and modify them if necessary. In this case I had to make a component from 0, so I was faced with new problems for the first time. I am not frustrated, but I expect that if I make a mistake I can analyze it, understand it and fix it. If the IDE goes into an endless loop of errors I can't do anything anymore. Sometimes for example it happens that when I update the component, if I go to recompile delphi it blocks the BPL file. The only way I have to re-install it is to close and reopen Delphi. These are time wasters that you would not want to encounter when you have to develop in precise timing. -
Custom Component : onDestroy delphi creates endless error messages
gioma replied to gioma's topic in VCL
sorry for the outburst, but sometimes it's really frustrating to work with Delphi .. you waste a lot of time with nonsense! -
Custom Component : onDestroy delphi creates endless error messages
gioma replied to gioma's topic in VCL
The shocking thing though is that if you make a mistake in creating a component and then install it, Delphi goes into an unending error loop and you are forced to close it from the task manager! The IDE is still not very stable, although it costs a lot and its competitors are free! I have been using Delphi for 16 years (Delphi 5, 7, delphi 2005 .. up to Delphi 11 Alexandria), in the beginning it was much better than Visual Studio .. now it is far behind and the updates are very, very, very slow to come out .. Visual studio has updates every week! And I repeat .. Visual Studio is free! -
Custom Component : onDestroy delphi creates endless error messages
gioma replied to gioma's topic in VCL
Right, you are right! I have used weak on other occasions with Interfaces, in this case it is a TObject so it makes no sense to use it. Distraction error Thanks again! -
Custom Component : onDestroy delphi creates endless error messages
gioma replied to gioma's topic in VCL
I need the weak parameter, because in real use they are two components that refer to each other. I solved it using the notification mechanism . Thank you! -
Custom Component : onDestroy delphi creates endless error messages
gioma replied to gioma's topic in VCL
Thanks a lot, now I try. But it's amazing that Delphi becomes impossible to close for this reason. The error message loop is endless! -
Hello everyone, I'm facing a problem with Delphi Alexandria. In some cases I would like not to show the main form of the project. To do this, simply use the following code: //... other preliminary operations Application.Initialize; Application.Title := GF_GetAppName; Application.MainFormOnTaskbar := True; Application.CreateForm(TPrimaryForm, PrimaryForm); if pos('-NOSHOW', UpperCase(CmdLine)) > 0 then begin Application.ShowMainForm := False; PrimaryForm.visible:=false; end; Application.Run; Obviously the project is quite complex, but these instructions should be enough to stop the Main Form from doing the "Show" event. In debugging, on the other hand, I realized that when it executes the line Application.CreateForm(TPrimaryForm, PrimaryForm); The show event of the form is executed, before: Application.Run; Then the instructions are executed: Application.ShowMainForm: = False; PrimaryForm.visible: = false; which hide the main form, but I didn't want it to be shown at all. finally executes Application.Run; and at this point I expect that the form (if the -NOSHOW parameter is not passed) activates the onShow event and not that it is activated instead by the "Application.CreateForm" statement Why does this happen? What am I missing?
-
Application.CreateForm : Shows Main form before Application.run
gioma replied to gioma's topic in VCL
Eventually I got to the heart of the problem. There is a thread in the program that uses the pipe to communicate with other programs. In particular, the program receives a message to its pipe when it is started but an instance of it already exists in that session. It does the same thing even when it's hidden and double-clicked on the TryIcon. This message instructs the application to show itself and put itself in the foreground. However, if the program is hidden, this instruction blocks both the pipe thread and the main thread. There was no synchronization with the main thread. -
Application.CreateForm : Shows Main form before Application.run
gioma replied to gioma's topic in VCL
Ok, I solved the problem with the example : procedure TFmainFormDef.FormCreate(Sender: TObject); var T:TThread; begin T:=TThread.CreateAnonymousThread( Procedure begin TThread.Sleep(2000); TThread.Synchronize(nil, procedure begin FmainFormDef.Visible:=true; end); end); T.FreeOnTerminate:=true; T.Start; end; The statement that makes the form visible had to be synchronized with the main thread. At this point I think the problem is related to the components. -
Application.CreateForm : Shows Main form before Application.run
gioma replied to gioma's topic in VCL
in the original project use of graphic components. In that case I have problems with the visualization of these components (buttons, labels, etc.) .. All this always if the form has the visible = false property. It is probably a component problem, but the fact that with standard components I get such an error makes me think there is so much more. -
Application.CreateForm : Shows Main form before Application.run
gioma replied to gioma's topic in VCL
Simple example: main Form unit MainFormDefault; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Buttons, Vcl.StdCtrls, Vcl.ExtCtrls; type TFmainFormDef = class(TForm) Panel1: TPanel; Panel2: TPanel; ComboBox1: TComboBox; SpeedButton1: TSpeedButton; procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private declarations } public { Public declarations } end; var FmainFormDef: TFmainFormDef; implementation {$R *.dfm} procedure TFmainFormDef.FormClose(Sender: TObject; var Action: TCloseAction); begin Action:=CaFree; end; procedure TFmainFormDef.FormCreate(Sender: TObject); var T:TThread; begin T:=TThread.CreateAnonymousThread( Procedure begin TThread.Sleep(2000); FmainFormDef.Visible:=true; end); T.FreeOnTerminate:=true; T.Start; end; end. File .dpr program TestHideMainForm; uses Vcl.Forms, MainFormDefault in 'MainFormDefault.pas' {FmainFormDef}, MainForm in 'MainForm.pas' {FmainForm}; {$R *.res} begin Application.Initialize; Application.MainFormOnTaskbar := True; Application.CreateForm(TFmainFormDef, FmainFormDef); Application.ShowMainForm:=false; FmainFormDef.Visible:=false; Application.Run; end. Here I start a simple program in hidden mode, then with a simple thread I simulate an event that shows it. In this case everything goes smoothly but when I close the program I get this error: -
Application.CreateForm : Shows Main form before Application.run
gioma replied to gioma's topic in VCL
It's a very big project, so it's hard for me post the code. Basically the program connects to a socket server and performs some operations. If started by another program, which is installed as a server, the program starts hidden, with an icon on the tray bar. The operations it performs with the socket server update the interface (with messages, buttons/pannels that become visible / invisible). If I start the program and the main form has the option visible=true in the object explorer everything works fine. Otherwise, if the program is hidden, when the interface is shown it presents transparent pieces as if it had not been able to draw it and then freezes until it crashes. -
Application.CreateForm : Shows Main form before Application.run
gioma replied to gioma's topic in VCL
Yes, indeed it is true. Trivially the problem is that. But now I have another problem. I create and modify objects of PrimaryForm at runtime (including frames) and it happens that if I set PrimaryForm.visible = false in the Object Inspector when I make the window visible again (show or visible=true) the program remains blocked, as if it could not redraw the interface. In the code I have no errors, all the instructions are executed without problems, but when I view the window it remains frozen, as if it could not redraw it. -
I have an application that uses a TDirect2DCanvas to render an image stream. However, I noticed that the iterpolation used is only Linear (Direct2D 1.0), but if I wanted to use those introduced with Direct2D 1.1 (bicubic, etc.) i would have to add unit Winapi.D2DMissing. Now the problem is that the TDirect2DCanvas does not use ID2D1DeviceContext (added in Winapi.D2DMissing) as the rendering target but ID2D1RenderTarget. I can't figure out how to use the new Direct2D 1.1 features. Anyone has any ideas?
-
D2D1Missing - Direct2D 1.1 ID2D1DeviceContext : How to use it?
gioma replied to gioma's topic in VCL
it seems incredible but it seems to work, there is a difference between the various interpolations. -
D2D1Missing - Direct2D 1.1 ID2D1DeviceContext : How to use it?
gioma replied to gioma's topic in VCL
So I could start from the Vcl.Direct2D unit to create a unit that uses DirectD2 1.1..mm.. it could be an indea. For now I have done this and it seems to work, but I don't know if I use Direct2D 1.1 at 100% _scale := width / _HostDesktopWidth; IMGpitch:=_HostDesktopWidth*4; if (DesktopFrame=nil) or ( _DesktopFrameRect.right <> _HostDesktopWidth ) or ( _DesktopFrameRect.bottom <> _HostDesktopHeight ) then begin _DesktopFrameRect.left:=0; _DesktopFrameRect.right:=_HostDesktopWidth; _DesktopFrameRect.top:=0; _DesktopFrameRect.bottom:=_HostDesktopHeight; BitmapProp.DpiX := 0; BitmapProp.DpiY := 0; BitmapProp.pixelFormat.Format := DXGI_FORMAT_B8G8R8A8_UNORM; BitmapProp.pixelFormat.AlphaMode := D2D1_ALPHA_MODE_IGNORE; _FD2DCanvas.RenderTarget.CreateBitmap(D2D1SizeU(_HostDesktopWidth, _HostDesktopHeight), _IMGBuffer, IMGpitch, BitmapProp, DesktopFrame); WriteLog('[Paint] CreateBitmap '+intToStr(_HostDesktopWidth)+'x'+intToStr(_HostDesktopHeight) ); end else begin _DesktopFrameRect.left:=0; _DesktopFrameRect.right:=_HostDesktopWidth; _DesktopFrameRect.top:=0; _DesktopFrameRect.bottom:=_HostDesktopHeight; DesktopFrame.CopyFromMemory(_DesktopFrameRect,_IMGBuffer,IMGpitch); end; if _firstRender then begin _ConnectionStartedAt:=GetTickCount; ComputeTransform; _firstRender:=false; end; _FD2DCanvas.RenderTarget.SetTransform(_FTransform); LRect.left:=0; LRect.right:=_HostDesktopWidth; LRect.top:=0; LRect.bottom:=_HostDesktopHeight; (_FD2DCanvas.RenderTarget as ID2D1DeviceContext ).DrawBitmap(DesktopFrame,LRect,1, _InterpolationMode); -
D2D1Missing - Direct2D 1.1 ID2D1DeviceContext : How to use it?
gioma replied to gioma's topic in VCL
I use Delphi Alexandria and when compiling the example projects there are many errors due to missing {$IFDEF FPC} and if I set FPC between the conditional defines there are commands that don't exist in Delphi. I use Delphi Alexandria and when compiling the example projects there are many errors due to missing {$IFDEF FPC} and if I set FPC between the conditional defines there are commands that don't exist in Delphi. -
D2D1Missing - Direct2D 1.1 ID2D1DeviceContext : How to use it?
gioma replied to gioma's topic in VCL
Thanks but It doesn't work on Delphi , it needs many corrections 😞