|
this will do....
char* revers(char * source)
{
int nCount = strlen( source);
char *pRev = new char[ nCount + 1 ];
for( int nIdx = 0;nIdx < nCount + 1;nIdx++)
{
pRev[ nIdx ] = source[ nCount - 1 - nIdx ];
}
return pRev;
}
nave
|
|
|
|
|
Assuming you're using the MS compiler, why not just view the CRT library source?
|
|
|
|
|
Or even better yet, why not do your homework yourself?
earl
|
|
|
|
|
I would advise you to do that (your own homework yourself). You see, the code Naveen R provided contains some potentially hazardous "features", is highly sub-optimal, and will surely get you in big trouble when you try to explain it to your teacher.
Here is my contribution:
char* reverse_string(char* s) {
char* p=0;
while(s) *p=*s;
return p;
}
If you can't get this code to reverse the string this may mean you should study harder
|
|
|
|
|
Hi all,
I am working with vc++(6).Now i am in trouble,i needed to get a popup menu when i right click on command button.I got pop up menu when i right click on dialog using WM_RBUTTONDOWN .But it does not work on command button which is on the same dialoge.Please help me
Thanks
Vinod Moorkkan
-- modified at 4:45 Monday 10th July, 2006
|
|
|
|
|
overide the PreTranslateMessage() funtion in the dialog and handle the WM_RBUTTONDOWN message there.
nave
|
|
|
|
|
Override WM_CONTEXTMENU..
CMenu menu;
menu.CreatePopupMenu();
menu.AppendMenu(MF_ENABLED | MF_STRING , ID_HELLO, _T("Hello"));
if(pWnd->m_hWnd == m_button.m_hWnd)
{
menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
}
m_button is object of u r button...
-- modified at 5:31 Monday 10th July, 2006
|
|
|
|
|
|
thanks sir
but if i want to add more items in bottom of hello.
and if i want popup menu for dialog box then what i can use in place of button member variable.
if(pWnd->m_hWnd == m_button.m_hWnd)
Ashish Dogra
MCA
Noida
|
|
|
|
|
menu.AppendMenu(MF_ENABLED | MF_STRING , ID_NEWITEM1, _T("NewItem1"));
menu.AppendMenu(MF_ENABLED | MF_STRING , ID_NEWITEM2, _T("NewItem2"));
just keep on adding as many items u want,..u can add separator,u can appened to existing menu also..
if(pWnd->m_hWnd == m_button.m_hWnd)..when u click on a button on dialog ,contextmenu appear,if u want it for whole just remove that line..that`s all...
-- modified at 7:38 Monday 10th July, 2006
|
|
|
|
|
thanks a lot
but can i do this coding foe dialog in OnRButtonDown function
Ashish Dogra
MCA
Noida
|
|
|
|
|
RButtondown..is not required if u handle WM_CONTEXTMENU...
|
|
|
|
|
sir thanks but it does not work for dialog box
Ashish Dogra
MCA
Noida
|
|
|
|
|
i have taken sample dialog based application,named it sample..i have overriden WM_CONTEXTMENU in CSampleDlg class..and wrote following code in OnContextMenu function..
CMenu menu;
menu.CreatePopupMenu();
menu.AppendMenu(MF_ENABLED | MF_STRING , 1000, _T("Hello"));
menu.AppendMenu(MF_ENABLED | MF_STRING , 1001, _T("Hello1"));
menu.AppendMenu(MF_ENABLED | MF_STRING , 1002, _T("Hello2"));
menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
its working fine...
|
|
|
|
|
sir thanks but this code works for button very efficiently
and when i right click on dialog i small menu appear but nothing is appeared on it.
Ashish Dogra
MCA
Noida
|
|
|
|
|
if(pWnd->m_hWnd == m_button.m_hWnd)..remove this line from u r code..then it works..
|
|
|
|
|
no sir when i remove this line then it works for all buttons except the one button that is m_button.
and it does not work for dialog box
thanks
Ashish Dogra
MCA
Noida
|
|
|
|
|
thanks a lot sir now everything is ok
thanks for ur cooperation
u r geneious
Ashish Dogra
MCA
Noida
|
|
|
|
|
hi all
i want to know how i can enable the progress control
on dialog box in dialog based application when i click on a button
and i want to display data on edit box from right side as it display from left side by default
Thanks.
Ashish Dogra
MCA
Noida
|
|
|
|
|
I think you need to read the post before you post your message .this will help others in helping you in a better way .
Regards,
FarPointer
Blog:FARPOINTER
|
|
|
|
|
sorry i repeat my question
i made a dialog based application
on which i made a progress control and a button
now i want that when i click on button the progress control enables it means that the progress controls line statrs moving from left to right
i think now it is ok
thanks
Ashish Dogra
MCA
Noida
|
|
|
|
|
Well using the below mentioned way u can move the progress ctrl:-
myCtrl.GetRange( nLower, nUpper );<br />
myCtrl.SetStep( (nUpper-nLower)/10 );<br />
myCtrl.SetPos( int nPos );
But according to your defn it feels that you want a busy control rather than a progress control .
Regards,
FarPointer
Blog:FARPOINTER
|
|
|
|
|
thanks for your reply
but as i use this code in button and when i click that button,
the progress bar does not respond
Ashish Dogra
MCA
Noida
|
|
|
|
|
Well use the SetPos code in a for loop .
Regards,
FarPointer
Blog:FARPOINTER
|
|
|
|
|
sir i use this code but not woking
plz modify this
void CDIALERDlg::OnButton16()
{
// TODO: Add your control notification handler code here
int nLower,nUpper;
int nPos;
m_myCtrl.GetRange( nLower, nUpper);
m_myCtrl.SetStep((nUpper-nLower)/10);
for(int i=0;i<100;i++)
{
m_myCtrl.SetPos(nPos);
}
}
Ashish Dogra
MCA
Noida
|
|
|
|