|
Hi,
I have a Tree Ctrl in a view. How can I programatically set the background of the tree to be transparent?
Thanks
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
Hi, all experienced Win32 guys will get a laugh here, I'm sure, but I'm stumped.
In our forms code, a checkbox is created using CreateWindow. Unfortunately, suddenly all our checkbox text has a white background (it should be windows grey).
Any idea why this might have suddenly stopped working, or even better how to fix it?
Any help appreciated - but no I can't not use CreateWindow.
Cheers,
Phaedrus
|
|
|
|
|
You could create a class for your checkboxes and use DrawItem to declare a background that you wish to use.
void YourClass::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) {
LPCTSTR lpszText = (LPCTSTR) lpDrawItemStruct->itemData;
ASSERT(lpszText != NULL);
CDC pDc;
pDc.Attach(lpDrawItemStruct->hDC);
COLORREF crTextBk = RGB(0,0,0);
pDc.SetBkColor(crTextBk);
pDc.DrawText(
lpszText,
strlen(lpszText),
&lpDrawItemStruct->rcItem,
DT_CENTER|DT_SINGLELINE|DT_VCENTER);
pDc.Detach();
}
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
After creating the control, you need to set its font. You can get this font with GetStockObject(SYSTEM_FONT)
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
Does setting the font actually change the background colour then? I thought the bacground colour was a function of the Brushes?
Jamie
|
|
|
|
|
I need some MFC class for managing accelerators. I have found
CAcceleratorManager class but I have some problems with it.
Is there any other solution for user defined accelerators?
|
|
|
|
|
Hello,
I created a view filled with images. I registered the DI_GETDRAGIMAGE and able to receive the message in the window after I called InitializeFromWindow.
To handle the message, I do the following:
---
LPSHDRAGIMAGE psi = (LPSHDRAGIMAGE)lParam;
psi->hbmpDragImage = (HBITMAP)OleDuplicateData(m_hBmpImage, CF_BITMAP, NULL);
psi->sizeDragImage.cx = m_nBmpWidth;
psi->sizeDragImage.cy = m_nBmpHeight;
psi->crColorKey = RGB(0, 0, 0);
return 0;
---
I tried different combination and also tried InitializeFromBitmap but the drag image still not appear. Do you have any idea?
Thanks,
Ngai
|
|
|
|
|
How can I translate de following VB function ?
Function DateToNumber(dOrig as Date) as Long
Dim HDate as date
HDate = DateSerial(1900,1,1) + TimeSerial(0,0,0)
DateToNumber = Abs(DateDiff("d",HDate,dOrig))
End Function
Regards,
Marcelo Duarte
|
|
|
|
|
It's a pretty simple function. Try looking up date time functions in the MSDN, and you shouldn't have too much trouble with it. The only question is what 'DateToNumber' returns.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
I have a string "ABC" and I want discover in the COMBO
There are strings: "XYZ", "XYZABC123", "123"... in COMBO
Help me to detect "XYXABC123" in COMBO >> which content "ABC"
thank a lot
I use Visual C++ 6.0 with non-MFC
|
|
|
|
|
for ( int i = 0 ; i < m_cmb.GetCount() ; ++i )
{
CString sText;
m_cmb.GetText( i, sText );
int nIndex = sText.Find( _T("ABC") );
if ( nIndex >= 0 )
{
// Found it - do something
break;
}
}
Dave
|
|
|
|
|
Hello,
I have just been writing an application in VC++.Net Standard on Windows XP Professional, and have decided to use the latest version of HtmlHelp for the help facility. I have just installed HtmlHelp, and according to the instructions I have put htmlhelp.lib under
"C:\Program Files\Microsoft Visual Studio .NET\Vc7\lib" directory, and htmlhelp.h under the similarly named include directory.
I have written the following API code to invoke the Help system:
void CMainFrame::OnCallHlp()
{
::HtmlHelp((HWND)GetDesktopWindow(),
"C:\\C++Proj\\LPSEmail\\LPShlp\\html\\LPSEmail.chm::
/afxFoldersAdd.htm", HH_DISPLAY_TOPIC,NULL);
}
However, when I compile I get the following link error:
LPSEmail error LNK2019: unresolved external symbol _HtmlHelpA@16 referenced in function "public: void __thiscall CMainFrame::OnCallHlp(void)" (?OnCallHlp@CMainFrame@@QAEXXZ)
I would be very grateful if someone could tell me how to make the programme link correctly. I presume the problem is because it cannot find the external HtmlHelp API library??
All help appreciated,
Trimtrom
|
|
|
|
|
You may need to link with a dll. I don't know the HTMLHelp API, but unless it comes standard in .NET, it might be good to check that. Also, are you sure that it's not under some namespace. With a different API like that, it could be a namespace different than std::.
|
|
|
|
|
Brandon,
Thanks for the answer. In the SDK docs there is no mention of a DLL.
I am not very experienced and so would not know how to check for a namespace. How would you do that??
Would it help if I deleted the pch files under the Debug directory, if there is some inherited problem?
|
|
|
|
|
You need to include HtmlHelp.lib in your Link|Library modules project setting.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Neville,
I have been looking under Tools, Options, Project folder. (This is very different to VC++ 6 which I was used to.)
Is there any where else I should check?
Trimtrom
|
|
|
|
|
I don't have VC7 so I can't help with that. Gotta be there somewhere. Linker Options should be part of the project setup. At least that's how it is in VC6.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Project menu -> Properties -> Linker -> Input -> Additional Dependencies.
easier way is to use a #pragma preprocessor directive
#pragma comment (lib, "htmlhelp.lib")
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
You need to link with htmlhelp.lib which is provided with the Microsoft HTML Help Workshop.
Dave
|
|
|
|
|
|
I got there first on the previous one
Dave
|
|
|
|
|
I have a project that I need to have a class A with a member pointer to a class B; class B has a member pointer to class A. How do I mess with the header files are whatever to do this?
I would also like to know how most people do their header files #includes. Is it like MS with one header file including every other header file and every source file includes that with #ifndef and #endif around every header file? Sorry, that sounds confusing. One main header file that #include's every header file, classes and such. Then every header file with a class declaration has #ifndef, #endif around it so it won't include more than once. Lastly, all source files only #include the main header file, nothing else. If this is the best way to do it, does it matter to #include one header file before another?
Coming back to my original question, I'm sure you can do preprocessor directives like console function declarations with classes. But where would I put those?
|
|
|
|
|
You need a forward declaration of one of the classes that tells the compiler that the class exists, but you'll define it later:
class A;
class B
{
private:
A *m_Ptr;
};
It is wise to always put a #ifdef round every header file, but personally I would only include a header file where you need - needlessly including every single header file will just create a big spaghetti mess. Keep it clean and include as much as you can in the source files, and whatever is needed in the header file to compile the class. Otherwise as soon as you start changing one header everything falls apart
|
|
|
|
|
class1.h
#if !defined(__CLASS1_H__)
#define __CLASS1_H__
// Forward declaration
class Class2;
class Class1
{
Class2* m_pClass2;
// Other stuff
};
#endif
class2.h
#if !defined(__CLASS2_H__)
#define __CLASS2_H__
// Forward declaration
class Class1;
class Class2
{
Class1* m_pClass1;
// Other stuff
};
#endif
Then include both of the header files in the implementation of these classes.
Dave
|
|
|
|
|
brandon1879 wrote:
I have a project that I need to have a class A with a member pointer to a class B; class B has a member pointer to class A. How do I mess with the header files are whatever to do this?
You need to forward declare class b. eg.
class b;
class a { ... class b* m_b; }
class b { ... class a* m_a; }
For a good discussion on #includes I recomend "Large Scale C++ Software Design" by John Lakos. published by Addison-Wesley.
Bottom line is that you should only include the minimum number of #includes that you need. Using a #include that #includes a set of include files is a bad idea. You need to minimimize dependencies so files aren't recompiled unnecessarily.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|