[Delphi\Object Pascal] Help with threads

Discussion in 'Mixed Languages' started by PAYMYRENT, Dec 5, 2012.

  1. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,462
    419
    60
    #1 PAYMYRENT, Dec 5, 2012
    Last edited by a moderator: Apr 20, 2017
    hey i was wondering if anyone here knows how to do this in delphi/OP

    Me.Invoke(new UpdateMenuCallback(AddressOf UpdateMenu), New Object {menu})

    i got the thread to execute but i cant update the menu with the new wmi information :(

    this is where i need to do it :D

    Code:
    
    procedure MemoryManagement.Execute;
    var
     loop: Integer;
     w: Integer;
    begin
      loop_main := 1;
      loop := loop_main;
    
      while (loop = 1) do
      begin
    
      if (loop_main =0) then exit;
    
      for w := 0 to 20 do
        begin
        EmptyWorkingSet(GetCurrentProcess());
        sleep(1000);
        end;
      end;
    end;
    
    
     
  2. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,462
    419
    60
    #2 PAYMYRENT, Dec 5, 2012
    Last edited by a moderator: Apr 20, 2017
    (OP)
    woohoo i got it lol

    Code:
    
    procedure MemoryManagement.Execute;
    var
     loop: Integer;
     w: Integer;
    begin
      loop_main := 1;
      loop := loop_main;
    
      while (loop = 1) do
      begin
    
      if (loop_main =0) then break;
    
      for w := 0 to 20 do
        begin
        EmptyWorkingSet(GetCurrentProcess());
        sleep(1000);
        end;
        Synchronize(UpdateMenu);
      end;
    end;