Page 1 of 1

Calling an external function

Posted: Wed Oct 09, 2013 11:03 am
by mike.day
I would like to call SetSysColors from user32.dll to change some system colours in my app. See http://msdn.microsoft.com/en-us/library ... 85%29.aspx for more info on this function.
I'm having some trouble getting this function declared in external functions and to also work. Params one and two are integerArrays and I'm not sure if Jade allows integerArrays to be declared so here's how my external function looks...

Code: Select all

setSysColors(nChanges : Integer; lpSysColor : Integer; lpColorValues : Integer) : Boolean is SetSysColors in user32;
Any help on using this function in Jade would be appreciated.

thanks,
Mike

Re: Calling an external function

Posted: Wed Oct 09, 2013 11:29 am
by murray
Hi Mike,

You're correct that you can't use IntegerArrays from Jade. You are limited in the data types that are compatible with the calls. I have managed to work around this in the past by using a Jade Binary. However, you will have to populate the Binary in your own code. This involves processing raw Bytes or Integers to the correct offsets within the Binary. Have a look at the Jade Developers Reference (DevRef.pdf), chapter 5, "Using External Functions" which may provide some more clues.

Re: Calling an external function

Posted: Wed Oct 09, 2013 1:16 pm
by BeeJay
I would like to call SetSysColors from user32.dll to change some system colours in my app.
A 3rd party application, unless it's a "utility app" specifically designed to do similar functionality as the relevant control panel applet but in a nicer manner, shouldn't be touching a users system settings like this.

ie: It is not the purview of a "business application" to fiddle with a users system settings!!!

I've seen similar issues in the past where "business applications" started turning off things like "Show window contents while dragging", due to some perceived issue with having this feature enabled for their application.

Therefore, I would strongly recommend that you don't continue down this path of interfering with users desktop colour schemes etc from a "business application". Especially given that there is limited access to the advanced colour option settings on Windows8, versus what used to be available on Windows7 and prior OSes, to enable the user to "correct" their colours after running your application.

Cheers,
BeeJay.

Re: Calling an external function

Posted: Wed Oct 09, 2013 1:31 pm
by mike.day
I agree with you BeeJay, thanks for your input!

Cheers,
Mike