|
Same way....as you are doing but pass the ID of you submenu.
or you can use:
GetSubMenu( int nPos ) const; function.
Cheers
"Peace of mind through Technology"
|
|
|
|
|
I tried,but by that way, i can only receive caption of submenu item,not a popup item!
|
|
|
|
|
Try to use the form of GetMenuString function which works with item's position, using MF_BYPOSITION flag, like this:
CString s;
GetMenuString(10, s, MF_BYPOSITION);
where 10 is the position of the item in the menu.
|
|
|
|
|
i use this function to convert date from vc++ format to mysql format
but it give 1970-1-1 every time even i submit today date or other date
plz tel me how can i get the date which i specify
CString strDate=m_datetime.Format("%Y-%m-%d");
i use date time picker in mfc and make variable of this m_datetime as CTime
now tel me how i get other dates on mysql table
hi
|
|
|
|
|
paras_s12 wrote: i use this function to convert date from vc++ format to mysql format
but it give 1970-1-1 every time even i submit today date or other date
plz tel me how can i get the date which i specify
CString strDate=m_datetime.Format("%Y-%m-%d");
i use date time picker in mfc and make variable of this m_datetime as CTime
now tel me how i get other dates on mysql table
try the following code.
UpdateData(TRUE);
CString strDate=m_datetime.Format("%Y-%m-%d");
UpdateData(FALSE);
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
thank u for ur ans
its work well
and i am great thankful to u for this
hi
|
|
|
|
|
Welcome..!
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
UpdateData(TRUE);
CString strDate=m_datetime.Format("%Y-%m-%d");
//do your stuff here
UpdateData(FALSE);
if i want to fetch same date from mysql table into vc++ then wat should i do;
hi
|
|
|
|
|
Hi All,
Can you anyone help me out by getting me the sample code in Visual C++ to
call crystal report and display it in PDF format using Visual C++.
IF you can provide me the sample code means that would be helpfull.
looking for the reply...
regards,
vinay
vinay
|
|
|
|
|
See Here[^] of course without pdf
whitesky
|
|
|
|
|
Hi,
Thanks for the reply, but my requiremnt is little different..
Actual requirement is:
Take the parameters and Pass to the Crystal report and Display the report in PDF format on the Web,
IF you could provide me a sample Code that would be helpfull..
Vinay
|
|
|
|
|
I'm trying to store info in a .INI file but I get a runtime error everytime. My code looks something like:
GetDlgItemText (hwnd, ID_EDIT1, user, 40);
GetDlgItemText (hwnd, ID_EDIT2, edit2, 40);
WritePrivateProfileString (user, "settings", edit2, "info.INI");
It will create the info.INI file but won't write anything to it before closing. Thanks for any help.
-Matt
|
|
|
|
|
fury 84 wrote: I'm trying to store info in a .INI file but I get a runtime error everytime. My code looks something like:
GetDlgItemText (hwnd, ID_EDIT1, user, 40);
GetDlgItemText (hwnd, ID_EDIT2, edit2, 40);
WritePrivateProfileString (user, "settings", edit2, "info.INI");
It will create the info.INI file but won't write anything to it before closing. Thanks for any help.
What is the data types of the variables??
-if they are pointers and you haven't allocate the memory for them then runtime error may occur.
-Check the maxcount you providing and the available size of the variable.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
I got a 600*480(pixel) picture with my camera. I wonder how many centimeters the width and height are.
how to calculate?
|
|
|
|
|
1 pixel = .04 cm (as per my knowledge and study)
Therefore :
600 pixel= 24 cm
480 pixel= 19.2 cm
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
hi, i am writing a program that stores data into a text file i specify in the form of a class object. when i initialize the window where i can edit this data, i have a combo box that reads the file and inserts part of the object(the name of each class object) into the combo box. than i select the name and when i hit the button to edit the data for that particular object i am trying to have my program insert each part of the class into its own text box but when i try to do this my program completely crashes without any information as to why. i tried to push the values of the variables into a buffer and than use setwindowtext but it would still crash which i have done else where in my program without any bit of trouble.
|
|
|
|
|
Can you show your code that has error
whitesky
|
|
|
|
|
sure not a problem, i will post the whole function, hope that will be enough to help solve the issue.
afx_msg void CEditDialog::OnEdit()<br />
{<br />
elements s;<br />
int size = sizeof(elements);<br />
bool found = false;<br />
<br />
CComboBox *pSelection;<br />
pSelection = (CComboBox *)GetDlgItem(IDC_SELECTION);<br />
CEdit *pNameText;<br />
pNameText = (CEdit *) GetDlgItem(IDC_ENAME);<br />
CEdit *pSymbolText;<br />
pSymbolText = (CEdit *) GetDlgItem(IDC_ESYMBOL);<br />
CEdit *pAtomicText;<br />
pAtomicText = (CEdit *) GetDlgItem(IDC_EATOMIC);<br />
CEdit *pPeriodText;<br />
pPeriodText = (CEdit *) GetDlgItem(IDC_EPERIOD);<br />
CEdit *pGroupText;<br />
pGroupText = (CEdit *) GetDlgItem(IDC_EGROUP);<br />
CEdit *pElectronText;<br />
pElectronText = (CEdit *) GetDlgItem(IDC_EELECTRON);<br />
<br />
int iCurSel = pSelection->GetCurSel();<br />
<br />
if(iCurSel == CB_ERR)<br />
{<br />
MessageBox(" Please Select an Item.", "Error", MB_ICONWARNING);<br />
<br />
return;<br />
}<br />
<br />
char lpszText[32];<br />
pSelection->GetLBText(iCurSel, lpszText);<br />
<br />
access.Open(file, CFile::modeCreate | CFile::modeNoTruncate | CFile::modeReadWrite);<br />
<br />
do{<br />
access.Read(reinterpret_cast< char * > (&s), sizeof(elements));<br />
MessageBox(lpszText, "debug", MB_ICONINFORMATION);<br />
if(strcmp(s.element, lpszText) == 0)<br />
{<br />
access.Seek(-(long)size, CFile::current);<br />
MessageBox("Found", "debug", MB_ICONINFORMATION);<br />
found = true;<br />
pNameText->SetWindowText("test");<br />
}<br />
}while(found != true);<br />
access.Close();<br />
}
all the code works as expected except the setwindowtext, anythign i put for it to output causes a crash(please excuse my sloppy code).
|
|
|
|
|
You might try putting a breakpoint on this line and see if pNameText is NULL (which it probably is):
CEdit *pNameText;<br />
pNameText = (CEdit *) GetDlgItem(IDC_ENAME);
GetDlgItem will return NULL if it can't find the control with the specified ID.
The symbol might exist in your resource file, so no compile time error, but check the specific control in the resource editor and make sure it is assigned an ID of IDC_ENAME.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
or maybe i guess IDC_ENAME isnt CEdit
whitesky
|
|
|
|
|
That's possible, although every CWnd derived object supports SetWindowText, so my best guess is GetDlgItem is returning null.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
you right(of course in this thread it seems that my guess is ture)and i think he find problem. and i agree with GetDlgItem is returning null
whitesky
|
|
|
|
|
you said this code has problem
<br />
CEdit *pNameText;<br />
pNameText = (CEdit *) GetDlgItem(IDC_ENAME);<br />
pNameText->SetWindowText("test");<br />
Do you have IDC_ENAME in your program
and is this CEdit
whitesky
|
|
|
|
|
you know...i went back to check the ids and names of controls as you said to do...noticed that some how the names of controls in another window were being used in that window so i changed them to what they needed to be and well it works fine, now to see if i can get it to do what i need(which should be no problem at all.) thank you so much .
|
|
|
|