Page 1 of 2
DLL Call Question
Posted: Sun Oct 27, 2019 12:06 pm
by AUGE_OHR
hi,
i have this Code which work with Xbase++ and ot4xb from Pablo Botella (
www.xbwin.com)
Code: Select all
#IFDEF __XPP__
nColor := AutomationTranslateColor(GRA_CLR_PINK,.F.)
nRet := @User32:SetSysColors(1, {COLOR_SCROLLBAR}, {nColor}) // this Work !
#ELSE
// AutomationTranslateColor(GRA_CLR_PINK,.F.) -> 16711935
nRet := DLLcall("USER32.DLL",DLL_OSAPI,"SetSysColors",1,{COLOR_SCROLLBAR}, {16711935})
#ENDIF

- Scrollbar_Pink.jpg (142.07 KiB) Viewed 4138 times
it does NOT work with Xbase++ "pure" ... and i can't get it work with harbour
who can make it work with harbour
! Note : you can "see" these Color only when use NO "XP Manifest"
SetSysColors function
https://docs.microsoft.com/en-us/window ... tsyscolors
Re: DLL Call Question
Posted: Sun Oct 27, 2019 6:07 pm
by mol
As I remember, the problem is with 'themed' windows.
In Win Xp it was possible, in newer version not
Re: DLL Call Question
Posted: Sun Oct 27, 2019 8:09 pm
by AUGE_OHR
hi,
thx for Answer.
the Problem with this API Call are Array as Parameter where "pure" Xbase++ fail. it work with 3-PP Ot4XB LIB
so my Question is how to pass Array Parameter in DLL Call with harbour

Re: DLL Call Question
Posted: Sun Oct 27, 2019 10:07 pm
by KDJ
You can use SetSysColors function from HMG:
Code: Select all
HB_FUNC (SETSYSCOLORS)
{
int ID = (int) hb_parni (1);
COLORREF Color = (COLORREF) hb_parnl (2);
hb_retl (SetSysColors (1, &ID, &Color));
}
Usage:
lSuccess := SetSysColors(COLOR_SCROLLBAR, COLORREF)
Re: DLL Call Question
Posted: Sun Oct 27, 2019 11:21 pm
by AUGE_OHR
hi,
KDJ wrote: ↑Sun Oct 27, 2019 10:07 pm
You can use SetSysColors function from HMG:
Usage:
lSuccess := SetSysColors(COLOR_SCROLLBAR, COLORREF)
Aha ... THX
em, äh ... have try
Code: Select all
nRet := SETSYSCOLORS(1,{COLOR_SCROLLBAR}, {nColor})
nRet := SETSYSCOLORS(1,COLOR_SCROLLBAR, nColor)
nRet := SETSYSCOLORS(1,COLOR_SCROLLBAR, aRGB )
nRet := SETSYSCOLORS(1,COLOR_SCROLLBAR, 0xc8fde3 )
but none of them work like expect.
can you please show me a working Example for harbour / HMG.
Re: DLL Call Question
Posted: Mon Oct 28, 2019 3:03 am
by AUGE_OHR
hi,
i found this working Code
Code: Select all
nRet := clrtest( CLR_YELLOW, CLR_HRED )
HB_FUNC( CLRTEST )
{
int aElements[2] = { COLOR_CAPTIONTEXT, COLOR_SCROLLBAR };
DWORD aColors[2];
aColors[ 0 ] = hb_parnl( 1 );
aColors[ 1 ] = hb_parnl( 2 );
hb_retl (SetSysColors( 2, aElements, aColors ));
}
now i try this code with modify Function and it work
Code: Select all
nRet := SETSYSCOLORSEX(COLOR_SCROLLBAR, CLR_HMAGENTA)
nRet := SETSYSCOLORSEX(COLOR_CAPTIONTEXT,CLR_HBLUE)
#pragma BEGINDUMP
#include "item.api"
#include <hbapi.h>
#include <windows.h>
HB_FUNC( SETSYSCOLORSEX )
{
int aElements[1];
DWORD aColors[1];
aElements[ 0 ] = hb_parnl( 1 );
aColors[ 0 ] = hb_parnl( 2 );
hb_retl (SetSysColors( 1, aElements, aColors ));
}
#pragma ENDDUMP
but this function have only 2 Parameter and it start with Array.
what i like to have are 3 Parameter where 2nd and 3rd are test for "VALTYPE" = "C" or "A"
who can help me to write a SETSYSCOLORSEX or show me how HMG SETSYSCOLORS work

Re: DLL Call Question
Posted: Mon Oct 28, 2019 2:21 pm
by mol
can you post working sample?
Re: DLL Call Question
Posted: Mon Oct 28, 2019 2:22 pm
by mol
KDJ wrote: ↑Sun Oct 27, 2019 10:07 pm
You can use SetSysColors function from HMG:
Code: Select all
HB_FUNC (SETSYSCOLORS)
{
int ID = (int) hb_parni (1);
COLORREF Color = (COLORREF) hb_parnl (2);
hb_retl (SetSysColors (1, &ID, &Color));
}
Usage:
lSuccess := SetSysColors(COLOR_SCROLLBAR, COLORREF)
Hi Krzysztof!
Do you know the way how to change parametrs of scroolbar? Is it possible to make it wider with bigger arrow buttons?
Re: DLL Call Question
Posted: Mon Oct 28, 2019 7:54 pm
by KDJ
mol wrote: ↑Mon Oct 28, 2019 2:22 pm
Do you know the way how to change parametrs of scroolbar? Is it possible to make it wider with bigger arrow buttons?
Hi
Marek
I guess you mean the build-in scrollbars in ListView control.
Theoretically it is possible, but quite difficult to realize.
And it seems to me that in HMG it is even impossible.
Re: DLL Call Question
Posted: Mon Oct 28, 2019 9:47 pm
by KDJ
AUGE_OHR wrote: ↑Mon Oct 28, 2019 3:03 am
now i try this code with modify Function and it work
Your SETSYSCOLORSEX function and HMG SETSYSCOLORS function works identically.
So why you say that one works and the other does not work?