RE: Breaking a string apart at a set point.

2006-07-13 Thread Jeff Young
Well, I figured it out myself. It's built into Delphi. WrapText...

I feel silly.

-Original Message-
From: Jeff Young [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 12, 2006 11:15 PM
To: 'Borland's Delphi Discussion List'
Subject: Breaking a string apart at a set point.

I've googled the death out of this and can't find a suitable answer to my
dilemma. I need to break a string at the nearest word at a set point. 65
characters to be exact. The old FoxPro database I'm forced to write to for
backwards compatibility is set up that way. And for some reason the logic
eludes me.

So I need to break a line of text at the last word prior to every 65th
character. It should also break on #13#10 as well to maintain formatting.

Any ideas out there?

Thanks,

Jeff Young

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Breaking a string apart at a set point.

2006-07-13 Thread Jeff Young
I've googled the death out of this and can't find a suitable answer to my
dilemma. I need to break a string at the nearest word at a set point. 65
characters to be exact. The old FoxPro database I'm forced to write to for
backwards compatibility is set up that way. And for some reason the logic
eludes me.

So I need to break a line of text at the last word prior to every 65th
character. It should also break on #13#10 as well to maintain formatting.

Any ideas out there?

Thanks,

Jeff Young

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


RE: similiar to opening a csv file in default program

2006-07-10 Thread Jeff Young
Welcome. Just wish I could find you the good version of that, but it seems
to have disappeared from my archives. The good version of it used named
pipes instead of a disk file. I resorted to named pipes in the end because 
GetTempPath would fail on some (10%) of the server systems I encountered and
the path had to be hardwired in. Hopefully that will work for you.

>>Lovely!  Thanks, Jeff
>>-Rich



___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


RE: similiar to opening a csv file in default program

2006-07-09 Thread Jeff Young
Rich,
Thought I'd chime in with code that I've used for the very same
process. It worked on D7... HTH.


unit Process;

interface

uses
Classes, Windows, SysUtils;

function ExecuteWait(Path, Command, Params: String; ShowWindow: Word;
Output: TStringList): DWord;
function GetTempFile: String;

implementation

function ExecuteWait(Path, Command, Params: String; ShowWindow: Word;
Output: TStringList): DWord;
// Build a temporary filename ---
var
  StartupInfo: TStartupInfo;
  ProcessInfo: TProcessInformation;
  saAttr: TSecurityAttributes;
  hOut, hInp: THandle;
  outFile, inpFile: String;

begin
  if Path = '' then begin
Output.Add('Path not specified: ' + Path);
exit;
  end;// if Path
  saAttr.nLength := sizeof(TSecurityAttributes);
  saAttr.bInheritHandle := True;
  saAttr.lpSecurityDescriptor := nil;
  hOut := STD_OUTPUT_HANDLE;
  hInp := STD_INPUT_HANDLE;

  if Output <> nil then begin
outFile := GetTempFile;
hOut := CreateFile(PChar(outFile),
 
GENERIC_READ or GENERIC_WRITE,
   0,
   @saAttr,
   CREATE_ALWAYS,
   FILE_ATTRIBUTE_TEMPORARY,
   0);
  end; // if Output <> nil

  ZeroMemory(@ProcessInfo, SizeOf(TProcessInformation));
  ZeroMemory(@StartupInfo, SizeOf(TStartupInfo));

  with StartupInfo do begin
cb  := SizeOf(TStartupInfo);
hStdOutput  := hOut;
hStdError   := hOut;
hStdInput   := hInp;
wShowWindow := ShowWindow;
dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
  end; // with

  if CreateProcess(nil,
 PChar('"'+
Path + Command + '" ' + Params),
   @saAttr,
   @saAttr,
   True,
   0,
   nil,
   PChar(Path),
   StartupInfo,
   ProcessInfo) then begin
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
repeat
  GetExitCodeProcess(ProcessInfo.hProcess, Result);
  //Application.ProcessMessages;
until (Result <> STILL_ACTIVE);
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);
if Output <> nil then begin
  CloseHandle(hOut);
  Output.LoadFromFile(outFile);
end; // if Output <> nil
DeleteFile(inpFile);
DeleteFile(outFile);
  end // if CreateProcess(...
  else
Output.Add('Create Process failed. Code: ' +
 IntToStr(GetLastError()));
end; //

function GetTempFile: String;
var
  DirBuf, FileBuf: Array [0..255] of char;
begin
  GetTempPath(Length(DirBuf), DirBuf);
  GetTempFileName(DirBuf, 'tmp', 0, PChar(@FileBuf));
  Result := FileBuf;
end;//GetTempFile

end.


___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


RE: LITE security / licensing aid

2006-03-29 Thread Jeff Young
Cosmin, 
I'm going to throw my .02 in on this one. I designed a multi use
security system using ASProtect and a custom component I created. It enabled
the key to store multiple lines of options and data. Something to the effect
of... 

User Name
2 //Number of Users allowed 
Pro //Mode to run in.
127.0.0.1

Basically, this data was encrypted with ASProtect and stored in a simple
text file. On run ASProtect would decrypt the data and the custom component
would decide which options to turn on in the program. Without the file
present the program wouldn't run. If the IP of the machine wasn't in the
decrypted file, it wouldn't run. (This was a server based internet only app)
Etc... 

If the user needed a new key file, they had to contact us.

An addition that was never used was a date downloaded/date to expire entry.

If this sounds like something you would be interested in, I could remove the
company specific info and send it to you. You would need a copy of ASProtect
to make it work though.

HTH,

Jeff Young
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Cosmin Prund
Sent: Friday, March 24, 2006 1:43 PM
To: Moderated discussion list about programming with Borland's Delphi
Subject: LITE security / licensing aid

Hello everyone!

I'm working on securing some of my applications right now. I've managed to
get "on/off" security working (ie: you're ether licensed or you're not
licensed) but now I'd like to add a few tones of "gray". Essentially I'd
like to add the ability to delay activating the product for a while. This
requires some storage for number of "runs" or "expiry date".

I KNOW there's no real way of securing any piece of data on a client's
system but I'm not really facing real crackers so a "so/so" solution would
work. The thing I'm mostly afraid is the situation where someone would
stumble across my "data" and simply delete it! That would make my
application think it was freshly installed and provide the client with a
fresh "free" period! That's not good.

I mostly think I know the solution: I just need to write the same data into
multiple places so the user would not find them all. But then comes the
question: Where exactly do I write this data so the user would NOT consider
I'm invading his space?

I'm considering:

1) My "Program Files" folder. This is very obvious and the user is likely to
find it.
2) The "Application Data" folder for the current user. This doesn't exist on
Win9X machines!
3) My registry key (under the HKCU\Software\MyCompany key). This would be
easy to spot too.
4) Some other, better, yet polite hiding place :)

Anyone been here before?
Anyone has other good ideas?

Thanks for your input!
Cosmin Prund


___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi

___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi


Sending sound to specific channels of a sound card.

2005-06-20 Thread Jeff Young
Hello all,
I'm doing some research for an application that needs to output sound to
specific channels of a sound card. I'm looking for info on links,
components, etc to do this.
 
Basically it needs to output a signal from a specified source file to a
specified target channel on a sound card and another signal from a different
file to a different channel on the same card. Something akin to 
 
SoundCard[0].Channel[0].Stream := TFileStream0;
SoundCard[0].Channel[1].Stream := TFileStream1;
 
would be too much to hope for...
 
But anything would be great.
 
Thanks for your input,
 
Jeff Young
 
___
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi