|
thank you
it's working
-- modified at 15:31 Wednesday 14th December, 2005
|
|
|
|
|
Dear Members,
I need to color a button using ATL, WTL or WIN 32 API..
I can easily do it using MFC but because of the Application requirement
I have to do it by using the above mentioned technologies only.
Kindly help me out by sending tips and useful codes.
Regards,
Mayank Srivastava
|
|
|
|
|
|
The source code to MFC is provided for this very reason. This is one of the very reasons why I consider it important to learn the Win32 API first before using MFC. I suspect the answer lies in the WM_CTLCOLORBTN message.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
srimayank11_codeproject wrote: Kindly help me out by sending tips and useful codes.
Using Buttons (Windows Explorer and Controls)[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
I am moving from C# to VC++ to test to see if it will meet my timing requirements.
I am not familiar with VC++.
I want to add an ActiveX control that fills a dialog box. So the size of the control will always match the size of the dialog when it is resized. This is easily done in C# .NET using the Anchor property.
How can I do this in VC++? Can it be done by setting properties or do I have to create extra code to achive this?
By the way I am using Visual Studio 2003 to create my code for an MFC application.
Thanks,
Liam
|
|
|
|
|
I think you will need to handle the WM_SIZE message:
void CTheDialog::OnSize(...)<br />
{<br />
CRect rect;<br />
GetClientRect(&rect);<br />
m_Control.MoveWindow(&rect);<br />
}
Now the control will completely occupy the client area of the dialog.
this is this.
|
|
|
|
|
Khan++, thanks for the reply this worked for a while now it is failing an assertion:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\src\mfc\winocc.cpp
void CWnd::MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint)
{
ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
...
Can you explain why this is?
Also I would like to be able to have a fixed offset from a border. Can this be done easily.
Thanks
|
|
|
|
|
You will need to set a boolean variable at class level:
BOOL m_bInitialized;
And initialize it to FALSE in the constructor.
m_bInitialized = FALSE;
And set it to TRUE in the OnInitDialog() function.
m_bInitialized = TRUE;
Also send a resize message explicitly after setting it TRUE :
SendMessage(WM_SIZE,0,0);
Now modify OnSize() like this:
OnSize()<br />
{<br />
CDialog::OnSize().....
<br />
if (m_bInitialized == TRUE)<br />
{<br />
Resize the client control here.<br />
}<br />
<br />
}
To set an offset you could:
CRect rect;<br />
...<br />
rect.DeflateRect(10,10,10,10);
this is this.
|
|
|
|
|
For some strange reasons all icons in my CListCtrl decided to loose some colors and turn into dull 256 ones. If I display them using CStatic one by one they still have their 16\32 bits but if I'll attach the same image list to list control they turn into 256 ones on display. I have not owner drawn functions or something like that so it can't be the problem.
--------------------------------
Human stupidity is infinite.
|
|
|
|
|
Am I always asking something hard nobody knows about or something dumb nobody things worth of attention ?
--------------------------------
Human stupidity is infinite.
|
|
|
|
|
Hello,
I have a strange problem: I have an Edit Box which is set to Multiline and WantReturn. But if I want to set the text to the edit box with SetWindowText() it seems the \n in the text is completly ignored.
Does anyone have a clue why ?
With best regards,
Benedikt
|
|
|
|
|
|
What do you mean by 'completely ignored' ? You mean that the text following it is not on a new line ?
I think you have to specify \n\r (or \r\n, don't remember exactly) in order to have a new line.
|
|
|
|
|
|
Yeah thank you.
That was the problem. I was too long working with consoles
|
|
|
|
|
Hi guys,
Can somebody help me in opening and closing the cd-rom drive programatically.
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
|
I tried this before, it did not work out. May be I will try it again.
Thanks khan.
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Hi
How to know the serial number of the processor, motherboard, Hd,.... of the PC where is running my application?
I found that I can obtain the HD serial number with GetVolumeInformation(),
but I have problems with the other devices.
Can you help me?
Have a nice code day
|
|
|
|
|
|
Thanks,
but I have some problems to use the functions Win32_DiskDrive.
I have to define these symbols using 'Cimwin32.mof'.
But, How can I use this strange (for me ) files 'mof'?
And also it needed namespace '\root\cimv2', but the compiler give some errors!
If it is a problem, I'm writing a simple MFC doc\view application.
Thank you
Have a nice code day
|
|
|
|
|
_Russell_ wrote: If it is a problem, I'm writing a simple MFC doc\view application.
this article will help
http://www.codeproject.com/system/UsingWMI.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
For cpu-id look for the assembly function cpuid.
|
|
|
|
|
Thank you very much.
It works!
Do you know others assembly functions to know the other devices id (ram, motherboard)?
Have a nice code day
|
|
|
|