Borland Delphi

Question on converting Numbers for Payroll Check Printing Routine

Attempting to write a Payroll Check Printing Routine.  How can I
convert Currency amounts into their written form???  For example how
can I convert 569.62 to "Five Hundred Sixty Nine and Sixty Two
Cents"???

Any help would be greatly appreciated.

posted by admin in Uncategorized and have Comments (24)

Access compact ???

hay

HOW to compact ACCESS database ?

Thanks.


—————————————————————————
If sometimes you feel yourself little, useless,
offended and depressed, always
remember that you were once the fastest and most
victorious sperm in your group.

Aljo¹a

posted by admin in Uncategorized and have Comments (4)

Help needed get API to work in Delphi4 – works ok in VB :-(

i,

I’m trying to use the NetRenameMachineInDomain API call from within Delphi
4.

(see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netm…
mapi2_8hm6.asp for details of the API structure)

The VB6 code snippet below works fine, but my poor attempt to convert this
to Delphi (below) isn’t so sucessfull

The errors I get are in the returncode I get either a:

87 : ShowMessage(‘The parameter is incorrect’);
1113 : ShowMessage(‘No mapping for the Unicode character exists in the
target multi-byte code page’);
1210 : ShowMessage(‘The format of the specified computer name is invalid’);
1326 : ShowMessage(‘Logon failure: unknown user name or bad password’);

I did try the string parameters as PChars, on the function declaration but
no joy their either.

I’ve got a feeling the problem lies with the flag, in VB this is &H2, I’m
not sure if my attempt at using "2", and "$00000002" are correct.

I’d appreicate it if someone could point me in the right direction.

thanks

David

‘VB6 – Works OK

Private Declare Function NetRenameMachineInDomain Lib "netapi32" _
(ByVal lpserver As Long, ByVal machinename As Long, ByVal lpaccount As Long,
_
ByVal passwrd As Long, ByVal foptions As Long) As Long

Private Const NETSETUP_ACCT_CREATE = &H2            ’Do the server side
account creation/rename

Private Sub Command1_Click()
        Dim flags, res1 As Long
        flags = NETSETUP_ACCT_CREATE
        res1 = NetRenameMachineInDomain(0, StrPtr("NewName"),
StrPtr("administrator"), StrPtr("password"), flags)
        MsgBox (res1)
End Sub

//————————————————————————–
// My attempt a the Delphi Port
// ————————————————————————-

Const
     NETSETUP_ACCT_CREATE  = 0×00000002;

Function NetRenameMachineInDomain(lpserver:string; machinename:string;
lpaccount:string; passwrd:string; foptions : LongInt):LongInt
stdcall;far;external ‘netapi32.dll’;

procedure TForm1.Button1Click(Sender: TObject);
var strNewComputerName, strUserID, strPassword : string;
    resultcode                                 : LongInt;
    flags                                      : LongInt;
begin
   flags:=NETSETUP_ACCT_CREATE;
   resultcode:= NetRenameMachineInDomain(”, ‘New Name’, ‘administrator’,
‘password’, flags);
   Case resultcode of
          0 : ShowMessage(‘Success’);
         87 : ShowMessage(‘The parameter is incorrect’);
       1113 : ShowMessage(‘No mapping for the Unicode character exists in
the target multi-byte code page’);
       1210 : ShowMessage(‘The format of the specified computer name is
invalid’);
       1326 : ShowMessage(‘Logon failure: unknown user name or bad
password’);
       Else
             ShowMessage(‘Result Code : ‘ + IntToStr(resultcode));
   End;

end;

posted by admin in Uncategorized and have Comments (2)

IDE for PocketPc?

Any rumors of  Borland coming up with a
PocketPc development tool??

Thanks in advance,
BB.

posted by admin in Uncategorized and have Comments (4)

scaling

Hi,
I’m struggling with ‘scale’ (D4)
I want a form to be displayed about the same in different screenresolutions.

On the form there is a property ‘scaled’ (yes/no)
TWinControl has a procedure ScaleBy
(according to the help also ChangeScale and ScaleControls – using them
gives: undeclared  identifier,
Scaleby gives no error: Why, if there all in TWinControl?)

But the results are not ‘nice’…

So my questions:
– What should I use?
– What does ‘form.scaled’ do?
– Where are ChangeScale and SclaeControls?

Hope someone can help!
Hans

posted by admin in Uncategorized and have No Comments

Re: every component with own event

It would help if you explained the reasons why you want to do this – a lot
of problems are caused by using the wrong "solution" in the first place, so
there may be a better way of achieving what you want to do without needing
to find methods by name at run-time. However, the following code may give
you some ideas.

WARNING!!! Use entirely at your own risk! Although there’s nothing in it
that isn’t in the Delphi Help Files it relies on the way Delphi stores
method pointers internally, and that could easily change in future releases
(it may already have done, for all I know – I use Delphi 5). Also note, I’ve
left out all the error-checking code you would need (such as there not being
a method of the name you’re looking for).

*******************

unit ClickMe;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics,

StdCtrls, Controls, Forms, Dialogs;

const

NumProcs = 2;

type

PTNEvent = ^TNotifyEvent;

TForm1 = class(TForm)

procedure FormCreate(Sender: TObject);

private

Buttons: array[1..NumProcs] of TButton;

Methods: array[1..NumProcs] of TMethod;

ClickCount: integer;

published

procedure MyClick1 (Sender: TObject);

procedure MyClick2(Sender: TObject);

end;

var

Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.MyClick1(Sender: TObject);

begin

Inc(ClickCount);

ShowMessage(‘Click 1′ + #13#10 + IntToStr(ClickCount) + ‘ clicks’);

end;

procedure TForm1.MyClick2(Sender: TObject);

begin

Inc(ClickCount);

ShowMessage(‘Click 2′ + #13#10 + IntToStr(ClickCount) + ‘ clicks’);

end;

procedure TForm1.FormCreate(Sender: TObject);

var

i: integer;

CurLeft, CurTop: integer;

CurAddr: PTNEvent;

begin

CurLeft := 0;

CurTop := 0;

for i := 1 to NumProcs do begin

Methods[i].Code := MethodAddress(‘MyClick’ + IntToStr(i));

Methods[i].Data := Self;

end;

for i:= 1 to NumProcs do begin

Buttons[i] := TButton.Create(Self);

Buttons[i].Left := CurLeft;

Buttons[i].Top := CurTop;

Buttons[i].Parent := Self;

Buttons[i].Caption := IntToStr(i);

Pointer(CurAddr) := @Methods[i];

Buttons[i].Onclick := CurAddr^;

Inc(CurTop, Buttons[i].Height);

end;

end;

end.

*************

Ray

"maier" <w…@firemail.de> wrote in message

news:eh3a6u4uuh90de4jf7oc3l1lsm6h150dri@4ax.com…

- Hide quoted text — Show quoted text -

> HI i want to set an Event for each OnDisconnect

> For i := 0 to 2 do begin
> IRC[i].OnDisconnect := xx[i]Disconnect;
> end;

> events  xx1Disconnect,  xx2Disconnect … exists !

> but it doesent work

> thx

posted by admin in Uncategorized and have No Comments

Looking for a wysiwyg HTML editor component

Hi,

As the title say, I’m looking for an HTML editor, a wysiwyg one… Very
difficult to find it seems…

This editor mustn’t modify the HTML code as the M$ does… It’s very
important.

And, very important, I can pay for it !!! ;-) ))

Thank’s for any link !

Regards,
BigGrizzly

posted by admin in Uncategorized and have No Comments

try & exept verschachteln

Ist es möglich mehrer Try & exept Verzweigungen zu verschachteln

so in etwa:

try
….
   try
    …
   except
   …
   end

except

end

posted by admin in Uncategorized and have Comment (1)

TRecord inside TRecord?

Hello all,

I have to interface with a TCP/IP socket server that was written in C++ and
I’m expected to send a structure (TRecord) with another Structure inside one
of it’s members.  Is this o.k. with Delphi?  Can I declare a TRecord Type
with one of it’s members being of Type Trecord?

Thank you,

Lee


Like Rock?  My best friend’s band cut their first CD.
Check out two songs at: www.datatrakpos.com/leftover.htm

posted by admin in Uncategorized and have Comments (3)

MDI question

Hi,

this is a simple question of that I am sure, but is there a way to find out
what the position, i.e. top and left positions are of an MDI child form?
But relative to the overall screen rather than to the MDI parent?

TIA
Colin B

posted by admin in Uncategorized and have Comment (1)