Click here to Skip to main content
15,902,114 members
Home / Discussions / C#
   

C#

 
AnswerRe: 64bit and OutOfMemory Pin
Alan Balkany3-Aug-09 4:47
Alan Balkany3-Aug-09 4:47 
QuestionHow to detect if a folder is open Pin
rick05562-Aug-09 20:25
rick05562-Aug-09 20:25 
AnswerRe: How to detect if a folder is open Pin
Christian Graus2-Aug-09 20:37
protectorChristian Graus2-Aug-09 20:37 
Answer[Message Deleted] Pin
Hristo-Bojilov2-Aug-09 21:31
Hristo-Bojilov2-Aug-09 21:31 
GeneralRe: How to detect if a folder is open Pin
rick05562-Aug-09 21:45
rick05562-Aug-09 21:45 
GeneralRe: How to detect if a folder is open Pin
Christian Graus2-Aug-09 21:58
protectorChristian Graus2-Aug-09 21:58 
GeneralRe: How to detect if a folder is open Pin
Dave Kreskowiak3-Aug-09 3:49
mveDave Kreskowiak3-Aug-09 3:49 
GeneralRe: How to detect if a folder is open Pin
Hristo-Bojilov3-Aug-09 7:37
Hristo-Bojilov3-Aug-09 7:37 
Hi Dave!
Sorry I've completely forgotten about this , I was hurried to much for my lunch before the post.In order to avoid confusion I've just deleted my previous post.I agree that my fast method by using FindWindow wasn't sophisticated.
Here is my C++ function that solves the solution.It easy could be converted to .NET too.

<br />
BOOL IsOpenedNyWindowsExplorer(CString FolderName)<br />
{<br />
   ATLENSURE(FolderName);<br />
<br />
   BOOL RESULT=FALSE;<br />
   IShellWindows *psw;<br />
   HRESULT hr=0;<br />
<br />
   hr = CoCreateInstance(CLSID_ShellWindows, NULL, CLSCTX_ALL,IID_IShellWindows,(void**)&psw);<br />
    <br />
    if (SUCCEEDED(hr))<br />
    {<br />
		long lCount=0;<br />
		psw->get_Count(&lCount);<br />
		for (int i = 0; i < (int)lCount; i++)<br />
        {<br />
            _variant_t vtIndex( (long)i);<br />
			IDispatch* pDisp=NULL;<br />
		    hr=psw->Item(vtIndex,&pDisp);<br />
			if(SUCCEEDED(hr))<br />
			{<br />
               IWebBrowser2* pBrowser=NULL;<br />
			   hr=pDisp->QueryInterface(IID_IWebBrowser2,(void**)&pBrowser);<br />
			   if(SUCCEEDED(hr))<br />
			   {<br />
                   BSTR Loc=SysAllocStringLen(NULL,270);<br />
				   hr=pBrowser->get_LocationURL(&Loc);<br />
				   if(SUCCEEDED(hr))<br />
				   {<br />
					   TCHAR* Dest=new TCHAR[270];<br />
					   DWORD Buff=0;					   <br />
					   CString str(Loc);<br />
					   if(AtlUnescapeUrl(str,Dest,&Buff,270))<br />
					   {<br />
						   str.ReleaseBuffer();<br />
						   str=Dest;<br />
<br />
						   str.TrimLeft(L"file:///").Replace('/','\\');<br />
						   if(!FolderName.CompareNoCase(str)) <br />
						     RESULT=TRUE;<br />
<br />
						   str.ReleaseBuffer();<br />
					   }<br />
					   str.ReleaseBuffer();<br />
					   delete[] Dest;<br />
					   pBrowser->Release();<br />
				   }<br />
				   SysFreeString(Loc);<br />
			   }<br />
			   pDisp->Release();<br />
			}<br />
	    }<br />
        <br />
        psw->Release();<br />
    }<br />
<br />
	return RESULT;<br />
}<br />

QuestionLinq Pin
Sayed Sajid2-Aug-09 20:21
Sayed Sajid2-Aug-09 20:21 
AnswerRe: Linq Pin
Christian Graus2-Aug-09 20:35
protectorChristian Graus2-Aug-09 20:35 
GeneralRe: Linq Pin
Sayed Sajid2-Aug-09 20:42
Sayed Sajid2-Aug-09 20:42 
GeneralRe: Linq Pin
riced2-Aug-09 23:18
riced2-Aug-09 23:18 
AnswerRe: Linq Pin
N a v a n e e t h2-Aug-09 20:42
N a v a n e e t h2-Aug-09 20:42 
QuestionFinding Nested ( ) pairs Pin
Adam R Harris2-Aug-09 20:07
Adam R Harris2-Aug-09 20:07 
AnswerRe: Finding Nested ( ) pairs Pin
OriginalGriff2-Aug-09 21:24
mveOriginalGriff2-Aug-09 21:24 
GeneralRe: Finding Nested ( ) pairs Pin
Adam R Harris3-Aug-09 9:05
Adam R Harris3-Aug-09 9:05 
AnswerRe: Finding Nested ( ) pairs Pin
Luc Pattyn3-Aug-09 0:27
sitebuilderLuc Pattyn3-Aug-09 0:27 
GeneralRe: Finding Nested ( ) pairs Pin
Adam R Harris3-Aug-09 9:10
Adam R Harris3-Aug-09 9:10 
GeneralRe: Finding Nested ( ) pairs Pin
Luc Pattyn3-Aug-09 9:24
sitebuilderLuc Pattyn3-Aug-09 9:24 
AnswerRe: Finding Nested ( ) pairs Pin
PIEBALDconsult3-Aug-09 5:58
mvePIEBALDconsult3-Aug-09 5:58 
GeneralRe: Finding Nested ( ) pairs Pin
Adam R Harris3-Aug-09 9:12
Adam R Harris3-Aug-09 9:12 
QuestionExcel and C# Pin
veon cheng2-Aug-09 20:04
veon cheng2-Aug-09 20:04 
AnswerRe: Excel and C# Pin
Christian Graus2-Aug-09 20:14
protectorChristian Graus2-Aug-09 20:14 
GeneralRe: Excel and C# Pin
Adam R Harris2-Aug-09 20:16
Adam R Harris2-Aug-09 20:16 
AnswerRe: Excel and C# Pin
Adam R Harris2-Aug-09 20:15
Adam R Harris2-Aug-09 20:15 

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.