All pastes #590864 Raw Edit

Stuff

public text v1 · immutable
#590864 ·published 2007-06-26 20:32 UTC
rendered paste body
program Keygen;

uses
     MiniFMOD, Messages, Windows;

const
     ID_DLGMAIN     = 'MAIN';
     ID_TITRE       = 100;
     ID_LNAME       = 1000;
     ID_LSERIAL     = 1001;
     ID_ENAME       = 2000;
     ID_ESERIAL     = 2001;

var
     hDlg           : DWord = 0;
     hName          : hWnd = 0;
     hSerial        : hWnd = 0;

{$R Keygen.res}
{$include KeygenAlgo}

procedure SetTransparence(hWnd:THandle;Pourcentage:integer);
begin
     SetWindowLongA(hWnd,GWL_EXSTYLE,GetWindowLongA(hWnd,GWL_EXSTYLE) or WS_EX_LAYERED);
     SetLayeredWindowAttributes(hWnd,0,pourcentage,LWA_ALPHA);
end;

function KeygenDialog(hWnd:hWnd;uMsg:DWord;wParam:wParam;lParam:lParam):bool;stdcall;
var
     Police    : LOGFONT;
     Stylo     : HPEN;
begin
     Result := true;
     case uMsg of
          WM_CREATE :
          begin

          end;

          WM_INITDIALOG :
          begin
               SetWindowText(hWnd,MainTitre);
               SetDlgItemText(hWnd,ID_TITRE,MainTitre);
               SetDlgItemText(hWnd,ID_LNAME,LabelName);
               SetDlgItemText(hWnd,ID_LSERIAL,LabelSerial);
               SetDlgItemText(hWnd,ID_ENAME,EditName);

               XMPlayFromRes('XM','MUSIC');

               SetTransparence(hWnd,220);

               hName := GetDlgItem(hWnd,ID_ENAME);
               hSerial := GetDlgItem(hWnd,ID_ESERIAL);

               GetName;

//               Stylo := CreatePen(PS_SOLID,2,RGB(224,190,56));
//               Rectangle(wParam,20,60,120,100);
//               SelectObject(wParam,Stylo);               
          end;

          WM_LBUTTONDOWN :
          begin
               SendMessage(hWnd,WM_SYSCOMMAND,SC_MOVE+2,0);
          end;

          WM_CTLCOLORSTATIC :
          begin
               SetBkMode(wParam,TRANSPARENT);
               if (lParam=GetDlgItem(hWnd,ID_ESERIAL)) then
                    SetTextColor(wParam,RGB(224,190,56))
               else if (lParam=GetDlgItem(hWnd,ID_TITRE)) then
               begin
                    GetObject(SendMessage(hWnd,WM_GETFONT,0,0),SizeOf(LOGFONT),Addr(Police));
                    Police.lfWeight := FW_BOLD;
                    SelectObject(wParam,CreateFontIndirect(Police));
                    SetTextColor(wParam,RGB(224,190,56));
               end
               else
                    SetTextColor(wParam,RGB(255,255,255));
               Result := LongBool(CreateSolidBrush(RGB(0,0,0)));
          end;

          WM_CTLCOLOREDIT :
          begin
               SetBkMode(wParam,TRANSPARENT);
               SetTextColor(wParam,RGB(224,190,56));
               Result := LongBool(CreateSolidBrush(RGB(0,0,0)));
          end;

          WM_CTLCOLORDLG :
          begin
               Result := LongBool(CreateSolidBrush(RGB(0,0,0)));
          end;

          WM_CLOSE :
          begin
               EndDialog(hWnd,0);
          end;

          WM_DESTROY :
          begin
               PostQuitMessage(0);
          end;

          WM_COMMAND :
          begin
               if ((lParam=GetDlgItem(hWnd,ID_ENAME)) and (HIWORD(wParam)=EN_CHANGE)) then
                    GetName;
          end
          else
               Result := false;
     end;
end;

begin
     hDlg := DialogBoxParam(HInstance,MAKEINTRESOURCE(ID_DLGMAIN),0,@KeygenDialog,0);
end.