Click here to Skip to main content
15,900,110 members
Home / Discussions / COM
   

COM

 
GeneralRe: using matlab code in vb environment Pin
freesun5-May-06 0:58
freesun5-May-06 0:58 
GeneralRe: using matlab code in vb environment Pin
Vibhash Jha5-May-06 1:20
Vibhash Jha5-May-06 1:20 
GeneralRe: using matlab code in vb environment Pin
freesun5-May-06 3:53
freesun5-May-06 3:53 
GeneralRe: using matlab code in vb environment Pin
Vibhash Jha5-May-06 4:31
Vibhash Jha5-May-06 4:31 
GeneralRe: using matlab code in vb environment Pin
freesun5-May-06 4:33
freesun5-May-06 4:33 
GeneralRe: using matlab code in vb environment Pin
Vibhash Jha5-May-06 4:57
Vibhash Jha5-May-06 4:57 
GeneralRe: using matlab code in vb environment Pin
freesun5-May-06 6:29
freesun5-May-06 6:29 
QuestionWorking with the Shell and an object in a virtual folder Pin
DeepT25-Apr-06 8:23
DeepT25-Apr-06 8:23 
I am trying to enable and disable a network adapter (not release and renew). It seems the only way to do this is through the shell object. I have been grinding on this problem for over a week. Currently I am stuck trying to apply a 'verb' to an contextmenu object.

Here are two relevent code snippets:

	// Now loop through the menu and see if we see the enalbed menu item.<br />
		bool FoundOne = false;<br />
		bool ContextMenuLoop = true;<br />
		CString MenuItemName;<br />
		CMenu MyMenu;<br />
		MyMenu.CreatePopupMenu();<br />
		MENUITEMINFO MenuItemInfo;<br />
		ZeroMemory(&MenuItemInfo, sizeof(MenuItemInfo));<br />
		MenuItemInfo.cbSize = sizeof(MenuItemInfo);<br />
		MenuItemInfo.fMask = MIIM_ID | MIIM_TYPE;<br />
<br />
		char Buff[50];<br />
		ZeroMemory(Buff, sizeof(Buff));<br />
		MenuItemInfo.cch =49;<br />
		MenuItemInfo.dwTypeData = Buff;<br />
		MenuItemInfo.fType = MFT_STRING;<br />
<br />
		<br />
		<br />
		int Offset = (int)ContextMenu->QueryContextMenu(MyMenu, 0, 1, 30000, CMF_EXPLORE);<br />
		unsigned int J;<br />
		<br />
		// Loop through all menu items and see if it has a Disable option<br />
		for (J = 0; J < MyMenu.GetMenuItemCount(); J++)<br />
		{<br />
			int T;<br />
			T = MyMenu.GetMenuItemID(J);<br />
			if (T > 0)<br />
			{<br />
				MyMenu.GetMenuString(T, MenuItemName, MF_BYCOMMAND);<br />
				MyMenu.GetMenuItemInfo(T, &MenuItemInfo);<br />
				if (DISABLE_VERB  == MenuItemName)<br />
				{<br />
					FoundOne = true;<br />
					break;<br />
				}<br />
			}<br />
		}


At this point I have the context menu object, and actually found the DISABLE_VERB. I also MenuItemInfo for this particular menu item. So far so good...

	// Now that we found one, we need to cycle it<br />
		if (true == FoundOne)<br />
		{<br />
			HRESULT Hr = NULL;<br />
<br />
			CMINVOKECOMMANDINFO Cmd;<br />
			ZeroMemory(&Cmd, sizeof(Cmd));<br />
			Cmd.cbSize = sizeof(CMINVOKECOMMANDINFO);<br />
			Cmd.lpVerb = MAKEINTRESOURCE(MenuItemInfo.wID);<br />
		<br />
			Hr = ContextMenu->InvokeCommand(&Cmd);<br />
			int L = GetLastError();<br />
<br />
	<br />
			Sleep(100);<br />
<br />
			Cmd.lpVerb = ENABLE_VERB;<br />
	//		Hr = ContextMenu->InvokeCommand(&Cmd);<br />
		}


The line in bold is the key line. Its where I set my verb. If I use the DISABLE_VERB, which I just found, it gives me an invalid parameter error (80030057). I set the verb directly, such like Cmd.lpVerb = DISABLE_VERB; when I get this error. I have no idea why since I searched for it and found it.

Next I tried using the wID (as it is done in this code snippet) and while it accepted the parameter, it did the wrong thing (It tried to bridge network connections). I thought the index might be off by +/- 1, but that didn't help.

Can anyone tell me what I am doing wrong?
QuestionCOM interface as a wrapper for MFC SDI Pin
kirannarik25-Apr-06 2:55
kirannarik25-Apr-06 2:55 
QuestionCOM Events Pin
HakunaMatada24-Apr-06 19:46
HakunaMatada24-Apr-06 19:46 
AnswerRe: COM Events Pin
Roger Stoltz24-Apr-06 22:24
Roger Stoltz24-Apr-06 22:24 
GeneralRe: COM Events Pin
HakunaMatada25-Apr-06 0:26
HakunaMatada25-Apr-06 0:26 
AnswerRe: COM Events Pin
Roger Stoltz25-Apr-06 1:45
Roger Stoltz25-Apr-06 1:45 
GeneralRe: COM Events Pin
HakunaMatada25-Apr-06 2:05
HakunaMatada25-Apr-06 2:05 
AnswerRe: COM Events Pin
Roger Stoltz25-Apr-06 3:20
Roger Stoltz25-Apr-06 3:20 
GeneralRe: COM Events Pin
HakunaMatada25-Apr-06 3:27
HakunaMatada25-Apr-06 3:27 
QuestionDouble-click on lnk file Pin
Samsung24-Apr-06 9:25
Samsung24-Apr-06 9:25 
Questionllo,Double-click on lnk file Pin
Samsung24-Apr-06 9:20
Samsung24-Apr-06 9:20 
QuestionCOM's Event! Pin
huangdingjun23-Apr-06 3:34
huangdingjun23-Apr-06 3:34 
AnswerRe: COM's Event! Pin
Stephen Hewitt23-Apr-06 13:39
Stephen Hewitt23-Apr-06 13:39 
GeneralRe: COM's Event! Pin
hdj831123-Apr-06 15:12
hdj831123-Apr-06 15:12 
GeneralRe: COM's Event! Pin
Stephen Hewitt23-Apr-06 16:08
Stephen Hewitt23-Apr-06 16:08 
GeneralRe: COM's Event! Pin
hdj831123-Apr-06 19:21
hdj831123-Apr-06 19:21 
Questionproblem with com events Pin
kk_mfc21-Apr-06 19:27
kk_mfc21-Apr-06 19:27 
AnswerRe: problem with com events Pin
Lim Bio Liong23-Apr-06 2:00
Lim Bio Liong23-Apr-06 2:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.