|
Hi,
I am creating a Header control to fit across the top of a custom grid I am writing.
The problem is this: When I change the colour scheme of Windows, the header control does not repaint itself correctly - it still uses the old colour scheme.
Does anyone know an easy way to get the header control to update it's colours? (i.e. without destroying/creating it again). I know it must be possible, because Header controls created by other apps don't have this problem (and I checked with Spy++ to see if they get recreated, and they don't...)
Any ideas?
James.
http://www.catch22.uk.net
|
|
|
|
|
Handle WM_SETTINGCHANGE in your main window, and forward it on to the header control.
--Mike--
"There are only a limited number of jobs where they will ask to see the sausage. Most of them are in movies."
-- Christian Graus, 2/11/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Mike,
Thanks for the fast response.
Unfortunately, I still can't get it working..
I'm forwarding WM_SYSCOLORCHANGE and WM_SETTINGCHANGE
to the header control (checked with Spy again to make
sure it received them)..no luck I'm afraid.
The border colours (i.e. highlight and shadow) change
colour correctly, but the "face" part of the header
(i.e. the segments with the text on) do not...
Very strange!
Here's how I'm creating the header:
hwndHeader = CreateWindowEx(0, WC_HEADER, 0,
WS_VISIBLE|WS_CHILD|
HDS_BUTTONS | HDS_HORZ | CCS_TOP |
HDS_DRAGDROP |
HDS_FULLDRAG,
0,15,200,10,
hwndParent,
0,GetModuleHandle(0),0 );
Looks pretty normal to me..
There's got to be *some* way to do this!
James
http://www.catch22.uk.net
|
|
|
|
|
uh, i downloaded the DirectX 8 SDK and installed it with the MSVC++ samples. When i opened a sample in VC and i set it to release and compiled i got something about 48kb. After that i followed this tutorial which explained how to build a basic DirectX project (http://www.openrpgs.com/dx_tutorial/dx_toc.html).
When i compiled this it was about 158kb in release. Now my question is:
how come its smaller?? i want to keep my apps as small as possible obviously and it seems that there's a difference in the projects somewhere, maybe in the options, linkage or whatever, i couldn't find out. Does anyone know what makes this rather large difference??
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
If your project have a couple of resoureces like bitmaps, the exe will be more large than the other....
Regards...
I have yet to meet a C compiler that is more friendly and easier to use than eating soup with a knife.
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Well you see, thats the odd thing about it. The directX SDK sample has a bitmap and an icon in it but the project i compiled following the tutorial doesn't have ANY resources so its supposed to be smaller!!! but its not!! its more than 3 times larger, it has to do something with the options or includes or something but i cant firgure out what...
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
Hi,
i have this problem I have declared an arrayLIst in Managed c++ and i have inserted all the values there but now i Cann't get the values out again . The Values that i have inserted are some objects. i used getEnumerator function to access the ArrayList but it's telling me that can not convert a type System::object to "my Object".
what am I doing wrong?
is there another list type structer in managed C++?
thank in advance for your help and time ,
Endri
|
|
|
|
|
Hi, I have a MDI MFC application and I would like to tell it to create a new empty document (basically the same as going to File->New). Can anyone tell me what the function call is to do this?
Thanks!
|
|
|
|
|
The Framework calls OnNewDocument() so unless calling this function directly asserts (I've never tried it) that should work.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
If you can get a pointer to the document template you can call:
pDocTemplate->OpenDocumentFile(NULL) ;
Doc templates can be got through the m_pDocManager pointer of the CWinApp object. You need to iterate it using a POSITION object. Or, if you have an existing document object of the type you want to create, you can call GetDocTemplate() on your document object to get a pointer to it.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
Please step to the rear of the car and make room for more victims. - John Simmons the Outlaw programmer, 1st Feb 2002, in the lounge
|
|
|
|
|
I am trying to color the square box of the check button control.
I have had no luck finding code to do it. I would appreciate any help.
thanks.
Jyoti
|
|
|
|
|
You could use DrawFrameControl() or Draw3dRect().
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Can you give me some sample code if you have it.
I wasn't succesful using DrawFrameControl function.
thanks.
Jyoti
|
|
|
|
|
CDC dc = GetDC();
CRect rect = {10, 10, 100, 100};
dc.DrawFrameControl(&rect, DFC_BUTTON, DFCS_BUTTONPUSH);
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi
I've often seen programs (in most cases c programs) that use one or more of the following operators:
<<, >>
It is called bit-shifting. I saw an ID3-tagger program that uses this commands as well.
Now my question:
What does "bit-shifting" actually do and what is it good for?
Any articles or explanation is greatly appreciated
regards
Gregor
modified 12-Sep-18 21:01pm.
|
|
|
|
|
it shifts the bits to the left (<< ) or the right (>>).
if you have a BYTE x equal to 4, it looks like this in binary: 00000100. if you shift this to the left 2 bits, you get 00010000 (16).
it's used when you need to get at the individual bits in a value. i use it all the time in image processing when the size of the pixels is not an even multiple of 8 (like in a 1 or 4 bits per pixel image).
-c
|
|
|
|
|
It actually shifts the bits in the number. It is sometimes used for quick multiplication or division. Here are some examples :
<br />
<br />
int x = 5 << 3;<br />
<br />
in binary, 5 is 00000101<br />
shifted left 3 is 00101000<br />
<br />
This has the effect multiplying by 8.<br />
<br />
Another one :<br />
<br />
int y = 40 >> 3;<br />
<br />
in binary 40 is 00101000<br />
shifted right 2 is 00000101<br />
<br />
This is dividing by 8<br />
<br />
|
|
|
|
|
Erm, well, could you please explain what bit-shifting is used for in this case:
fprintf( outfile, "%d.%d.%d.%d:%hu\n",
(ipaddr>>24)&0xff, (ipaddr>>16)&0xff,
(ipaddr>>8)&0xff, ipaddr&0xff, port);
This is a code snippet of a tool that queries server and displays there IPs. This is actually what the above code does.
But I have no idea what it really does
maybe you could explain to me
idaddr is declared as
unsigned int ipaddr= ntohl(server->ipaddr);
And one last question:
How do I make keywords appear in red color in this message board?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
An unsigned int consists of 32 bits, so you can see it as a packed array of 8-bit values --precisely what one needs to store a numeric IP address a.b.c.d. ipaddr&0xFF (or-ing with the binary number 0000 0000 0000 1111) yields the value of d. Shifting the appropriate number of bits and repeating the or-ing trick yields th remaining values.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Arrgh... This time you were faster.
I vote pro drink
|
|
|
|
|
Arrgh... This time you were faster.
the pretty formatting notwithstanding
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Gregor S. wrote:
fprintf( outfile, "%d.%d.%d.%d:%hu\n", (ipaddr>>24)&0xff, (ipaddr>>16)&0xff, (ipaddr>>8)&0xff, ipaddr&0xff, port);
This will split your 4-byte number ipaddr into individual bytes and print them.
I vote pro drink
|
|
|
|
|
Thanks for your example.
I finally understand most of this memory manipulation stuff now.
11111111 11111111 11111111 11111111
11000000 10101000 00000000 00000001
<<24:
[00000000 00000000 00000000] 11000000
<<16:
[00000000 00000000 00000000] 10101000
<<8:
[00000000 00000000 00000000] 00000000
<<0 (not shifted):
[00000000 00000000 00000000] 00000001
To get keywords to appear in red, enclose them in <span style="color:red"> and </span>
|
|
|
|
|
Hello,
Can anyone tell me why I get this error?
error:
error C2243: 'static_cast' : conversion from 'class IStopwatch *' to 'struct IUnknown *' exists, but is inaccessible
Here is the code:
<pre>
HRESULT __stdcall CStopwatch::QueryInterface(REFIID riid, void **ppvObject)
{
HRESULT hr = S_OK;
if(riid == IID_IUnknown)
*ppvObject = static_cast<IUnknown*>(static_cast<IStopwatch*>(this)); <-- error
else if (riid == IID_IStopwatch)
*ppvObject = static_cast<IStopwatch*>(this);
else
{
ppvObject = NULL;
hr = E_NOINTERFACE;
}
if(SUCCEEDED(hr))
(static_cast<IUnknown*>(*ppvObject))->AddRef();
return hr;
}
</pre>
Here is my header:
<pre>
#if !defined(AFX_STOPWATCH_H__CF2EC9CF_CCAA_4708_8320_0B5A054E3876__INCLUDED_)
#define AFX_STOPWATCH_H__CF2EC9CF_CCAA_4708_8320_0B5A054E3876__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <windows.h>
class IStopwatch : IUnknown
{
public:
//IStopwatch specific functions
virtual HRESULT __stdcall Start() = 0;
virtual HRESULT __stdcall ElapsedTime(float *Time) = 0;
};
class CStopwatch : public IStopwatch
{
public:
CStopwatch();
virtual ~CStopwatch();
private:
// The frequency of the counter
// returned by QueryPerformanceCounter()
LARGE_INTEGER m_nFrequency;
// The counter value when the start method was last called.
LARGE_INTEGER m_nStartTime;
public:
// IUnknown methods
HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObject);
unsigned long __stdcall AddRef();
unsigned long __stdcall Release();
// IStopwatch specific functions
HRESULT __stdcall Start();
HRESULT __stdcall ElapsedTime(float *Time);
};
#endif // !defined(AFX_STOPWATCH_H__CF2EC9CF_CCAA_4708_8320_0B5A054E3876__INCLUDED_)
</pre>
Thanks,
Rob
|
|
|
|
|
IStopwatch inherits as private from IUnknown. Inherit public from IUnknown ( IStopwatch : public IUnknown )
|
|
|
|