|
Thanks for the suggestions I will try them out
Debs
|
|
|
|
|
Is it possible to do it with menuitems?
And sure, mail the sample to me...
My email is: ulvinge@gmail.com
Niklas Ulvinge aka IDK
|
|
|
|
|
Thanks for all the suggestions I managed to do do it by the following:
TCheckBox *ChkBx[34];
ChkBx[0]=CheckBox1; //Declaring them all once into an array
ChkBx[1]=CheckBox2;
...
ChkBx[33]=CheckBox33;
for(int i=0;i!=4;i++)
{
ChkBx[i]->Checked=true;
}
I also used this concept with Graph Line Series ie.
TChartSeries *Ser[4];
...
Thanks Again
Debs
-- modified at 13:11 Friday 23rd September, 2005
|
|
|
|
|
Hello!
Ihave extendended the ShellLib (from arikp's article) to support the IEnumIDList interface. Here is the code:
<br />
[ComImport]<br />
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]<br />
[Guid("000214F2-0000-0000-C000-000000000046")]<br />
public interface IEnumIDList<br />
{<br />
[PreserveSig]<br />
Int32 Clone(out IntPtr ppenum);<br />
<br />
[PreserveSig]<br />
Int32 Next(UInt32 celt, <br />
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)]<br />
out IntPtr[] rgelt,<br />
out UInt32 pceltFetched<br />
);<br />
<br />
[PreserveSig]<br />
Int32 Reset();<br />
<br />
[PreserveSig]<br />
Int32 Skip(UInt32 celt);<br />
}<br />
and I get an instance of this interface using:
<br />
public static IEnumIDList GetEnumIDList(IntPtr ptrEnumIDList)<br />
{<br />
System.Type shellEnumIDListType = System.Type.GetType("ShellLib.IEnumIDList");<br />
Object obj = Marshal.GetTypedObjectForIUnknown(ptrEnumIDList, shellEnumIDListType);<br />
IEnumIDList RetVal = (IEnumIDList)obj;<br />
return RetVal;<br />
}<br />
If I try this code:
<br />
UInt32 celt = 10;<br />
IntPtr[] ptrList = new IntPtr[celt];<br />
UInt32 count;<br />
EnumIDList.Next(celt, out ptrList, out count)<br />
The Shell dosen't fill the ptrList and count is 0. The IShellFolder is the Desktop folder.
<br />
IntPtr ptrFoldersList;<br />
iDesktopFolder.EnumObjects(this.Handle, (Int32)ShellApi.SHCONTF.SHCONTF_FOLDERS | (Int32)ShellApi.SHCONTF.SHCONTF_STORAGE, out ptrFoldersList);<br />
If you need any details please let me know. I don't really see what I did wrong... (maybe I'm dumb ).
Thank you!
|
|
|
|
|
When deriving your interface from IUnknown (which is what happens in the CLR when you specify ComInterfaceType.InterfaceIsIUnknown for the InterfaceTypeAttribute on the interface), the methods must be in the ordered defined - not the order documented. This means the interface should be defined as:
[Guid("000214F2-0000-0000-C000-000000000046"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
ComImport]
public interface IEnumIDList
{
[PreserveSig] int Next(ulong celt, IntPtr[] rgelt, out ulong pceltFetched);
[PreserveSig] int Skip(ulong celt);
[PreserveSig] int Reset();
[PreserveSig] int Clone(out IEnumIDList ppenum);
} This is also true of ComInterfaceType.InterfaceIsDual . If you use only ComInterfaceType.InterfaceIsIDispatch then you must have attribute your methods and properties with the correct DispIdAttribute values.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
It works now! Thank you very much. I'll keep that in mind next time.
|
|
|
|
|
Or not... All I get is the same folder that called EnumObjects. pceltFetched == 1 in all the situations and the rgelt[0] points to the parents PIDL. Very strange... Any explications would be very helpful. Thank you.
|
|
|
|
|
I would have to see more of your implementation to know how you're using it.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
In my test projects this are the functions that manage the IEnumIDList Interface:
<br />
public static IEnumIDList GetEnumIDList(IntPtr ptrEnumIDList)<br />
{<br />
System.Type shellEnumIDListType = System.Type.GetType("JSoftware.CustomTools.ShellLib.IEnumIDList");<br />
Object obj = Marshal.GetTypedObjectForIUnknown(ptrEnumIDList, shellEnumIDListType);<br />
IEnumIDList RetVal = (IEnumIDList)obj;<br />
return RetVal;<br />
}<br />
<br />
public static String[] GetSubFolders(IEnumIDList EnumIDList)<br />
{<br />
UInt32 celt = 10;<br />
IntPtr[] ptrList = new IntPtr[celt];<br />
UInt32 count = 5;<br />
<br />
String[] PathList;<br />
<br />
IShellFolder iSubFolder;<br />
IntPtr ptrRelative = IntPtr.Zero;<br />
IntPtr ptrSubFolder;<br />
ShellApi.STRRET ptrData;<br />
<br />
EnumIDList.Reset();<br />
<br />
if (EnumIDList.Next(celt, ptrList, out count) == 0)<br />
{<br />
PathList = new String[count];<br />
for (UInt32 i = 0; i < count; i++)<br />
{<br />
ShellApi.SHBindToParent(ptrList[i], ShellGUIDs.IID_IShellFolder, out ptrSubFolder, ref ptrRelative);<br />
iSubFolder = GetShellFolder(ptrSubFolder);<br />
iSubFolder.GetDisplayNameOf(ptrRelative, (uint)ShellApi.SHGNO.SHGDN_NORMAL, out ptrData);<br />
ShellApi.StrRetToBSTR(ref ptrData, ptrList[i], out PathList[i]);<br />
}<br />
return PathList;<br />
}<br />
return null;<br />
}<br />
The code that uses those functions:
<br />
private void GetMainFolders()<br />
{<br />
DummyTreeNode RootNode;<br />
IntPtr ptrRootFolder;<br />
ShellApi.SHGetFolderLocation(this.Handle, (short)ShellApi.CSIDL.CSIDL_DRIVES, IntPtr.Zero, 0, out ptrRootFolder);<br />
IShellFolder iRootFolder= ShellFunctions.GetShellFolder(ptrRootFolder);<br />
IntPtr ptrFoldersList;<br />
<br />
ShellApi.STRRET iInfo;<br />
iRootFolder.EnumObjects(this.Handle, (Int32)ShellApi.SHCONTF.SHCONTF_FOLDERS | (Int32)ShellApi.SHCONTF.SHCONTF_NONFOLDERS, out ptrFoldersList);<br />
IEnumIDList iFoldersList = ShellFunctions.GetEnumIDList(ptrFoldersList);<br />
RootNode = (DummyTreeNode)Nodes[0];<br />
RootNode.AddSubFolders(iFoldersList);<br />
}<br />
<br />
public void AddSubFolders(IEnumIDList EnumIDList)<br />
{<br />
try<br />
{<br />
String[] SubFolders = ShellFunctions.GetSubFolders(EnumIDList);<br />
for (int i = 0; i < SubFolders.Length; i++)<br />
{<br />
this.Nodes.Add(new DummyTreeNode(SubFolders[i]));<br />
}<br />
<br />
}<br />
catch (Exception e)<br />
{<br />
System.Windows.Forms.MessageBox.Show(e.Message);<br />
}<br />
}<br />
<br />
DummyTreeNode is a class that inherits from TreeNode class. Nodes[0] exists and it is the iRootFolder display name. (These are beta functions and are harder to read... sorry for that)
PS: I get an ExecutionEngineException in GetShellFolder(ptrRootFolder)...
|
|
|
|
|
And ExecutionEngineException is hardly a small matter for a "PS" - that's about the worst exception the CLR can throw, which indicates a problem with the CLR itself. I also don't know what GetShellFolder does.
You might consider running a repair on the .NET Framework from the Add/Remove Programs control panel applet.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
<br />
public static IShellFolder GetShellFolder(IntPtr ptrShellFolder)<br />
{<br />
System.Type shellFolderType = GetShellFolderType();<br />
Object obj = Marshal.GetTypedObjectForIUnknown(ptrShellFolder, shellFolderType);<br />
IShellFolder RetVal = (IShellFolder)obj;<br />
return RetVal;<br />
}<br />
<br />
public static Type GetShellFolderType()<br />
{<br />
System.Type shellFolderType = System.Type.GetType("JSoftware.CustomTools.ShellLib.IShellFolder");<br />
return shellFolderType;<br />
}<br />
It was the first time i used GetShellFolder (until now I used SHGetDesktopFolder because I wanted iRootFolder to be the Desktop folder). Thank you for the support!
|
|
|
|
|
I am dumb! It works now... I forgot to get the IShellFolder structure from the PIDL with SHBindToParent()...
|
|
|
|
|
Hello!!
Im trying to remove all html tags except some tags like <b> and <i>.
I did a nonCapturing Group but this don't work.
Alternate bar | suppose to match left most option....
If i found a <i> or </i> tag i dont want to replace it with "".
Regex.Replace(inputText, @"</?(?:i|b)>|</?([^>]|\n)*?>", "");
Please Help me !!!!
Thanks !!
Bruno Conde
pharaoh
-- modified at 11:16 Thursday 22nd September, 2005
|
|
|
|
|
A non-capturing group doesn't mean that the pattern isn't matched. It only means that the match does not create a group.
---
b { font-weight: normal; }
|
|
|
|
|
Your right... I corrected the problem in another way.
Thanks
Bruno Conde
|
|
|
|
|
:(Hi, codeprojectors
I edit a "ad.xml" file,the code is below:
-------------------------------------------
<Advertisements>
<AD>
<ImageUrl>images/redcar.gif</ImageUrl>
<TargetUrl>www.csdn.net</TargetUrl>
<AlternateText>red</AlternateText>
<Keyword>1</Keyword>
<Impressions>20</Impressions>
</AD>
<AD>
<ImageUrl>images/bluecar.gif</ImageUrl>
<TargetUrl>www.sohu.com</TargetUrl>
<AlternateText>blue</AlternateText>
<Keyword>1</Keyword>
<Impressions>50</Impressions>
</AD>
<AD>
<ImageUrl>images/greencar.gif</ImageUrl>
<TargetUrl>www.163.com</TargetUrl>
<AlternateText>green</AlternateText>
<Keyword>2</Keyword>
<Impressions>100</Impressions>
</AD>
</Advertisements>
-------------------------------------------
and then I drag a AdRotator in the webform.aspx
I set the "Advertisementfile" property point the "ad.xml",when I run the programme, It doesn't work!!
My Question is:
Because the picture is exsist in my "image\" directory,but they can't show!
(1)Whether I must write some codes in webform.aspx.cs?
(2)What are they looklike ??
(3)Can you show me the Page_Load() source codes??
Thank you very much!!
shanzy
-- modified at 11:03 Thursday 22nd September, 2005
|
|
|
|
|
the error message is below:
---------------------------------
The AdRotator Advertisements found no valid advertisements in the file 'ad.xml'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The AdRotator Advertisements found no valid advertisements in the file 'ad.xml'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): The AdRotator Advertisements found no valid advertisements in the file 'ad.xml'.]
System.Web.UI.WebControls.AdRotator.LoadFile(String fileName)
System.Web.UI.WebControls.AdRotator.GetFileData(String fileName)
System.Web.UI.WebControls.AdRotator.SelectAdFromFile()
System.Web.UI.WebControls.AdRotator.OnPreRender(EventArgs e)
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Page.ProcessRequestMain()
---------------------------------
shanzy
|
|
|
|
|
It's not finding any ad's because you're not using the correct tags. They are:
<?xml version="1.0" ?>
<Advertisements>
<Ad>
<ImageUrl>image1.jpg</ImageUrl>
<NavigateUrl>http:
<AlternateText>Microsoft Main Site</AlternateText>
<Impressions>80</Impressions>
<Keyword>Topic1</Keyword>
<Caption>This is the caption for Ad#1</Caption>
</Ad>
</Advertisements>
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi all
is there any way in C# makes me catch the hotkey (win+D) and override this message to do my own
thx all
|
|
|
|
|
yeah there is, i found this awesome library on planet-source-code.com. I dont exactly remeber the link but run a search for Hotkey and Hot Key and the result will show up. Its really easy use. Use it and save yourself the trouble of reinventing the wheel.
|
|
|
|
|
Do you know how to change windows system time througth c#,c++?
|
|
|
|
|
You need to P/Invoke SetSystemTime and the caller requires the SE_SYSTEMTIME_NAME privilege. By default, only Administrators and Power Users have that privilege on a workstation. See http://pinvoke.net/default.aspx/kernel32/SetSystemTime.html[^] for the P/Invoke signature.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Do the .net XML classes support the creation of htmlstyle <-- blah blah blah --> type comments? I've tried googling but couldn't figure out how to fliter all the source documentation hits.
|
|
|
|
|
Actually, those are SGML comments - the defining languages for HTML, XML, and others - and are written like so:
<!-- comment --> The exclamation mark is important or it will be treated like an element, but will be invalid.
There is the XmlComment[^] class that represents comments in XML, but what example do you mean by "filter"? Are you trying to get all comments using an XPath expression or what?
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thank you. Waht I was refering to by filter was that when I googled on 'c# xml comment' all the hits I got were for /// style xml comments in sourcecode.
|
|
|
|