|
kiranin wrote: included one CButtonSt class from one of the samples in code project
You better post this to article, where you get this sample from.
As nobody know, how CButtonSt looks like.
kiranin wrote: I tried it OnDraw but i got assertion failure....
Where it taking to you, in code.
|
|
|
|
|
hi all,
I have dynamically created a CEdit Control in the Dialog. When ever i Right Click in the EditBox i have to show popup a Menu. Then I select the FirstMenu Item from Menu must show a CColorDialog and choose a Color and store it in a COLORREF variable. This is done using TrackPopupMenu(...) when ever i Right Click in the Newly Created EditBox Dynamically.
after choosing the Color from the ColorDialog Box. That Color Must be Reflected in the Edit Box where ever i RightClicked.
//===========================================================================
void CExpDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
CClientDC *dc = new CClientDC(this);
ptr = new CEdit; //Create Dynamic Edit Control Here
ptr->Create(WS_VISIBLE|WS_CHILD|WS_BORDER|WS_TABSTOP|ES_AUTOHSCROLL,CRect (point.x,point.y,point.x +100, point.y +20),this,ctr++);// Dynamic Edit.
CDialog::OnLButtonDown(nFlags, point);
}
HBRUSH CExpDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
switch (nCtlColor)
{
case CTLCOLOR_EDIT: //For General EditBox. here i am bit confused
pDC->SetBkColor(c); // where c is COLORREf selected in ColorDialog
break;
}
return 0;
}
//This when ever i right Click on the newly Created EditBox Item.
void CExpDlg::OnParentNotify(UINT message, LPARAM lParam)
{
if(message == WM_RBUTTONDOWN)
{
CPoint pt(LOWORD(lParam),HIWORD(lParam));
PopupMenu (&pt);
}
}
//Populate the Menu Item
void CExpDlg::PopupMenu(CPoint* pt)
{
ClientToScreen (pt);
CMenu FloatingMenu;
FloatingMenu.LoadMenu(IDR_MENU1);
CMenu* pPopupMenu = FloatingMenu.GetSubMenu (0);
pPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,pt->x, pt->y, this);
}
//This is the Menu Item when the TrackPopUp is Shown.
void CExpDlg::OnObjetsOne()
{
CColorDialog dlg;
if(dlg.DoModal()== IDOK)
{
c = dlg.GetColor(); // c is the ColorRef of the ColorDialog.
}
}
Here the New color what i am choosing is not Reflected to the EditBox which i Created Dynamically.
please provide me a solution.
//===========================================================================
Uday kiran
|
|
|
|
|
uday kiran janaswamy wrote: Here the New color what i am choosing is not Reflected to the EditBox which i Created Dynamically.
How you want to use this color in CEdit variable. What do you mean by not reflected to the EditBox?
|
|
|
|
|
hi prasad,
when i choose the color from the Color Dialog that Color Must be Reflect to the EditBox.
I mean when i Created the EditBox in LButtonEvent. Then i Right Click on the EditBox then a Popup Menu is being populated. then select the first MenuItem to Display the ColorDialogBox.
In that we choose the Color and store it in COLORREF. In our Instance it variable c.
That variable Color Must Reflected in the EditBox BackGround Color.
Uday kiran
-- modified at 8:28 Thursday 24th August, 2006
|
|
|
|
|
you need to return brush of that color in OnCtlColor
|
|
|
|
|
hi prasad,
That also i have done please look at my First Post.
thanks
Uday kiran
|
|
|
|
|
uday kiran janaswamy wrote: That also i have done please look at my First Post
I reallize that.I modified my post,too. It's always better to use pre tags for code. It makes code readable. I just missed it, on this occasion.
You code in OnCtlColor could be like this,
HBRUSH CExpDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
switch (nCtlColor)
{
case CTLCOLOR_EDIT:
{
hbr=CreateSolidBrush(c);
return hbr;
}
}
return hbr;
}
-- modified at 8:41 Thursday 24th August, 2006
-- modified at 8:51 Thursday 24th August, 2006
|
|
|
|
|
Hi prasad,
even i modified the code after set focus to the newly created editbox the effect is being shown.
please loot at it.
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
switch (nCtlColor)
{
case CTLCOLOR_EDIT:
{
m_redbrush.DeleteObject();
m_redbrush.CreateSolidBrush(c);
pDC->SetBkColor(c);
hbr = (HBRUSH) m_redbrush;
}
}
return hbr;
}
Uday kiran
-- modified at 9:15 Thursday 24th August, 2006
|
|
|
|
|
uday kiran janaswamy wrote: after set focus to the newly created editbox the effect is being shown
what do you mean by this? Can you be more clear. If you mean , it doesn't immediately paint, then you need to call Invalidate , on CEdit class.
uday kiran janaswamy wrote: pDC->SetBkColor(c);
You need not call this.
-- modified at 9:43 Thursday 24th August, 2006
|
|
|
|
|
hi prasad,
You are correct i forgot to call the ::Invalidate(...) method to reflect the Immediate Changes.
Uday kiran
|
|
|
|
|
|
When we mount two paritions of a USB drive (HDD) such that Drive A: is mounted in a folder of drive B: and Dirve B: is mounted in a folder of Drive A: i.e. create recursive mount points. Thus the mounted points (folders in which drive are mounted) have current GUIDs of the partitions of USB drive. If user plug off this USB drive and plug on to another system. Thus the system will assign new GUIDs to USB drive partitions. But the mounted points previously created have olders GUIDs i.e. the one that was assigned to these folders when the mount points were created (NOTE: we get these GUIDs using DeviceIoControl). So, when we pass these GUIDs as path to the CreateFile method, it fails because new GUIDs are assigned to the partitions. But these GUIDs are valid if we pass as path in CFileFind.
So, what is actually happening in these cases i.e. for CreateFile and CFileFind ?
How these mount points (created on USB drive) be valid on the other system ? Although these mounts are valid if we access through windows explorer.
|
|
|
|
|
Hello!
Anybody knows how to make EditBox to accept only bitwise strings (0 and 1), something like ES_NUMBER that allows only digits to be entered into the Edit Control.
SzyKam.
|
|
|
|
|
I don't know such a control but you can do one yourself quite easily: create a new class (CBitwisEdit for example) that inherits from the CEditCtrl. Override the OnChar function. Inside this function, check if the char entered is either '0' or '1'. If this is the case, call CEditCtrl::OnChar, otherwise don't call it.
|
|
|
|
|
hi,
In order to Accept Numeric Values in the EditControl, You have to SubClass the EditControl by Creating a new CEdit Class and specify the Messages.
In our Instance WM_CHAR. in the WM_Char Message check for the Only Numeric Variable.
Think Clever.
Uday kiran
|
|
|
|
|
Hi Friends,
We are developing an application which will start when the computer starts and the system will shutdown when the application is closed.
I want to hide the windows 'start' menu so that user can not access any other soft wares from the system apart from our application.
Can any one pls suggest any function and how to hide the start menu on the start up
Thanks in Advance,
Dinesh
|
|
|
|
|
switch to another desktop...
|
|
|
|
|
It seems you need to
<br />
<br />
FindWindowEx(FindWindow("Shell_TrayWnd", NULL)->m_hWnd, <br />
0, "Button", NULL)->ShowWindow(0);<br />
<br />
FindWindowEx(FindWindow("Shell_TrayWnd", NULL)->m_hWnd, <br />
0, "Button", NULL)->ShowWindow(1);<br />
<br />
<br />
|
|
|
|
|
do you think seriously (even if it does work for hiding the start button) that it will prevent, as the OP wants, to users to launch applications ?
the windows+R keyboard combination allow the user to reach the "Run..." dialog, Windows+E keys, to launch the explorer...
i don't think this "security reason" should be solved like this...
|
|
|
|
|
WhiteSky wrote: FindWindowEx(FindWindow("Shell_TrayWnd", NULL)->m_hWnd,
0, "Button", NULL)->ShowWindow(0);
FindWindowEx(FindWindow("Shell_TrayWnd", NULL)->m_hWnd,
0, "Button", NULL)->ShowWindow(1);
your Window will hung after some time !
"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
Support CRY- Child Relief and You
|
|
|
|
|
It has a mistake/**/ and FindWindowEx(..... was a code and you can use from CWnd.Did you get my mail!?
|
|
|
|
|
|
Hello,
I am having a dialog-based MFC application, in which I have placed a RichEdit control, and I want to trap the F9 key, which I am not able to do. Please help.
Software Developer
Sanjay Khapre
|
|
|
|
|
I am Developing an application for Windows Mobile,Using VS2005 and SQLite Database.
I am facing two problems.
1.Database is always cleared every time I am reloading the application.
2.I cannot bind the data to the List View as Columns, I can bind only one column.
Please Anybody help me
|
|
|
|
|
Sri harini wrote: 1.Database is always cleared every time I am reloading the application.
This seems to sqlite configuration problem.. please check the api called to operate the SQLite DB in your program!
"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
Support CRY- Child Relief and You
|
|
|
|