DLL Call Question

Discuss anything else that does not suite other forums.

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

DLL Call Question

Post 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
Scrollbar_Pink.jpg (142.07 KiB) Viewed 3037 times
it does NOT work with Xbase++ "pure" ... and i can't get it work with harbour :(
who can make it work with harbour :idea:
SCROLLBA.ZIP
(567 Bytes) Downloaded 145 times
! Note : you can "see" these Color only when use NO "XP Manifest" :!:

SetSysColors function
https://docs.microsoft.com/en-us/window ... tsyscolors
have fun
Jimmy
User avatar
mol
Posts: 3723
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: DLL Call Question

Post by mol »

As I remember, the problem is with 'themed' windows.
In Win Xp it was possible, in newer version not
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: DLL Call Question

Post 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 :?:
have fun
Jimmy
KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: DLL Call Question

Post 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)
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: DLL Call Question

Post 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.
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: DLL Call Question

Post 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 :?:
have fun
Jimmy
User avatar
mol
Posts: 3723
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: DLL Call Question

Post 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?
KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: DLL Call Question

Post 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.
KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: DLL Call Question

Post 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?
Post Reply