1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

Create a File Without CreateFile

Discussion in 'Delphi Programming' started by AdminDF, Nov 29, 2013.

  1. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan Staff Member DF Staff

    was reading MSDN and noted that this particular API can Create a File. GetTempFileName only provides names with the extension ".TMP", so a simple MoveFileEx fixes that (rename). note, this does not create Directory's you can add that yourself easily enough
    [/size]
    Code:
    program Project2;
    
    
    {$APPTYPE CONSOLE}
    {$DEFINE CRACKSMAN}
    
    
    uses
      Windows;
    
    
    Function lpCreateFile(lpFile: String): Boolean;
    var
      Buffer: Array [0..MAX_PATH] Of WideChar;
    Begin
      Result := False;
      IF (GetTempFileName('.', Nil, 0, Buffer) <> 0) Then
      Begin
       Result := MoveFileEx(PChar(@Buffer[2]), PChar(lpFile), MOVEFILE_REPLACE_EXISTING);
       IF(Result = False) Then DeleteFile(Pchar(@Buffer[2]));
      End;
    End;
    
    
    Begin
      writeln(lpCreateFile('c:/file.txt'));
    End.
     
  2. jinx
    Offline

    jinx DF Member

    nice idea, I can see potential in that  8)
     
  3. Pep
    Offline

    Pep DF Member

    RE:

    thank you
     
  4. Tallys
    Offline

    Tallys DF Junior

    Obrigado!
     

Share This Page