The list box portion of a combo box is handled specially. It's actually a child of the desktop, not the combobox itself or the dialog. That way, the list can extend outside of the parent dialog (look at the Start->Run dialog for an example).
How to interpret the content of the key "HKEY_LOCAL_MACHINE\SYSTEM\DISK\Information"? I want it to locate all volumes under Windows NT 4.0. If the content of this key was not documented, what is the other way to locate a specific volume under WinNT 4.0? Thanks.
Thanks for your reply,
However, what I need is the location of each volume. For example, what is the starting offset and length of the volumn C: and, of course, which physical disk this volume belongs to. In other words, I want a similar function (works in WinNT 4.0) with IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, which does not work under Windows NT 4.0
I think the approach to key HKEY_LOCAL_MACHINE\SYSTEM\DISK\Information is correct. But the content of this REG_BIN value is still unknown.
I cannot quite understand the logic behind the notion of operator overloading.
I understand that creating a class, is like creating a new type, therefore we can overload some operators to work with that new type. For example:
Ratio& Ratio::operator=(const Ratio& r)
num = r.num;
den = r.den;
} This example is absolutely comprehensible but I cannot understand how I have to think, visualize the things in order to implement operator overloading in the *, *= operator, or in the == for instance.
Consider the Ratio class as the following:
friend Ratio& operator*(const Ratio& x, const Ratio y);
Ratio(int =0, int =1);
Ratio& operator=(const Ratio&);
Ratio& operator*=(const Ratio&);
int num, den;
Here is the understanding problem:
Ratio operator*(const Ratio& x, const Ratio& y)
Ratio z(x.num*y.num, x.den*y.den);
Is this the only way to overload that operator in this example? How one has to think in order to writew the above code? What are the steps involved in order to write the above two lines of code? And secondly in the first example (operator=) the return type is a reference to the Ratio but in the second is not a reference. Why is not a reference. When should we use a reference and when not?
Please bare in mind that I understand the use of friend functions.
Thanks in advance for the help,
I have about 50 int variables in my form to initialize. The variables are different only in the last 2 numbers. How can I concat the strings to hold int data types so that I wouldn't have to write out all 50 variables. I'm able to do this in ASP but not sure how to do it in C++.
CString str1 = "m_var";
for (int i=1; i <= 50; i++)
str2 = str1 + num;
//need str2 to hold an int value
If I understand your question correctly, I can only offer this:
int *pVar = &m_vars.m_var1; // starting address
for (int x = 0; x < sizeof(m_vars) / sizeof(int); x++)
*pVar = 1; // initialize to 1
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
I'd like to customize the CFileDialog to add some extra controls to the bottom of it. When the dialog first opens, I'd only like one of the extra controls to be displayed. When the user selects this control (a check box), then I'd like the dialog to expand to show the rest of the controls.
I am using the explorer style CFileDialog with a custom template. If I place all of the extra controls on the custom template, the size of the CFileDialog is extended to include all of these controls (even if they are not visible). So I get the CFileDialog w/ a bunch of extra gray space at the bottom of it.
I thought that I could make the invisible controls very small in the custom template to minimize this extra gray space. Then when they need to be seen, I'd resize the CFileDialog and the controls and set the controls visible. The problem is that whenever I change the size of the CFileDialog by calling SetWindowPos(), the original CFileDialog controls resize to fill up the extra space, leaving no extra room for my new controls.
Does anyone know how to customize the CFileDialog to allow for collapse/expand at the bottom of the dialog? If so, I could really use some suggestions. Thanks!
I needed help with resizing a CStatic box to fit exactly the size of the text inside. The thing is once I increase the font size, I cant get the exact dimensions from GetTextExtent(). I've tried to multiply it with a ration, but no luck. It doesnt fit on it. Is there any function out there that can do this for me or any help on what would be a good way to do it. Help Needed ASAP.
I was just testing to see what font is currently stored in CDC object and it turns out that it is totally different from the font of the window. Why is that? and how do I change the font of CDC object as there is no setFont function there.
the code is below:
//set the font of the window text
CWnd* pCtrlWnd = GetDlgItem(id);
CFont * oldFont = pCtrlWnd->GetFont();
LOGFONT* pLogFont = new LOGFONT;
CString fontName = pLogFont->lfFaceName;
CFont * font = new CFont;
font->CreateFont(newFontSize,0,0,0,700,0,0,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, fontName);
Ali Niaz wrote: how do I change the font of CDC object
SelectObject() will do that for you.
I see several problems with the code you supplied. The most obvious being the severe potential for memory leaks. See http://www.codeproject.com/gdi/drawtechniques.asp[^]. You might also want to make your font a member variable of your static control's parent window.