Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than user32, prefix the name with the module name and a period.
bool ProcessBatchResults()
{
FileInfo fi = new FileInfo(m_fileName);
return (fi.Length >0);
}
Alternative Managed API:
Do you know one? Please contribute it!
void IContextMenu.GetCommandString(int idCmd, uint uFlags, int pwReserved, StringBuilder commandString, int cchMax)
{
switch(uFlags)
{
case (uint)GCS.VERB:
commandString = new StringBuilder("...");
break;
case (uint)GCS.HELPTEXT:
commandString = new StringBuilder("...");
break;
}
}
void IContextMenu.InvokeCommand (IntPtr pici)
{
try
{
Type typINVOKECOMMANDINFO = Type.GetType("ShellExt.INVOKECOMMANDINFO");
INVOKECOMMANDINFO ici = (INVOKECOMMANDINFO)Marshal.PtrToStructure(pici, typINVOKECOMMANDINFO);
switch (ici.verb-1)
{
case 0:
RescheduleJob();
break;
case 1:
RetryNowJob();
break;
case 2:
CancelJob();
break;
case 100:
CommitJob();
break;
case 101:
RollbackJob();
break;
}
}
catch(Exception)
{
}
}
#endregion
#region IShellExtInit
int IShellExtInit.Initialize (IntPtr pidlFolder, IntPtr lpdobj, uint hKeyProgID)
{
try
{
if (lpdobj != (IntPtr)0)
{
// Get info about the directory
IDataObject dataObject = (IDataObject)Marshal.GetObjectForIUnknown(lpdobj);
FORMATETC fmt = new FORMATETC();
fmt.cfFormat = CLIPFORMAT.CF_HDROP;
fmt.ptd = 0;
fmt.dwAspect = DVASPECT.DVASPECT_CONTENT;
fmt.lindex = -1;
fmt.tymed = TYMED.TYMED_HGLOBAL;
STGMEDIUM medium = new STGMEDIUM();
dataObject.GetData(ref fmt, ref medium);
m_hDrop = medium.hGlobal;
}
}
catch(Exception)
{
}
return 0;
}
#endregion
#region Private Members
private void CancelJob()
{
MessageBox.Show("Gotta cancel the job", Path.GetFileName(m_fileName));
}
private void RescheduleJob()
{
MessageBox.Show("Gotta reschedule the job", Path.GetFileName(m_fileName));
}
private void RetryNowJob()
{
MessageBox.Show("Gotta retry the job NOW", Path.GetFileName(m_fileName));
}
private void CommitJob()
{
MessageBox.Show("Gotta commit the job", Path.GetFileName(m_fileName));
}
private void RollbackJob()
{
MessageBox.Show("Gotta rollback the job", Path.GetFileName(m_fileName));
}
#endregion
#region Registration
[System.Runtime.InteropServices.ComRegisterFunctionAttribute()]
public static void RegisterServer(String str1)
{
try
{
// For Winnt set me as an approved shellex
RegistryKey root;
RegistryKey rk;
root = Registry.LocalMachine;
rk = root.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", true);
rk.SetValue(guid.ToString(), "BatchResults shell extension");
rk.Close();
// Set "Folder\\shellex\\ContextMenuHandlers\\BatchResults" regkey to my guid
root = Registry.ClassesRoot;
rk = root.CreateSubKey("POPUPTEST\\shellex\\ContextMenuHandlers\\BatchResults");
rk.SetValue("", guid.ToString());
rk.Close();
}
catch(Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
[DllImport("user32")]
internal static extern int SetMenuItemBitmaps(HMenu hmenu, int nPosition, MFMENU uflags, IntPtr hBitmapUnchecked, IntPtr hBitmapChecked);
}
TODO - a short description
3/16/2007 7:48:22 AM - -12.170.217.217
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).