INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Win32 API question

Win32 API question

(OP)
Hello all, well i have been experimenting with the Win32 API in Delphi and im unsure on where to look on examples to use them..seeing how the MSDN only show's C++ examples.

I have dug through Delphi 7's help file and well... im a little confused so i will just paste my working code i found and the code the help files shows me, i dont understand how it translates into my working code...unless the code im using is some how butchered up.

so here is the code im experimenting with now using the SetConsoleTextAttribute function

----My code that i know works and changes color----
begin
SetConsoleTextAttribute(GetStdHandle(
STD_OUTPUT_HANDLE),
FOREGROUND_RED OR
BACKGROUND_BLUE);

Writeln('Red text on a blue background !');
ReadLn;
end.

----------End working code---------------------


--------Now here is a snip from the official delphi documentation-----

BOOL SetConsoleTextAttribute(

HANDLE hConsoleOutput, // handle of console screen buffer
WORD wAttributes // text and background colors
);


Parameters

hConsoleOutput

Identifies a console screen buffer. The handle must have GENERIC_READ access.

wAttributes

Specifies the foreground and background color attributes. Any combination of the following values can be specified: FOREGROUND_BLUE, FOREGROUND_GREEN, FOREGROUND_RED, FOREGROUND_INTENSITY, BACKGROUND_BLUE, BACKGROUND_GREEN, BACKGROUND_RED, and BACKGROUND_INTENSITY. For example, the following combination of values produces white text on a black background:

FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE

------End Delphi help------


Can someone please tell me what cylinder in my head is not firing on this?

RE: Win32 API question

what is exactly the problem?
Does your code not work or don't you understand how to use the API?

Best regards,
Daddy

-----------------------------------------------------
Helping people is my job...

RE: Win32 API question

(OP)
My thread title is my question

RE: Win32 API question

(OP)
I meant, My thread title was supposed to be my question, i mis-labeled it . Im looking for a place on how to use api's in delphi.

Basically where i can look up an API function and then see an example on how to implement it into delphi.

RE: Win32 API question

The best books for windows Api and Delphi were The Tomes of Delphi 3, imo. I wish these had been updated. I have these books and still use them today with Delphi 2010 as they have excellent examples to get you started. I don't do much api programming but some of the functions I have used in recent years have changed slightly with later versions of windows and Delphi so I look up the function in the books and then the Internet to confirm the function parameters etc.

What are you wanting to write exactly using the api?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close