PDA

View Full Version : Full Screen & Encoding Files.



Septimus
29-06-2003, 09:31 AM
I was just wondering how to make programs full screen. I read somewhere that making the width and height of the form the same as the screen would do it, but the form's title bar and the windows task bar still show up on the screen. The task bar shows over the form.

Also how do you save information from your program without the file showing up as easily editable words and numbers? If you get my meaning. So far all I can do is read and write words and numbers from a simple ascii file, I want to somehow encode the files to prevent cheating.

Harry Hunt
29-06-2003, 10:36 AM
You have to set the border-style of your for to bsNone.

Also, there are several ways to encode text. An efficient and easy method is to XOR each character in a string with a value. This is hard to reverse unless you have the proper key.
Here's some code. It's not mine... found it somewhere but don't remember where

const
C1 = 52845;
C2 = 22719;

function Encrypt(const S: String; Key: Word): String;
var
I: byte;
begin
Result[0] := S[0];
for I := 1 to Length(S) do begin
Result[I] := char(byte(S[I]) xor (Key shr 8));
Key := (byte(Result[I]) + Key) * C1 + C2;
end;
end;

function Decrypt(const S: String; Key: Word): String;
var
I: byte;
begin
Result[0] := S[0];
for I := 1 to Length(S) do begin
Result[I] := char(byte(S[I]) xor (Key shr 8));
Key := (byte(S[I]) + Key) * C1 + C2;
end;
end;

WILL
29-06-2003, 09:21 PM
If you want your program to hide the task bar while it's running and return it once finished you can do this:
procedure TForm1.FormCreate(Sender: TObject);
begin
ShowWindow(FindWindow('Shell_TrayWnd', nil), SW_HIDE);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ShowWindow(FindWindow('Shell_TrayWnd', nil), SW_SHOW);
end;

Make sure that you return the task bar after you've hidden it or you'll end up being screwed when it comes time to actually need it.