473,659 Members | 2,872 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XP Themes "GetThemeCo lor" always fails ...

Hi all
At coding XP Themes i can't get "GetThemeCo lor" to work.
It always fails ("not found" err. code) regardless of which control parts
and states entered.
Could somebody help me with advice?
Yuri
Nov 15 '05 #1
8 4434
Hi,
At coding XP Themes i can't get "GetThemeCo lor" to work.
It always fails ("not found" err. code) regardless of which control parts
and states entered.
Are you coding in C#? and did you success 'OpenThemeData' ?
Could somebody help me with advice?
Please show me your declearation of 'GetThemeColor' .

--
Hiroaki SHIBUKI
"yuri" <ab*@bbb.com> wrote in message
news:u8******** ******@TK2MSFTN GP11.phx.gbl... Hi all
At coding XP Themes i can't get "GetThemeCo lor" to work.
It always fails ("not found" err. code) regardless of which control parts
and states entered.
Could somebody help me with advice?
Yuri


Nov 15 '05 #2
Hi Hiroaki

Yes, I'm coding in C#. The 'OpenThemeData' is succeeded and gives me a
correct theme handler that i use nice with any theme-specific functions.
Also GetThemeSysColo r is working correctly.
Below is my declaration:

[DllImport("uxth eme.dll", CharSet=CharSet .Auto)]
private static extern int GetThemeColor(i nt hTheme,int Part,int State,int
iColorID,ref int ColorRef);

PS: I tried to pass WINDOW as control part with different states and color
with no successful result.
As a result I am receiving always error "element not found".
PS1: If you know any correct template when this call succeeded please post
it here.

Thank you
Yuri

"Hiroaki SHIBUKI [MVP]" <jp****@microso ft.com>
$B'c'`'`'R'k'Z '](B/$B'c'`'`'R'k'Z ']'Q(B $B'S(B $B'_'`'S'`'c'd 'q'g(B $B'c']'V'U'e'p'k'V'V (B:
news:#r******** ******@tk2msftn gp13.phx.gbl...
Hi,
At coding XP Themes i can't get "GetThemeCo lor" to work.
It always fails ("not found" err. code) regardless of which control parts and states entered.


Are you coding in C#? and did you success 'OpenThemeData' ?
Could somebody help me with advice?


Please show me your declearation of 'GetThemeColor' .

--
Hiroaki SHIBUKI
"yuri" <ab*@bbb.com> wrote in message
news:u8******** ******@TK2MSFTN GP11.phx.gbl...
Hi all
At coding XP Themes i can't get "GetThemeCo lor" to work.
It always fails ("not found" err. code) regardless of which control parts and states entered.
Could somebody help me with advice?
Yuri

Nov 15 '05 #3
The api looks correct. What are you passing for the iColorID? e.g. For the
border color, you'd use 3801.

"yuri" <ab*@bbb.com> wrote in message
news:uE******** ******@TK2MSFTN GP12.phx.gbl...
Hi Hiroaki

Yes, I'm coding in C#. The 'OpenThemeData' is succeeded and gives me a
correct theme handler that i use nice with any theme-specific functions.
Also GetThemeSysColo r is working correctly.
Below is my declaration:

[DllImport("uxth eme.dll", CharSet=CharSet .Auto)]
private static extern int GetThemeColor(i nt hTheme,int Part,int State,int
iColorID,ref int ColorRef);

PS: I tried to pass WINDOW as control part with different states and color
with no successful result.
As a result I am receiving always error "element not found".
PS1: If you know any correct template when this call succeeded please post
it here.

Thank you
Yuri

"Hiroaki SHIBUKI [MVP]" <jp****@microso ft.com>
$B'c'`'`'R'k'Z '](B/$B'c'`'`'R'k'Z ']'Q(B $B'S(B $B'_'`'S'`'c'd 'q'g(B $B'c']'V'U'e'p'k'V'V (B: news:#r******** ******@tk2msftn gp13.phx.gbl...
Hi,
At coding XP Themes i can't get "GetThemeCo lor" to work.
It always fails ("not found" err. code) regardless of which control parts and states entered.


Are you coding in C#? and did you success 'OpenThemeData' ?
Could somebody help me with advice?


Please show me your declearation of 'GetThemeColor' .

--
Hiroaki SHIBUKI
"yuri" <ab*@bbb.com> wrote in message
news:u8******** ******@TK2MSFTN GP11.phx.gbl...
Hi all
At coding XP Themes i can't get "GetThemeCo lor" to work.
It always fails ("not found" err. code) regardless of which control parts and states entered.
Could somebody help me with advice?
Yuri


Nov 15 '05 #4
Hi Andrew

Thanks for reply. Sure, i use constants from <tmschema.h>.
But nothing works yet. Amazing :)

PS: below is my prosedure:
---------------------------
internal static Color GetThemeColor(C ontrolPart part, ControlState state,
int iColorID)
{
int result;
int theme ;
// Check to make sure the current system supports themes
if (!SupportsTheme s)
throw (new PlatformNotSupp ortedException( "This system does not support the
use of themes."));
// Get the active Windows XP theme for the specified type of control
Themes.ControlC lass cp= ControlPartClas ses[(int)part];
string s= ControlClassNam es[(int)cp];
theme = OpenThemeData(H andleTemp, s); // "WINDOWS"
if (theme == 0)
throw (new NullReferenceEx ception("No active Windows XP Theme could be
detected."));
int ColorRef= new Int32();
result= GetThemeColor(t heme, (int) part, (int) state, iColorID, ref
ColorRef);
Color cr= Color.White;
if(ColorRef!=0)
cr=ColorTransla tor.FromWin32(C olorRef);

result = CloseThemeData( theme);
if (result != 0)
throw (new InvalidOperatio nException("The call to CloseThemeData failed with
an error code of " + result.ToString () + "."));
return cr;
}
---------------
Thanks
Yuri

"Andrew (Infragistics)" <pr************ @infragistics.c om> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ ×
ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: news:OY******** ******@tk2msftn gp13.phx.gbl...
The api looks correct. What are you passing for the iColorID? e.g. For the
border color, you'd use 3801.

"yuri" <ab*@bbb.com> wrote in message
news:uE******** ******@TK2MSFTN GP12.phx.gbl...
Hi Hiroaki

Yes, I'm coding in C#. The 'OpenThemeData' is succeeded and gives me a
correct theme handler that i use nice with any theme-specific functions.
Also GetThemeSysColo r is working correctly.
Below is my declaration:

[DllImport("uxth eme.dll", CharSet=CharSet .Auto)]
private static extern int GetThemeColor(i nt hTheme,int Part,int State,int iColorID,ref int ColorRef);

PS: I tried to pass WINDOW as control part with different states and color with no successful result.
As a result I am receiving always error "element not found".
PS1: If you know any correct template when this call succeeded please post it here.

Thank you
Yuri

"Hiroaki SHIBUKI [MVP]" <jp****@microso ft.com>
$B'c'`'`'R'k'Z '](B/$B'c'`'`'R'k'Z ']'Q(B $B'S(B

$B'_'`'S'`'c'd 'q'g(B $B'c']'V'U'e'p'k'V'V (B:
news:#r******** ******@tk2msftn gp13.phx.gbl...
Hi,

> At coding XP Themes i can't get "GetThemeCo lor" to work.
> It always fails ("not found" err. code) regardless of which control

parts
> and states entered.

Are you coding in C#? and did you success 'OpenThemeData' ?

> Could somebody help me with advice?

Please show me your declearation of 'GetThemeColor' .

--
Hiroaki SHIBUKI
"yuri" <ab*@bbb.com> wrote in message
news:u8******** ******@TK2MSFTN GP11.phx.gbl...
> Hi all
> At coding XP Themes i can't get "GetThemeCo lor" to work.
> It always fails ("not found" err. code) regardless of which control

parts
> and states entered.
> Could somebody help me with advice?
> Yuri
>
>



Nov 15 '05 #5
Hi yuri
[DllImport("uxth eme.dll", CharSet=CharSet .Auto)]
private static extern int GetThemeColor(i nt hTheme,int Part,int State,int
iColorID,ref int ColorRef);
It's seems correct, but would you try this?

[DllImport("uxth eme.dll")]
private static extern int OpenThemeData (System.IntPtr hwnd,
[In,MarshalAs(Un managedType.LPW Str)] string pszClassList);

[DllImport("uxth eme.dll")]
private static extern int GetThemeColor(i nt hTheme, int Part, int State, int
iColorID, [Out] out int ColorRef);
--
Hiroaki SHIBUKI [MVP]
"yuri" <ab*@bbb.com> wrote in message
news:uE******** ******@TK2MSFTN GP12.phx.gbl... Hi Hiroaki

Yes, I'm coding in C#. The 'OpenThemeData' is succeeded and gives me a
correct theme handler that i use nice with any theme-specific functions.
Also GetThemeSysColo r is working correctly.
Below is my declaration:

[DllImport("uxth eme.dll", CharSet=CharSet .Auto)]
private static extern int GetThemeColor(i nt hTheme,int Part,int State,int
iColorID,ref int ColorRef);

PS: I tried to pass WINDOW as control part with different states and color
with no successful result.
As a result I am receiving always error "element not found".
PS1: If you know any correct template when this call succeeded please post
it here.

Thank you
Yuri

"Hiroaki SHIBUKI [MVP]" <jp****@microso ft.com>
$B'c'`'`'R'k'Z '](B/$B'c'`'`'R'k'Z ']'Q(B $B'S(B $B'_'`'S'`'c'd 'q'g(B $B'c']'V'U'e'p'k'V'V (B:
news:#r******** ******@tk2msftn gp13.phx.gbl...
Hi,
At coding XP Themes i can't get "GetThemeCo lor" to work.
It always fails ("not found" err. code) regardless of which control parts and states entered.


Are you coding in C#? and did you success 'OpenThemeData' ?
Could somebody help me with advice?


Please show me your declearation of 'GetThemeColor' .

--
Hiroaki SHIBUKI
"yuri" <ab*@bbb.com> wrote in message
news:u8******** ******@TK2MSFTN GP11.phx.gbl...
Hi all
At coding XP Themes i can't get "GetThemeCo lor" to work.
It always fails ("not found" err. code) regardless of which control parts and states entered.
Could somebody help me with advice?
Yuri



Nov 15 '05 #6
Actually now that I look at it, I think you should remove the CharSet from
the api declaration - that is exported as GetThemeColor and not
GetThemeColorA/GetThemeColorW.

BTW, why do you assume that if the colorref is 0 that it is white -
shouldn't it be black?

"yuri" <ab*@bbb.com> wrote in message
news:O8******** *****@TK2MSFTNG P11.phx.gbl...
Hi Andrew

Thanks for reply. Sure, i use constants from <tmschema.h>.
But nothing works yet. Amazing :)

PS: below is my prosedure:
---------------------------
internal static Color GetThemeColor(C ontrolPart part, ControlState state,
int iColorID)
{
int result;
int theme ;
// Check to make sure the current system supports themes
if (!SupportsTheme s)
throw (new PlatformNotSupp ortedException( "This system does not support the
use of themes."));
// Get the active Windows XP theme for the specified type of control
Themes.ControlC lass cp= ControlPartClas ses[(int)part];
string s= ControlClassNam es[(int)cp];
theme = OpenThemeData(H andleTemp, s); // "WINDOWS"
if (theme == 0)
throw (new NullReferenceEx ception("No active Windows XP Theme could be
detected."));
int ColorRef= new Int32();
result= GetThemeColor(t heme, (int) part, (int) state, iColorID, ref
ColorRef);
Color cr= Color.White;
if(ColorRef!=0)
cr=ColorTransla tor.FromWin32(C olorRef);

result = CloseThemeData( theme);
if (result != 0)
throw (new InvalidOperatio nException("The call to CloseThemeData failed with an error code of " + result.ToString () + "."));
return cr;
}
---------------
Thanks
Yuri

"Andrew (Infragistics)" <pr************ @infragistics.c om> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: news:OY******** ******@tk2msftn gp13.phx.gbl...
The api looks correct. What are you passing for the iColorID? e.g. For the
border color, you'd use 3801.

"yuri" <ab*@bbb.com> wrote in message
news:uE******** ******@TK2MSFTN GP12.phx.gbl...
Hi Hiroaki

Yes, I'm coding in C#. The 'OpenThemeData' is succeeded and gives me a
correct theme handler that i use nice with any theme-specific functions. Also GetThemeSysColo r is working correctly.
Below is my declaration:

[DllImport("uxth eme.dll", CharSet=CharSet .Auto)]
private static extern int GetThemeColor(i nt hTheme,int Part,int

State,int iColorID,ref int ColorRef);

PS: I tried to pass WINDOW as control part with different states and color with no successful result.
As a result I am receiving always error "element not found".
PS1: If you know any correct template when this call succeeded please post it here.

Thank you
Yuri

"Hiroaki SHIBUKI [MVP]" <jp****@microso ft.com>
$B'c'`'`'R'k'Z '](B/$B'c'`'`'R'k'Z ']'Q(B $B'S(B

$B'_'`'S'`'c'd 'q'g(B $B'c']'V'U'e'p'k'V'V (B:
news:#r******** ******@tk2msftn gp13.phx.gbl...
> Hi,
>
> > At coding XP Themes i can't get "GetThemeCo lor" to work.
> > It always fails ("not found" err. code) regardless of which control parts
> > and states entered.
>
> Are you coding in C#? and did you success 'OpenThemeData' ?
>
> > Could somebody help me with advice?
>
> Please show me your declearation of 'GetThemeColor' .
>
> --
> Hiroaki SHIBUKI
>
>
> "yuri" <ab*@bbb.com> wrote in message
> news:u8******** ******@TK2MSFTN GP11.phx.gbl...
> > Hi all
> > At coding XP Themes i can't get "GetThemeCo lor" to work.
> > It always fails ("not found" err. code) regardless of which control parts
> > and states entered.
> > Could somebody help me with advice?
> > Yuri
> >
> >
>



Nov 15 '05 #7
Hi Hiroaki

It's solved. The problem was not in procedure.
The real reason that not each color defined has an equal real color stated
in theme metric.
As the result most calls returns error code and I by mistake assumed it as
trouble with procedure. In fact a several colors is stated only for such
complicated object as a windows so if we ask color e.g. EDGESHADOWCOLOR and
a couple of others then it works :-)

Thanks for your assistance so much.
Thanks
Yuri

"Hiroaki SHIBUKI [MVP]" <jp****@microso ft.com>
$B'c'`'`'R'k'Z '](B/$B'c'`'`'R'k'Z ']'Q(B $B'S(B $B'_'`'S'`'c'd 'q'g(B $B'c']'V'U'e'p'k'V'V (B:
news:O0******** ******@tk2msftn gp13.phx.gbl...
Hi yuri
[DllImport("uxth eme.dll", CharSet=CharSet .Auto)]
private static extern int GetThemeColor(i nt hTheme,int Part,int State,int iColorID,ref int ColorRef);
It's seems correct, but would you try this?

[DllImport("uxth eme.dll")]
private static extern int OpenThemeData (System.IntPtr hwnd,
[In,MarshalAs(Un managedType.LPW Str)] string pszClassList);

[DllImport("uxth eme.dll")]
private static extern int GetThemeColor(i nt hTheme, int Part, int State,

int iColorID, [Out] out int ColorRef);
--
Hiroaki SHIBUKI [MVP]
"yuri" <ab*@bbb.com> wrote in message
news:uE******** ******@TK2MSFTN GP12.phx.gbl...
Hi Hiroaki

Yes, I'm coding in C#. The 'OpenThemeData' is succeeded and gives me a
correct theme handler that i use nice with any theme-specific functions.
Also GetThemeSysColo r is working correctly.
Below is my declaration:

[DllImport("uxth eme.dll", CharSet=CharSet .Auto)]
private static extern int GetThemeColor(i nt hTheme,int Part,int State,int iColorID,ref int ColorRef);

PS: I tried to pass WINDOW as control part with different states and color with no successful result.
As a result I am receiving always error "element not found".
PS1: If you know any correct template when this call succeeded please post it here.

Thank you
Yuri

"Hiroaki SHIBUKI [MVP]" <jp****@microso ft.com>
$B'c'`'`'R'k'Z '](B/$B'c'`'`'R'k'Z ']'Q(B $B'S(B $B'_'`'S'`'c'd 'q'g(B $B'c']'V'U'e'p'k'V'V (B:
news:#r******** ******@tk2msftn gp13.phx.gbl...
Hi,

> At coding XP Themes i can't get "GetThemeCo lor" to work.
> It always fails ("not found" err. code) regardless of which control

parts
> and states entered.

Are you coding in C#? and did you success 'OpenThemeData' ?

> Could somebody help me with advice?

Please show me your declearation of 'GetThemeColor' .

--
Hiroaki SHIBUKI
"yuri" <ab*@bbb.com> wrote in message
news:u8******** ******@TK2MSFTN GP11.phx.gbl...
> Hi all
> At coding XP Themes i can't get "GetThemeCo lor" to work.
> It always fails ("not found" err. code) regardless of which control

parts
> and states entered.
> Could somebody help me with advice?
> Yuri
>
>


Nov 15 '05 #8
Hi Yuri

I'm happy to solved your problem.
Happy hacking ;-)

--
Hiroaki SHIBUKI [MVP]
"yuri" <ab*@bbb.com> wrote in message
news:e5******** ********@tk2msf tngp13.phx.gbl. ..
Hi Hiroaki

It's solved. The problem was not in procedure.
The real reason that not each color defined has an equal real color stated
in theme metric.
As the result most calls returns error code and I by mistake assumed it as
trouble with procedure. In fact a several colors is stated only for such
complicated object as a windows so if we ask color e.g. EDGESHADOWCOLOR and a couple of others then it works :-)

Thanks for your assistance so much.
Thanks
Yuri


Nov 15 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2540
by: Pete H | last post by:
I would like to have my new C++ projects start out with two configurations, UnicodeDebug and UnicodeRelease, instead of the standard Debug and Release configurations that Visual Studio always creates. Is there a way to configure Visual Studio to do this Thanks in advance - Pete H
14
2103
by: ThunderMusic | last post by:
Hi, I'm trying to use the acm APIs in VB.NET. acmStreamOpen always returns MMSYSERR_INVALFLAG. Here's how I use it : declaration is : Declare Auto Function acmStreamOpen Lib "MsAcm32.dll" (ByRef phas As IntPtr, ByVal had As Long, ByRef pwfxSrc As MPEGLAYER3WAVEFORMAT, ByRef pm_wfxDst As WAVEFORMATEX, ByRef pwfltr As Long, ByRef dwCallback As Long, ByRef dwinstance As Long, ByVal fdwOpen As Int32) As Int32
5
4692
by: Dragonizer | last post by:
Hello all, I need a little help with this. I can't seem to get ifstream ( or fstream ) to read anything. In the code: ifstream input = NULL; input.open("tester.txt"); if(input.bad()) { cout << "Bad input." << endl; return -2; }
2
1570
by: empiresolutions | last post by:
I've installed Imagemajick. phpinfo() shows it and GDlib 2.0 installed properly. I have tried multiple tests to get it to work and all have failed. Can someone please tell me what i am doing wrong. Below is my current test script. All images and php are in the same dir for testing. Thanks. <? exec("convert file.jpg -resize 100x75 new_file.jpg"); // display original photo if (file_exists('file.jpg')) { ?>
0
8427
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8332
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2750
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.