Sign in to follow this  
Followers 0
Kealper

WinAPI SetConsoleTextAttribute issue

1 post in this topic

#1 ·  Posted (edited)

Ok, I've been scratching my head for the better part of 40 minutes trying to figure this out, I'm not well-versed in dll calls, and I believe that is where my problem stems from. I'm writing a simple UDF to change the color output in a console because I have only found one vague reference to it being done before, and that link to the post is broken.

I'm trying to get the info i needed to work it correctly from http://msdn.microsoft.com/en-us/library/ms686047%28VS.85%29.aspx

And the simple test function that keeps failing is below, and I know it's probably because I am calling the function wrong.

Func ConsoleColor($hConsole, $iColor, $hDLL = "Kernel32.dll")
    $ret = DllCall($hDLL, "BOOL", "SetConsoleTextAttribute", "HANDLE", $hConsole, "WORD", $iColor)
    Return $ret[0]
EndFunc

I am not looking for someone to completely write it for me, just potentially show me what I am doing wrong, any help would be greatly appreciated!

EDIT: Nevermind this, I ended up figuring it out finnally, It was something simple and stupid on my part. It would be nice to have this function that I'm working on included into WinAPI.au3, now that it works :mellow:

Edited by Kealper

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0