|
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.
|
|
|
|
|
is it possible to add a progressbar to a statusbar panel, if yes, how?
|
|
|
|
|
|
I have added a Setup Project to my solution and added several files to the Setup Project.
One of the files that gets installed as part of the installation is required for initial running of the program but once a certain operation is performed that file is deleted and another file of a different name takes over that operation.
The problem is once that file is deleted when I try and run the program again it asks me for my program Installation CD so it can reinstall the deleted file.
How do I stop it wanting to reinstall this file?
Thanks
Paul
|
|
|
|
|
You'll need to define it's containing component as a transitive component. To do this using the Windows Installer project in Visual Studio, select the file and change the Transitive property to True. Then set the Condition property to "NOT Installed". Until the InstallFinalize standard action in a Windows Installer package is executed, the "Installed" property is not defined when installing the product. When repairing the product, however, it will be defined the the component will not cause a prompt for source because the component is no longer needed.
As for your applicatio nasking for the file, more information would be needed. I take it this is a managed assembly? If so, assemblies are published such that when an assembly is missing Windows Installer prompts for the source. Also, if you're launching a shortcut to your application that Windows Installer created, that shortcut forces a consistency check. If you're not starting your program from a shortcut created by Windows Installer, then you need to make sure that you don't have a reference to the one-use assembly in another assembly used by your program. You'll need to load and run code within that one-use assembly using reflection so that a early-bound reference is not created, thus causing a prompt for source.
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]
|
|
|
|
|
i have a checkbox on my form and i have placed the following code:
<br />
private void chkShowLaunchWindow_CheckedChanged(object sender, System.EventArgs e)<br />
{<br />
MessageBox.Show(chkShow.Checked.ToString());<br />
}<br />
why is that the messagebox always displays false. I want the mesage box to show true when the checkbox is checked and false when it is not checked.
|
|
|
|
|
I duplicated this and do not find a problem. It works as you state it should??????
You could look at the CheckState property.......
|
|
|
|