Jump to content

alogrep

Members
  • Content Count

    173
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

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

  1. HI. I don't know if I am on the right track. After a lot ot research, I came up with this scheme. I am stuck in get1Proc: I do not knoow how to get the handle of the control taht sent the message. mHook := SetWindowsHookEx(CM_VISIBLECHANGED ,@get1proc, hInstance, 0); function get1Proc(nCode, wParam, lParam : integer) : integer; stdcall; begin how do i get the handle of the control that sent this message to be used in Findcontrol()? end;
  2. alogrep

    styleElements and font.color

    Thank you. it worked.
  3. Thanks Remy. I am talking aboutn the Component ->Install Packages list. Is there a way to get a list of them to print or to save to a file?
  4. alogrep

    styleElements and font.color

    HI. I just can't get to change the text color of a statictext; I have this code: num:=TStaticText.create(self); num.parent:=self; num.parentcolor:=false; num.StyleElements:=[]; rect:=wc.boundsrect; num.caption:=' '+inttostr(lastnumnum)+' '; num.font.name:='Arial'; num.font.color:=clred; I have tried setting StyleElements to sefont, to seclient, and also left it alone (seclient, sefont, seborder).. THe texct color is always black. They have made this really hard to change! Anybody knows the "magic trick" to change the color on a runtime created statictext? P.S. if the statictext is created at design time, Style Elements is all set (3), AND IT WORKS LIKE A CHARM.
  5. HI I hope someone can help. The docwiki states: EnumModules continues until the last module in the application is enumerated, or until the callback function returns False. Bu the code below omnly shws the Application name,. Where is my error? function GetModules(Instance: THandle; Data: Pointer): Boolean; var FileName: array[0..Max_Path] of Char; begin if GetModuleFileName(Instance, FileName, SizeOf(FileName)) > 0 then Tlistbox(Data).items.Add(FileName) else RaiseLastWin32Error; Result := True; end; EnumModules(GetModules, ListBox1);
  6. alogrep

    Show a Form from inside a Thread

    Thank you very much Remy. That was it. Problem solved.
  7. alogrep

    Show a Form from inside a Thread

    Sorry. This line was wrong. Printque is a Form created in the Main Thread, just before calling this thread. shold have been Printque is a Form created in the Main Thread,
  8. alogrep

    Show a Form from inside a Thread

    HI. I hope someone can give me a hint here. Printque is a Form created in the Main Thread, just before calling this thread. Its Formcreate contains this line: Tstuckthread.Create(Tprintqueue(self),printernames); The problem is in the showform procedure at the line .A.show It gives no error, but the app becomes unresponsive. The main form is hidden, and I have to stop the app.I Tstuckthread= class(TThread) private FForm: TFORM; L:tSTRINGLIST; function STUCK(title:string;l:Tstringlist): boolean; procedure listjobs(allprinters: string); protected public constructor Create(ownerForm:TFORM;printernames:string; ARUNS: INTEGER=0); destructor Destroy; override; procedure Execute(); override; procedure showform; published end; constructor Tstuckthread.Create(ownerForm: TFORM;printernames: string;ARUNS: INTEGER=0); begin L:=tSTRINGLIST.CREATE; FForm:= ownerForm; Self.FreeOnTerminate := True; inherited Create; end; destructor Tstuckthread.Destroy; begin inherited; L.FREE; end; procedure Tstuckthread.Execute; begin done :=FALSE; while not Terminated AND NOT done do begin <get printjobs list and save it in L......> if L.count>0 then BEGIN /// fine HERE Tprintqueue(FForm).MEMO1.LINES.ASSIGN(L); // fine HERE Synchronize(SHOWForm); SLEEP(500); END; DONE:=TRUE; end; end; And here is the showform() procedure; procedure Tstuckthread.showform; VAR A: Tprintqueue; begin A:=Tprintqueue(FForm); TRY IF NOT A.VISIBLE THEN A.show; // PROBLEM HERE. EXCEPT a.free;// 4 testing. It never gets there. END;
  9. HI. my package builds ok. But trying to install results in the error The specified module could not be found. I read all the posts I could find on this. it is almost impossible to find the real problem. Could this info get to shade some light? In Process monitor i see these 2 lines with Result NAME NOT FOUND (each repeated twice) C:\Users\1\AppData\Roaming\Embarcadero\BDS\23.0\UserTools.proj C:\HMXE_A\MYCOMPONENTS\mine2.deployproj tHE DPK IS C:\HMXE_A\MY COMPONENTS\MINE2.DPK And the mine2.bpl IS there. P.S. Dependexny walker gives me many many errors on microsoft dlls ???
  10. alogrep

    ​LOST DEBUGGER ON EDIT ERROR timeout trigger.

    Thanks Peter. I find it strange that a question answered at runtime makes a persistent change in the IDE options. Anyway I went further and found out the method of setting those options on the breakpoints-> Advanced. To me it sounds obvious that the debugger intercept the exception before the try/except block. It does not seem so obvious to me that there is ONLY an option to ignore the exception (then it does not even trigger the OnEditError, for example). I would have expected a sub-option: catch it but do not show notification to the end-user. ..
  11. II I have table1.Edit and it stays there indefinitely on one PC, when I do the same (on exactly the same record on another PC, it does not give me any error: it just goes on and I can even POST it. This happens in the last few hours. Until then It worked fine. I was trying to see why in the oneditError, although I had Action= dsAbort it still showed a message, although the documentation says and it would not. In that message window there was a checkbox "Ignore this error in the future" (or something to that effect) that I marked, Since then the lock timeout error does not get triggered. Any help rom anybody, please?
  12. THI. I have the piece of code show below. when it gets to the line FWMIService := FSWbemLocator.ConnectServer it simply opwns the CPU window and does never get tot except section. Running Delphi 12.1 on win 64bit. (The second piece of code shows how the procedure is called). Any idea anybody? procedure GetWin32_PrintJobInfo; const WbemUser =''; WbemPassword =''; WbemComputer = 'localhost'; wbemFlagForwardOnly = $00000020; var FSWbemLocator : OLEVariant; FWMIService : OLEVariant; FWbemObjectSet: OLEVariant; FWbemObject : OLEVariant; oEnum : IEnumvariant; iValue : LongWord; str:String; begin; FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); try FWMIService := FSWbemLocator.ConnectServer('192.168.1.70', 'root\CIMV2', WbemUser, WbemPassword); except on E:EOleException do writeln(e.message); on E:sysutils.Exception do writeln(e.message); end; begin try CoInitialize(nil); try GetWin32_PrintJobInfo; finally CoUninitialize; end; except on E:EOleException do Writeln(Format('EOleException %s %x', [E.Message,E.ErrorCode])); on E:Exception do Writeln(E.Classname, ':', E.Message); end;
  13. HI. I have this scheme (pseudocode) rery+0 repeat starttransaction; try table1.edit;. change table1; table1 post; commit; except on E: SysUtils.Exception do begin Rollback; table1 cancel inc(retry); if retry>=3 then showmessage & exit else sleep(500); end; end; until retry>=3; end; In table1 OnPostError I have begin ACTION:=DAaBORT; end; Why do I get the error message (regarding a conflict with other users)? That defeats the purpose of the start transaction/commit/rollback setup. DaAbort should NOT show the message, correct? My intent is to retry the edit/post operation 3 times, but if a message shows up with one user, by the time it reads it and closes it, other concurrent users get a timeout error.
  14. alogrep

    On Posterror real error ;

    Hi. I have this event procedure Tdm2.APostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); begin ACTION:=DAaBORT; end; Then this piece of pseudocode try table.1.edit; table1.post except on E: SysUtils.Exception do begin if islockerror(e.errocode) then repeatit() else dosomethingelse();; end; end; The function islockerror() checks if the error code is one of timeut, table locked, etc. It always returns false because the E.errorcode is always "Operation aborted". How can I get the value of the REAL error that triggered the event? Thanks
  15. alogrep

    Thread leaks report (FastMM4)

    You are right Remy. They come from nexusdb dcu's (nxBaseServerComp, nxServerManager). I will ask them. Thanks
×