Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Best place to see examples on how to use Win32 API function in delphi

DatSikDatSik Posts: 7Member
well i have been experimenting with the Win32 API in Delphi and I'm 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----

[code]begin
SetConsoleTextAttribute(GetStdHandle(
STD_OUTPUT_HANDLE),
FOREGROUND_RED OR
BACKGROUND_BLUE);

Writeln('Red text on a blue background !');
ReadLn;
end.[/code]

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

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

[code]BOOL SetConsoleTextAttribute(

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

[code]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[/code]
------End Delphi help------

Can someone please tell me what cylinder in my head is not firing on this?
Sign In or Register to comment.