|
hi
how to change the color of header of list control. i am new for mfc
thank u
malik
|
|
|
|
|
There are two way to achieve this
1) By Subclassing the Header Control class CHeaderCtrl. This would be the generic way of achiveing the same and further you can reuse this class as well whereever required.
2)You can override the WM_PAINT and WM_CTLCOLOR or WM_DRAWITEM message etc of CHeaderCtrl based on your requirement.
You can get some more knowledge from the Code project link
http://www.codeproject.com/listctrl/skinlist.asp
Ajay kumar, Sr System Analyst
Satyam Computers, Bnaglore
India
ajay.kumar.ind@gmail.com
|
|
|
|
|
Hi,
I have an dialog based application developed on VS 2005 on XP machine.
The main dialogs has a TreeCtrl, buttons etc.
When I exit my application, I get a crash which is inconsistant.
These are the contents of my call stack.
comctl32.dll!5d0a93d0() <br />
[Frames below may be incorrect and/or missing, no symbols loaded for comctl32.dll] <br />
comctl32.dll!5d0a8461() <br />
comctl32.dll!5d0b98ff() <br />
user32.dll!7e41b96b() <br />
comctl32.dll!5d0e9964() <br />
user32.dll!7e4185a4() <br />
user32.dll!7e4188d1() <br />
user32.dll!7e4188da() <br />
comctl32.dll!5d0a9bc6() <br />
mfc80ud.dll!AfxWndProcBase(HWND__ * hWnd=0x001115b6, unsigned int nMsg=515, unsigned int wParam=1, long lParam=5242970) Line 411 + 0x27 bytes C++<br />
user32.dll!7e418734() <br />
user32.dll!7e418816() <br />
user32.dll!7e41c63f() <br />
user32.dll!7e41c665() <br />
mfc80ud.dll!CWnd::DefWindowProcW(unsigned int nMsg=515, unsigned int wParam=1, long lParam=5242970) Line 1029 + 0x20 bytes C++<br />
mfc80ud.dll!CWnd::Default() Line 274 C++<br />
mfc80ud.dll!CWnd::OnLButtonDblClk(unsigned int __formal=1, unsigned int __formal=1) Line 486 + 0xf bytes C++<br />
MYUIuD.dll!1005da21() <br />
MYUIuD.dll!10045542() <br />
mfc80ud.dll!CWnd::OnWndMsg(unsigned int message=515, unsigned int wParam=1, long lParam=5242970, long * pResult=0x0012f3d0) Line 2169 C++<br />
mfc80ud.dll!CWnd::WindowProc(unsigned int message=515, unsigned int wParam=1, long lParam=5242970) Line 1741 + 0x20 bytes C++<br />
MYUIuDuD.dll!1005cc57() <br />
mfc80ud.dll!AfxCallWndProc(CWnd * pWnd=0x013e094c, HWND__ * hWnd=0x001115b6, unsigned int nMsg=515, unsigned int wParam=1, long lParam=5242970) Line 240 + 0x1c bytes C++<br />
mfc80ud.dll!AfxWndProc(HWND__ * hWnd=0x001115b6, unsigned int nMsg=515, unsigned int wParam=1, long lParam=5242970) Line 389 C++<br />
mfc80ud.dll!AfxWndProcBase(HWND__ * hWnd=0x001115b6, unsigned int nMsg=515, unsigned int wParam=1, long lParam=5242970) Line 411 + 0x15 bytes C++<br />
user32.dll!7e418734() <br />
user32.dll!7e418816() <br />
user32.dll!7e41f805() <br />
user32.dll!7e4189cd() <br />
user32.dll!7e431b3c() <br />
user32.dll!7e418a10() <br />
user32.dll!7e42d99d() <br />
mfc80ud.dll!CWnd::IsDialogMessageW(tagMSG * lpMsg=0x001744e8) Line 198 C++<br />
mfc80ud.dll!CWnd::PreTranslateInput(tagMSG * lpMsg=0x001744e8) Line 4268 C++<br />
mfc80ud.dll!CDialog::PreTranslateMessage(tagMSG * pMsg=0x001744e8) Line 80 C++<br />
mfc80ud.dll!CWnd::WalkPreTranslateTree(HWND__ * hWndStop=0x000a169c, tagMSG * pMsg=0x001744e8) Line 2882 + 0x14 bytes C++<br />
mfc80ud.dll!AfxInternalPreTranslateMessage(tagMSG * pMsg=0x001744e8) Line 233 + 0x12 bytes C++<br />
mfc80ud.dll!CWinThread::PreTranslateMessage(tagMSG * pMsg=0x001744e8) Line 773 + 0x9 bytes C++<br />
Sample.exe!CMyApplicationApp::PreTranslateMessage(tagMSG * pMsg=0x001744e8) Line 2052 C++<br />
mfc80ud.dll!AfxPreTranslateMessage(tagMSG * pMsg=0x001744e8) Line 252 + 0x11 bytes C++<br />
mfc80ud.dll!AfxInternalPumpMessage() Line 178 + 0x18 bytes C++<br />
mfc80ud.dll!CWinThread::PumpMessage() Line 896 C++<br />
mfc80ud.dll!AfxPumpMessage() Line 190 + 0xd bytes C++<br />
mfc80ud.dll!CWnd::RunModalLoop(unsigned long dwFlags=4) Line 4322 + 0x5 bytes C++<br />
mfc80ud.dll!CDialog::DoModal() Line 587 + 0xc bytes C++<br />
Sample.exe!CMyApplicationApp::InitInstance() Line 565 + 0x8 bytes C++<br />
mfc80ud.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x00020a00, int nCmdShow=1) Line 37 + 0xd bytes C++<br />
Sample.exe!wWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x00020a00, int nCmdShow=1) Line 33 C++<br />
Sample.exe!__tmainCRTStartup() Line 589 + 0x35 bytes C<br />
Sample.exe!wWinMainCRTStartup() Line 414 C<br />
kernel32.dll!7c816fd7()
What is causing the crash/access violation.
Could any body guide me in figuring out as to what may be causing the crash??
That would be of great help.
|
|
|
|
|
Can anybody guide me as to what is causing the Access violation in the dll?
|
|
|
|
|
int A[10], *Ptr;
ptr = (int*)malloc(10*sizeof(int));
what is the difference between array 'A' and 'Ptr' with respect to memory?
|
|
|
|
|
Sakthi_Vel wrote: what is the difference between array 'A' and 'Ptr' with respect to memory?
A is allocated in stack where as the memory location pointed by Ptr is allocated in Heap.
|
|
|
|
|
when we come out of the block without calling free(Ptr).
what will happen? Will 'Ptr' memory get released or not?
|
|
|
|
|
It will not be released. That memory will reside there as long as your application is running. Such wastage of memory in a program are called memory leaks.
|
|
|
|
|
|
I wanna design a programme with a dialogue which has a funtionality of placing some Edit controls in which you can input text.Those Edit controls are laid in a rectangle that can be scrolled with a Vertical Scrollbar.My recent thought is that laying some Edit controls in a picture control and setting a Vertical Scrollbar by myself to scroll that picture control and those Edit controls inside that picture control.
My programming platform is VC6.0.The language is English.My level of ability in programming is round middle.
I wanna enter Microsoft Corporation for my fortune
|
|
|
|
|
Hi,
I have a unit testing framework as a console application that generates its output like compilers. (for example: ..\src\cf4.c(23) : fatal error C1083: Cannot open include file: 'is400cfg.h': No such file or directory)
I want to know how I can integrate this tool with Visual Studio IDE in a way to feed the output generated from this tool be feed to IDE. I want to see the outputs of this tool in Errors pane of Visual studio.
Best regard,
Kamyar Souri
STEC-Inc
www.stec-inc.com
|
|
|
|
|
Im attempting to use a member function that takes a reference arg as a predicate for the stl findif algorithm. If I make the predicates arg a non reference type the code compiles, if I make it a reference it fails. Can anyone tell me how to get it working with a reference type argument?
I get a bunch of warnings and then
error C2529: '_Right' : reference to reference is illegal
Both versions are below
/********* this compiles ***************/
class A
{
public:
bool test(int i) {return true;}
};
deque<A> collection;
findif(collection.begin(), collection.end(), bind2nd(mem_fun_ref(&A::test), 5));
/*********second version with reference param to test() ****************/
class A
{
public:
bool test(int& i) {return true;}
};
deque<A> collection;
int iVal = 5;
findif(collection.begin(), collection.end(), bind2nd(mem_fun_ref(&A::test), iVal));
|
|
|
|
|
One solution is to use boost::bind() like this
find_if(collection.begin(), collection.end(), boost::bind(&A::test, _1, iVal));
|
|
|
|
|
basically, I'm having problems with those pests itoa and atoi.
the initial idea was to split a file into N different smaller files, each of them having their filenames sequencial (ie: 1.txt, 2.txt, ... N.txt)
what I have thought is:
[code]
int i = 1;
...
while(!inFile.eof())
{ ofstream outFile(i); //obviously, ofstream doesn't let me to do this
j=1;
while(j <= instances_per_file && !inFile.eof())
{ inFile >> s;
outFile << s << endl;
j++;
}
N++;
}
...
[/code]
currently using cygwin, but solution must be plataform/compiler independent.
any ideas how to convert int to string without itoa and sstream?
sorry if I posted on wrong place.
|
|
|
|
|
What's wrong with itoa() ? Can you use sprintf() instead?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
lockheart87 wrote: any ideas how to convert int to string without itoa and sstream?
std::stringstream is the one C++ string stream class. It is bound to be platform independent, and does exactly what you need.
itoa is its ugly little brother from the C-Library. Also standardized.
Why won't you use both? Is your assignment prohibiting that?
What are you allowed to use, if not standardized library routines?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
i subclassed CButton class and have a onmousemove in it and i need to set text on my dialog i know it can be done ive done it before but i cant remember now to save my life
void CMyButton::OnMouseMove(UINT nFlags, CPoint point) <br />
{<br />
if (!m_bOverControl)<br />
{<br />
TRACE0("Entering control\n");<br />
<br />
m_bOverControl = TRUE;<br />
Invalidate();<br />
<br />
if (GetDlgCtrlID() == IDC_STATUS_BUTTON)<br />
{<br />
}<br />
if (GetDlgCtrlID() == IDC_SEARCH_BUTTON)<br />
{<br />
MessageBox("hi");<br />
}<br />
if (GetDlgCtrlID() == IDC_OPTIONS_BUTTON)<br />
{<br />
MessageBox("low");<br />
}<br />
SetTimer(m_nTimerID, 100, NULL);<br />
} <br />
CButton::OnMouseMove(nFlags, point);<br />
}
the messagebox works.
|
|
|
|
|
Usually it's preferable to send/post a message to the parent
and let the parent set the text. This eliminates the need for the child
to have intimate knowledge of its parent.
Regardless of how you choose to implement this, eventually you'll
probably want to use SetWindowText() to set the IDC_DISPLAY_TEXT
control's text.
Also, what sets your m_bOverControl to FALSE? Is that what the timer is for?
If so, you may want to look into TrackMouseEvent() and WM_MOUSELEAVE
for a more elegant solution to tracking when the cursor leaves a window.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
ive tryed SetWindowtext()but nothing happens ive tryed ::SetWindowText() to but for some reason i cant get a HWND to my control till after its to late
|
|
|
|
|
What type of control is it?
What window is the parent of the control?
Is it the same parent as the button's parent?
If you're using MFC then you should be using an MFC object to
wrap the control - CStatic, CEdit, etc.
If you don't use an MFC control object, there's GetDlgItem() to get
a control's HWND given its ID. You need to know the controls parent to
use it, that's it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I need to print an array of 24 individual bitmap files( about 1.5 inch image each) in array of 4X6 directly to the printer on one page. I can print only one file using foll. code. Is there any way I can use a for loop or any other trick to accomplish this? Please help!
void PrintBitmap(LPCTSTR filename)
{
CPrintDialog printDlg(FALSE);
printDlg.GetDefaults();
// Or get from user:
// if (printDlg.DoModal() == IDCANCEL)
// return;
CDC dc;
if (!dc.Attach(printDlg.GetPrinterDC())) {
AfxMessageBox(_T("No printer found!")); return;
}
dc.m_bPrinting = TRUE;
DOCINFO di;
// Initialise print document details
::ZeroMemory (&di, sizeof (DOCINFO));
di.cbSize = sizeof (DOCINFO);
di.lpszDocName = filename;
BOOL bPrintingOK = dc.StartDoc(&di); // Begin a new print job
// Get the printing extents
// and store in the m_rectDraw field of a
// CPrintInfo object
CPrintInfo Info;
Info.SetMaxPage(1); // just one page
int maxw = dc.GetDeviceCaps(HORZRES);
int maxh = dc.GetDeviceCaps(VERTRES);
//Info.m_rectDraw.SetRect(0, 0, maxw, maxh);
for (UINT page = Info.GetMinPage(); page <= Info.GetMaxPage() && bPrintingOK; page++)
{
dc.StartPage(); // begin new page
Info.m_nCurPage = page;
CBitmap bitmap;
// LoadImage does the trick here, it creates a DIB section
// You can also use a resource here
// by using MAKEINTRESOURCE() ... etc.
//for (int ii=0; ii<2; ii++)
if(!bitmap.Attach(::LoadImage(
::GetModuleHandle(NULL), filename, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE))) {
AfxMessageBox(_T("Error loading bitmap!")); return;
}
BITMAP bm;
bitmap.GetBitmap(&bm);
int w = bm.bmWidth;
int h = bm.bmHeight;
// create memory device context
CDC memDC;
memDC.CreateCompatibleDC(&dc);
CBitmap *pBmp = memDC.SelectObject(&bitmap);
memDC.SetMapMode(dc.GetMapMode());
dc.StretchBlt(0, 0, 2*w, 2*h, &memDC, 0, 0, w, h, SRCCOPY);
// clean up
memDC.SelectObject(pBmp);
bPrintingOK = (dc.EndPage() > 0); // end page
}
if (bPrintingOK)
dc.EndDoc(); // end a print job
else dc.AbortDoc(); // abort job.
}
|
|
|
|
|
ShilpaGupte wrote: Is there any way I can use a for loop or any other trick to accomplish this?
Sure - any kind of loop will do.
Separate out the code that is page related - Initialization and cleanup.
In between those, loop through the images, rendering them to the appropriate
location on the printer DC.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for replying!! I have tried using a for loop. But lemme try again. and I'll let u know.
Shilpa Potnis.
|
|
|
|
|
Does anyone know how what to set in VS2005 so that you can debug a DLL? I know what to do normally, VS2003 was fine but for some reason I cannot debug a DLL in VS2005! I have set the executable to call the DLL from and I have output the debug version of the DLL to the correct path etc,...
I have read somewhere that it is a known issue in VS2005 and you need to install sybols locally.
|
|
|
|
|
In the folder where your "debug configuration" goes there should be a .pdb(program debug database) file. Place this file into the same directory you are placing the "debug configuration" dll. Then under Debug -> Attach To Process, select what ever is using the dll file. Set your break points and let her rip.
[Insert Witty Sig Here]
|
|
|
|
|