|
GetSubMenu and EnableMenuItem are members of CMenu, so you need to get access to the main menu like (this is from MSDN):
CMenu* menu = AfxGetApp()->m_pMainWnd->GetMenu()->GetSubMenu(2);
and then:
menu->EnableMenuItem(i, MF_BYPOSITION | MF_GRAYED);
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Hey Anu, before u ask the forum, just Check the MSDN for such small syntax errors. No Offence.
Syntax of GetSubMenu ,
It Looks like this :
HMENU GetSubMenu( HMENU hMenu,<br />
int nPos<br />
);
where hMenu can be retreived by
HMENU GetMenu(this->m_hWnd);
EnableMenuItem syntax Looks like this :
BOOL EnableMenuItem( HMENU hMenu,<br />
UINT uIDEnableItem,<br />
UINT uEnable<br />
);
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
Hi fellows.
I realized that with Visual C++ 8 it is possible to add comments in a C#-style:
<br />
class CMyClass<br />
{<br />
...<br />
};<br />
and that the compiler generates an .xml file, such as in C#. My question is the following: is there any tool such as NDoc that could process this .xml file into an HTML file?
Regards,
FG.
A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
|
|
|
|
|
The classic free tool which does (something like) this is Doxygen. It can parse C++ by itself and so doesn't require compiler support.
Steve
|
|
|
|
|
But Doxygen does not support <summary>...</summary> comments, does it?
I know there are other tools, particularly I prefer C++ Doc (www.cppdoc.com), but I'm looking for a tool that works with VC++ 8 comments.
Regards,
FG.
A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
|
|
|
|
|
Doxygen has a bewildering array of tags, although the syntax is different. It supports any C++ compiler.
Steve
|
|
|
|
|
Thanks Steve. Normally, I use cppdoc; of course, Doxygen is an option -as many others. However, I'd like to know if there is a tool for the file generated by Visual C++ 8, the xml file.
Regards,
FG.
A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
|
|
|
|
|
Hi All,
I have implemented context menu extension on my Namespace Extension icon. I have added 4 menus in my QueryContextMenu function. This works fine in Windows 2k. But I am able to see only the first menu added by me when I test it on WinXP or on Win2k3.
Also, explorer crashes when the user selects the "Create Shortcut" menu on win 2k.
Can anyone tell me what may be going wrong here?
Thanks and Regards,
Anil
|
|
|
|
|
This is how I implemented my QueryCOntextMenu
STDMETHODIMP MyShellFOlder::QueryContextMenu(HMENU hMenu, UINT uiIndexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
m_hMenu = hMenu;
m_idCmdFirst = uiIndexMenu;
m_id = idCmdFirst;
if (CMF_DEFAULTONLY & uFlags)
return MAKE_HRESULT(SEVERITY_SUCCESS,FACILITY_NULL,0);
int i = uiIndexMenu;
MxSNECmdMgr cmdMgr;
try
{
if(!cmdMgr.IsConnectedFromShell())
{
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.wID = idCmdFirst + ID_CONNECT;
mii.fType = MFT_STRING;
mii.dwTypeData = _T("Connect");
mii.fState = MFS_ENABLED;
bool b = InsertMenuItem(hMenu, uiIndexMenu++, TRUE, &mii);
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.wID = idCmdFirst + ID_SEARCH;
mii.fType = MFT_STRING;
mii.dwTypeData = _T("Search");
mii.fState = MFS_DISABLED;
b = InsertMenuItem(hMenu, uiIndexMenu++, TRUE, &mii);
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.wID = idCmdFirst + ID_CREATEUSINGTEMPLATE;
mii.fType = MFT_STRING;
mii.dwTypeData = _T("Create Using Template");
mii.fState = MFS_DISABLED;
b = InsertMenuItem(hMenu, uiIndexMenu++, TRUE, &mii);
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.wID = idCmdFirst + ID_DISCONNECT;
mii.fType = MFT_STRING;
mii.dwTypeData = _T("Disconnect");
mii.fState = MFS_DISABLED;
b = InsertMenuItem(hMenu, uiIndexMenu++, TRUE, &mii);
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.wID = idCmdFirst + ID_ABOUT;
mii.fType = MFT_STRING;
mii.dwTypeData = _T("About");
mii.fState = MFS_ENABLED;
b = InsertMenuItem(hMenu, uiIndexMenu++, TRUE, &mii);
}
catch(...)
{
}
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(i-uiIndexMenu));
}
|
|
|
|
|
Hai to all of you
i am doing my project in VC++ as Front End and MySQL as an Back End,
i am feeling some problem whenever i insert data using Form (VC++ dialog based form) i am sending some line of code written below .Please help me
where i am wrong........
void CEmpDetail::OnSubmit()
{
int i, j;
MYSQL * Conn;
MYSQL_RES * res;
MYSQL_ROW row;
CString sDAt,sEmpid,sEmpf,sEmpl,sDes,iPh,iEx,dDt,sMm,iYy,sQf,sTs,iTx,iHcx,sVis,sLoc,iOdc,sPrj,sGp,iPk,sMid,iFs,iOs;
CString sStr;
if ( (Conn = mysql_init((MYSQL*) 0)) &&
mysql_real_connect( Conn, "localhost", "", NULL, NULL, MYSQL_PORT, NULL, CLIENT_MULTI_STATEMENTS ) )
{
if ( mysql_select_db( Conn, "project") < 0 )
{
SetDlgItemText(IDC_STATIC_LOGIN_MSG, "Can't select the database !\nTry later.") ;
goto exit_here;
}
}
else
{
SetDlgItemText(IDC_STATIC_LOGIN_MSG, "Can't connect to the mysql server !\nPlease try later.") ;
goto exit_here;
}
GetDlgItemText(IDC_EMPID,sEmpid) ; ///////// Getting emp id from user
GetDlgItemText(IDC_EMPNMF,sEmpf) ;/////////emp first name
GetDlgItemText(IDC_EMPNML,sEmpl) ;///////////emp last name
GetDlgItemText(IDC_DESIGNATION,sDes) ;/////////////emp designation
GetDlgItemText(IDC_PHONENO,iPh) ;///////////phone
GetDlgItemText(IDC_EXTEN,iEx) ;//////////ext
GetDlgItemText(IDC_COMBO_DD,dDt) ;////////date
GetDlgItemText(IDC_COMBO_MM,sMm) ;////////Month
GetDlgItemText(IDC_COMBO_YY,iYy) ;////////Year
GetDlgItemText(IDC_EDIT_QFLN,sQf) ;/////qualification
GetDlgItemText(IDC_EDIT_TKSKL,sTs) ;/////////////////technical skill
GetDlgItemText(IDC_EDIT_TOTAL,iTx) ;///////////total exp
GetDlgItemText(IDC_EDIT_HCL,iHcx) ;///////hcl exp
GetDlgItemText(IDC_EDIT_VISA,sVis) ;//////////visa
GetDlgItemText(IDC_LOC,sLoc) ;////////////////loc
GetDlgItemText(IDC_ODC,iOdc) ;//////////odc
GetDlgItemText(IDC_PROJID,sPrj) ;/////////proj
GetDlgItemText(IDC_GROUP,sGp) ;///////////////group
GetDlgItemText(IDC_PACKAGE,iPk) ;//////////////package
GetDlgItemText(IDC_EMPMAIL,sMid) ;///////mail id
GetDlgItemText(IDC_OFFSH,iFs) ;/////////////////offshore
GetDlgItemText(IDC_ONSH,iOs) ;/////////onsite"vas"
if (!mysql_query( Conn,"INSERT INTO emp VALUES (\'" + sEmpid + "\',\'" + sEmpf + "\',\'" + sEmpl + "\',\'" + sDes + "\',\'" + iPh + "\',\'" + iEx + "\',\'" + dDt + "\',\'" + sMm + "\',\" + iYy + "\',\'" + sQf + "\',\'" + sTs + "\',\'" + iTx + "\',\'" + iHcx + "\',\'" + sVis + "\',\'" + sLoc + "\',\'" + iOdc + "\',\'" + sPrj + "\',\'" + sGp + "\,\'" + iPk + "\',\'" + sMid + "\',0,1)")))
{
res = mysql_store_result(Conn);
if(res)
{
MessageBox("Your Data Submit Successfully","Yse...",MB_ICONASTERISK);
}
else
{
MessageBox("Data Not Submitted","Error...",MB_ICONQUESTION);
goto exit_here;
}
}
else
{
MessageBox(" Query Not Execute ","Error...",MB_ICONQUESTION);
goto exit_here;
}
exit_here:
mysql_close( Conn );
UpdateData(FALSE);
}
i think i am lack of using any API Please help me where i am wrong.
Thanking you
Yogendra kumar kaushik
mailing me
Yogi
|
|
|
|
|
I'm not sure what you're asking but all the GetDlgItemText calls could be replaced with the DDX (Dialog Data eXchange). Use ClassWizard to add member variables for the controls then call UpdateData(TRUE) to get all the values.
Steve
|
|
|
|
|
After the strings are retrieved, u need to format the strings accordingly.
Suppose if u get sEmpid from the corresponding control,
Then in order to convert it into int,
u need to do
CString sEmpid ;<br />
GetDlgItemText(IDC_EDIT1,sEmpid );<br />
int iEmpId;<br />
iEmpId= atoi(strTest.GetBuffer(strTest.GetLength()));
Appu..
"If you judge people, you have no time to love them."
-- modified at 2:01 Thursday 1st June, 2006
|
|
|
|
|
Or Use GetDlgItemInt to get the Int data from the control
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
A couple of things I noticed.
1. Are all the fields in your table "text"? You are inserting values as if they are text, which probably will give you a type mismatch error (I'm not real familiar with MySql).
2. I don't think you need to escape the single quote characters (i.e. instead of \', can't you just use '?). Makes it hard for me to read.
What error are you getting exactly?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
yogikaushik wrote: where i am wrong........
You're going to need to narrow the problem down to just a few lines of code. No one likes to wade through a bunch of irrelevant code. What is the problem you are seeing? Have you single-stepped through the code to find the offending statement(s)? Help us to help you.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
like:
switch (n) {
case 0:
int i=0; //<<<<<<<<<<<<<<<<<
break;
case 1:
break;
}
|
|
|
|
|
switch (n) {
case 0:
{
int i=0; //<<<<<<<<<<<<<<<<<
}
break;
case 1:
break;
}
This is how it is done in VC7
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
It is my understanding that you can only use the variable within the case block. When you exit out of the block, the variable goes out of scope and it is destroyed.
Steve
|
|
|
|
|
Yes this is very true . The scope of the variable is only in the case block.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote:
This is how it is done in VC7
Nothing VC7-specific about it. This is how it has been done in C as far back as I can remember.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
how i link two MFC projects to visual C++ 6.0 ??
-- modified at 0:39 Thursday 1st June, 2006
|
|
|
|
|
U mean, inserting a project into another project.
Do this.
Right Click on the workspace,then click on Insert project in to workspace.
then u can observe both the project in the same workspace.
hope this helps.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
Hi,
I am working in vc++ for past 4 months.But i dont know very much about MFC.That is where the variables stored and memory allocation like that.When im doing coding,i got error as unhandled exception,Out of memory like that.So, i think im unaware about the memory allocation.So, Is there any tutorial about this allocation etc.,..?
|
|
|
|
|
|
Anu_Bala wrote: I am working in vc++ for past 4 months.But i dont know very much about MFC.That is where the variables stored and memory allocation like that.When im doing coding,i got error as unhandled exception,Out of memory like that.So, i think im unaware about the memory allocation.So, Is there any tutorial about this allocation etc.,..?
Well some of the things I know I would like to share.
- Use
new and delete .
- Always use
delete[] with new[] and delete with new - Do not mix up c, c++. Either you use C, or use C++ for memory allocation.
- Always set a pointer to
NULL after deletion.
- Always allocate sufficient amount of memory. Do not allocate memory like this...
char *str = new char[ strlen( someStr ) ];
strcpy( str, someStr );
delete [] str;
str = NULL;
instead use
char *str = new char[ strlen(someStr) + 1 ];
strcpy( str, someStr );
delete [] str;
str = NULL;
- Try using
auto_ptr ;
- Maintain a list of pointers to memory that you have allocated. When you exit from your app you can delete them all at one go if any of them hasn't been deleted.
- Always check for
NULL on pointers after a new .
- Always check for
NULL on pointers before using them.
- Be really really afraid to dynamically allocate memory.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|