hi KarstendK, I don't understand what you mean. When I move the mouse over the button, it shows.
tataxin
Posts
-
how to show a button after move it? -
how to show a button after move it?I have a button on a list, something like whenever you select a row, move the button to that row. So I implement this in OnLvnItemchangedList event:
void CMyDlg::OnLvnItemchangedList(NMHDR *pNMHDR, LRESULT *pResult)
{
...
// canculate the rec by seleted row
CRect rec;
...// move button
m_myBtn.MoveWindow(rec);
m_myBtn.ShowWindow(SW_SHOW);
m_myBtn.BringWindowToTop();InvalidateRect(rec);
m_myBtn.RedrawWindow();}
It works, but I cannot see the button. :confused::confused: If the mouse moves over the button, it shows then I can see it. I don't know why, maybe there's something wrong in my last two source code rows. Can anyone explain how to solve this?? Thank you in advance !!
-
Item changed event in CListCtrlmaybe the best way is avoid it. It's terrible the way MFC handle an event, :( anyway, thank you very much, Randor!!
-
Item changed event in CListCtrldoes any one have any idea in this case??? help me, please!!!
-
Item changed event in CListCtrluhm, I already tried return FALSE, but it's not better. .. I will try this a litter bit later. Thank you very much, David Delaune.
-
Item changed event in CListCtrluhm, I'm not sure that ... Is this what you mean:
ON_NOTIFY_REFLECT_EX(LVN_ITEMCHANGED, &CMyListCtrl::OnLvnItemchanged)
BOOL CMyListCtrl::OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult)
{
// TODO: Add your control notification handler code here
LPNMLISTVIEW pNMLV = reinterpret_cast(pNMHDR);
*pResult = 0;
....
return TRUE;
}I cannot see any change ..... :(
-
Item changed event in CListCtrlI create a List ctrl derivered from CListCtrl. In this class, I implement item changed event
class CMyListCtrl :
public CListCtrl....
BEGIN_MESSAGE_MAP(CMyListCtrl, CListCtrl)
ON_NOTIFY_REFLECT(LVN_ITEMCHANGED, &CTrendListCtrl::OnLvnItemchanged)
END_MESSAGE_MAP()......
void CMyListCtrl::OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult) // (1)
{
..
}Then, on my dialog, there's a CMyListCtrl object, like this
CMyListCtrl m_lst;
afx_msg void OnLvnItemchangedList(NMHDR *pNMHDR, LRESULT *pResult);
I try to implement the item changed on that list.
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST_GROUP, &CMyDlg::OnLvnItemchangedList)
END_MESSAGE_MAP()void CMyDlg::OnLvnItemchangedList(NMHDR *pNMHDR, LRESULT *pResult) // (2)
{
...
}The problem is, if I implement (1), then it doesn't run (2). And if I doesn't implement (1), it can run (2). Actually I want to run both (1) and (2). What should I do in this case? Thank you very much, bro.
-
sprintf_s problemI will try them now. At least the option 2 works There 're many functions similar to each other. It's so messy, and not easy to understand .... :( Thank you, Naveen.
-
sprintf_s problemnice!! If we use "Use Multi-Byte Character Set", it should be "%s". Or if we use "Use Unicode Character Set", it should be "%S". Thank you, Cedric!!
-
sprintf_s problemThank you, Cedric. I just change the Character Set property to "Use Multi-Byte Character Set" and it's ok now
modified on Thursday, July 17, 2008 9:40
-
sprintf_s problemyes, Cedric. It's a Unicode project. In Project properties, The Character Set is "Use Unicode Character Set" is that wrong?
-
sprintf_s problemhi, I have a sql in my program. What I want is exactly like this:
select *
from tbl t
where t.name like '%xyz%'So in source code, I create sql like this:
CString name = "xyz";
::sprintf_s(szQuery, " select * from tbl t where t.name like '%%%s%%' ", name);Here is szQuery when I execute
select *
from tbl t
where t.name like '%x%'Just the first character is printed into szQuery. What's wrong here? what should I do?? Thank you in advance.
-
Cannot print landscape with default printerThank you, Nelek. I will try it now!
-
Cannot print landscape with default printerhelp me, pleasee!!!
-
Process priorityABOVE_NORMAL_PRIORITY_CLASS 0x00008000
BELOW_NORMAL_PRIORITY_CLASS 0x00004000
HIGH_PRIORITY_CLASS 0x00000080
IDLE_PRIORITY_CLASS 0x00000040
NORMAL_PRIORITY_CLASS 0x00000020
REALTIME_PRIORITY_CLASS 0x00000100There're some values for priority like above, you can try it!
-
Cannot print landscape with default printerI try to print a window, using this article: http://support.microsoft.com/kb/186736 It works, but I want to user default printer with landscape. So I try to modify the GetPrinterDC(), like this:
HDC CLogACTsPrintHelper::GetPrinterDC(void)
{
CWaitCursor wait;
PRINTDLG pdlg;
memset( &pdlg, 0, sizeof(PRINTDLG));
pdlg.lStructSize = sizeof(PRINTDLG);// use default printer
pdlg.Flags = PD_RETURNDEFAULT | PD_RETURNDC;// set landscape
AfxGetApp()->GetPrinterDeviceDefaults(&pdlg);
DEVMODE* lpDevMode = (DEVMODE*)::GlobalLock(pdlg.hDevMode);
lpDevMode->dmOrientation = (short)DMORIENT_LANDSCAPE;
::ResetDC(pdlg.hDC,lpDevMode);
::GlobalUnlock(pdlg.hDevMode);
// end set landscapePrintDlg( &pdlg ); return pdlg.hDC;
}
But I don't know why it return NULL??? If I comment all source code in set landscape block, it works. Or if I do not use default printer and set landscape, it work
// do not use default printer
pdlg.Flags = PD_RETURNDC;
// set landscape
...Can anyone explain me what's wrong here? Thank you in advance, :)
-
why can't I print an icon?thank you for your reply! my printer is HP LaserJet 3052, with 1200dpi. So do you have any idea what I should do in this case?
-
how to change menu font?sorry all, I tried to use another solution: codejock software. it's ok now, thank you friends!
-
print a windowI have a MDI project, now I want to print the interface. So I saw this article: http://support.microsoft.com/kb/q186736/ Then I try to apply to my project, just create a menu item or button, do like this:
// message map
ON_COMMAND(ID_PRINT_PRINTALL, &CMyDlg::PrintGUI)// declare function
afx_msg void PrintGUI();// implement function
void CMyDlg::PrintGUI(){
// get the Main window
CWnd* a = AfxGetMainWnd();// print it, this function is implemented follow the above article PrintWindowToDC(\*a);
}
But when I run, nothing happen. Have anyone ever tried the similar thing? Please helpppppppp !!!!!!!!!!
-
why can't I print an icon?I want to print some icons. Here is my code:
CDC* m_PrintDC;
// attach m_PrintDC with printer success .....CPoint point(10, 10);
HICON aIcon = AfxGetApp()->LoadIcon(IDI_ICON_CHECKEDBOX);
m_PrintDC->DrawIcon(point, aIcon);//m_PrintDC->DrawText("xxxxxxxxx", &aRect,DT_SINGLELINE | DT_LEFT);
Here IDI_ICON_CHECKEDBOX is a icon ID that I draw. But it doesn't work, I don't know why?? I can print some text with DrawText(...). Anyone know what's wrong here? Thank you in advance.