|
Hi friend i have some problem
I have code
if (!File.Exists(path))<br />
{<br />
File.Create(path);<br />
<br />
}<br />
StreamWriter objWriter = new StreamWriter(path, true);
if File does not exist then it Create the File but just after creation when the Stream writer object is created it throw exception that the File is used by another Process how i can overcome this problem
wasim khan
|
|
|
|
|
Hmm.. you don't have to create the file first. It will automatically created, if you call:
objWriter.Close();
|
|
|
|
|
Thanx man it really work for me
wasim khan
|
|
|
|
|
Hey everybody!
I wrote a clipboard monitor using "SetClipboardViewer()", "SendMessage()", and "ChangeClipboardChain()" in the windows API.
But I have 2 more problems I just can't figure out...
1.
using GetClipboardOwner(), I'm getting a handle to a window, but I couldn't find a way to know which window is it. So, how can I tell, using IntPtr to which window do I have a handle to?
2.
I'm trying for some time to find ANY way to get information about global paste events.
I know that if I can get a "control" object I can override the WndProc() function to get messages, but about other windows in the system?
For example, what if I want to prevent paste of the clipboard data if it is not in my application ?
Thanks a lot for your help!!!
|
|
|
|
|
Hello Friends,
I am developing a windows application where i need to make two versions for the application one is Full and another is DEMO version
My Question is how to make DEMO version 30 Days Trial and after 30 days it will expires if user changes system date back or forward then one day will be subtracted from trail..
Thanks
|
|
|
|
|
You can Create key in registry which holds the data of your application.Simply add parameter(subkey) like dayRemaining, lastUsedDate etc to this key in registry and check at application startup.
If you have no idea about registry then click the Read,Write and delete from registry with c#
hope this helps
|
|
|
|
|
CodeProject search: Secure Software Distribution SDK[^]
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Hi,
I need to get printed document name using PJL in C#.
I tried USTATUS command , but unable to get document name and computer name.
can anybody help me, if anybody has done this before?
Thanks.
Regards,
Sunil.
|
|
|
|
|
I have "System.ComponentModel.Win32Exception: Access is denied Exception."
while try to get Processinformation of some process using System.Diagnostics
Can anybody help
Thanks,
Soni
|
|
|
|
|
Most likely you did not use Credentials with Admin Permissions for executing the query?
:: It's better to burn out than to fade away ::
|
|
|
|
|
Hi friends,
I have 2 list box and a horizontal Splitter. When I resize the window, both the listbox does not resize proportionally. The top listbox remains in same height, the bottom listbox gets resized.
The properties for splitter is
cursor - HSplit
Dock - Top
The properties for listbox1 is
Dock - Top
Anchor - Top,Left
The properties for listbox2 is
Dock - Fill
Anchor - Top,Left
I tried changing the dock properties. It does not help me.
Please help me.
Thanks,
Thiaga
|
|
|
|
|
I'm pretty sure you need to change the Anchor settings of the listbox controls. If for example you anchor them to each side they will resize whenever you resize the entire Form. The Dock option just defines to which side the listbox element sticks, like an "align" in html if I remember it right
:: It's better to burn out than to fade away ::
modified on Tuesday, July 15, 2008 10:14 AM
|
|
|
|
|
Dear All,
Please help me solving following issue.
Background Information
------------------------------------
1. We have 2 web application running on MOSS + IIS 6
2. Both applications are on same web server, run by System Admin account
3. Developed using ASP.Net, C# and DB as SQL Server 2005
4. One is running on Framework 2.0 and second is on Framework 3.5
5. In both we are using Office Objects to impose IRM permissions
6. Both were working till latest windows update on the web server.
7. After that we started getting following errors
Errors
---------
Word object: Not Able to Open the word file at all
------------------
System.Runtime.InteropServices.COMException (0x800A1401): Word experienced an error trying to open the file.
Try these suggestions.
* Check the file permissions for the document or drive.
* Make sure there is sufficient free memory and disk space.
* Open the file with the Text Recovery converter. (C:\...\My File.doc)
at Microsoft.Office.Interop.Word.Documents.Open(Object& FileName, Object& ConfirmConversions, Object& ReadOnly, Object& AddToRecentFiles, Object& PasswordDocument, Object& PasswordTemplate, Object& Revert, Object& WritePasswordDocument, Object& WritePasswordTemplate, Object& Format, Object& Encoding, Object& Visible, Object& OpenAndRepair, Object& DocumentDirection, Object& NoEncodingDialog, Object& XMLTransform)
at OpenFile.SetExpiryDate(String strFilePath, String strExpiryDate) in c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\My Application\MyPage.aspx.cs:line 1033
Excel Object: Not Able Close the excel file even though all objects are explicitly closed.
-------------------
When try to delete file following error comes.
The process cannot access the file 'C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\TEMPLATE\\LAYOUTS\\My Application\\Scratchpad\\Book1.xlsx' because it is being used by another process
PowerPoint object: Not able to save
---------------------------
Presentation (unknown member) : An error occurred while PowerPoint was saving the file.
Is this some kind of a security permission issue on the folder where we are processing the file? Right now I have given full permission to following accounts.
1. Administrators
2. ASP.Net
3. Network Service
4. System
After the error I gave full permission to Everyone, still the problem persists.
I have uninstalled office and installed it with latest security patches. Removed old COM reference (Microsoft Excel, Word, PowerPoint) and added new, but still no progress.
Any other thing I need to check or update?
|
|
|
|
|
dear all,
with trial and error, I found a work around for this. I don't know if its correct or not, but pesting it for your reference.
Start - Run - type "dcomcnfg.exe" click ok
It will open Component Services
Under
- Console Root
-- Component Services
--- Computers
---- My Computer
----- DCOM Config
Open the properties of following
- Microsoft Excel Application
- Microsoft Office PowerPoint Slide
- Microsoft Office Word 97 - 2003 Document
Go to Identity tab
Select "This User" and add 'system admin' credentials
In my case same system admin is used in the identity of application pool in IIS
|
|
|
|
|
Let's say there is no method called Find<t> in Array class. So, I created my own Find<t> method. then, if I type Array. then I want to show my own method "Find<t>" in intellisense. AFAIK, C# extension method doesn't fit in this scenario so is there any way to make my own method to show in Intellisense? is there such a thing like attached method (similar to attached properties in WPF)?
|
|
|
|
|
Create a new class derive from Array. Then add a public method "Find" in it. Then you will see the method "Find" in Intellisense.
|
|
|
|
|
Really. If I type "Array" "." then I will see "Find" in Intellisense?
So, like that?
public class Array : System.Array{
public static T Find<t>(T[] array,
Predicate<t> match) {
//...... my implementation.....
}
}
SO, Can I use like that ?
Point first = Array.Find(points, ProductGT10);
|
|
|
|
|
|
I just tried and found that it doesn't work.
namespace SilverlightHelpers.Helpers {
//Silverlight - Array Class: http://msdn.microsoft.com/en-us/library/system.array_members(VS.95).aspx
//.NET - Array Class: http://msdn.microsoft.com/en-us/library/system.array_members.aspx
public static class Array : System.Array {
Error: Error 1 'SilverlightHelpers.Helpers.Array' cannot derive from special class 'System.Array' C:\Michael Sync\Personal\Silverlight\SilverlightHelpers\SilverlightHelpers\Helpers\ArrayHelper.cs 9 25 SilverlightHelpers
Another Error: Error 2 'Array' is an ambiguous reference between 'System.Array' and 'SilverlightHelpers.Helpers.Array' C:\Michael Sync\Personal\Silverlight\SilverlightHelpers\SilverlightHelpers\Page.xaml.cs 34 27 SilverlightHelpers
|
|
|
|
|
I think I will have to live with the way that I used in this project[^]. ArrayHelper.Find()?
|
|
|
|
|
You cant derive from Array dummy
|
|
|
|
|
Explain again why extension methods wont work?
I have something like this in my project
public static IEnumerable<T> Sort<T>(this IEnumerable<T> source, string sortExpression)
{
...
}
and on for example a List<MyObject> I can go myList.Sort("myField DESC") and it shows up in intellisense.
|
|
|
|
|
J4amieC wrote: myList.Sort("myField DESC") and it shows up in intellisense.
Yes. because "myList" is an object.
For example:
I have an extension method like that.
namespace SilverlightHelpers.Helpers {
public static class ArrayHelper {
public static T Find<t>(this Array ary,
T[] array,
Predicate<t> match) {
foreach (var o in array) {
if (match(o)) {
return o;
}
}
return default(T);
}
}
}</t></t>
if I use like Array.Find, it won't work.
but if I use like
Point[] points = { new Point(100, 200),
new Point(150, 250), new Point(250, 375),
new Point(275, 395), new Point(295, 450) };
points.Find << It will work.
Please correct me if I'm wrong..
|
|
|
|
|
maybe, i think it's the differences between object and type?
|
|
|
|
|
right, you cant add static extension methods AFAIK (of course all extension methods themselves are static, but you cant add a static extension method to a class).
So your only option is MyArrayHelper.Find
|
|
|
|