Calling an external function

For questions and postings not covered by the other forums
mike.day
Posts: 10
Joined: Tue Oct 01, 2013 8:19 am

Calling an external function

Postby mike.day » Wed Oct 09, 2013 11:03 am

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

murray
Posts: 144
Joined: Fri Aug 14, 2009 6:58 pm
Location: New Plymouth, New Zealand

Re: Calling an external function

Postby murray » Wed Oct 09, 2013 11:29 am

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.
Murray (N.Z.)

User avatar
BeeJay
Posts: 312
Joined: Tue Jun 30, 2009 2:42 pm
Location: Christchurch, NZ

Re: Calling an external function

Postby BeeJay » Wed Oct 09, 2013 1:16 pm

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.

mike.day
Posts: 10
Joined: Tue Oct 01, 2013 8:19 am

Re: Calling an external function

Postby mike.day » Wed Oct 09, 2013 1:31 pm

I agree with you BeeJay, thanks for your input!

Cheers,
Mike


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 21 guests

cron