|
i have a simple network of two computer (xp prof installed on both).i have created a user on both machine with same name and password and both are members of admin.. group.
i have created a service in c# i am running it in local system account.
but i could not access any file on the network of another computer in my service of c#?
could any body help me in this regard?
r00d0034@yahoo.com
|
|
|
|
|
I have an MDI app that opens a child window and the child window performs a long database operation in the Load event. I have added the standard cursor code:
Cursor cursor = this.Cursor;<br />
this.Cursor = Cursors.WaitCursor;<br />
...<br />
this.Cursor = cursor;
However, the form does not immediately display so the cursor does not change until the operation is done... and then only briefly. So, I get smart and say:
this.Show();<br />
Application.DoEvents();<br />
Cursor cursor = this.Cursor;<br />
this.Cursor = Cursors.WaitCursor;<br />
...<br />
this.Cursor = cursor;
But this does nothing to affect the problem.
--
If it starts to make sense, you're in a cult.
|
|
|
|
|
Try putting the
<br />
Cursor cursor = this.Cursor;<br />
this.Cursor = Cursors.WaitCursor;<br />
just before showing the child window.
You wont want to use a local to hold a reference to the previous cursor (like above), but could use a form level public field so it could be addressed by either child or parent.
Some ideas are so stupid that only an intellectual could have thought of them - George Orwell
|
|
|
|
|
What you are seing is the cursor getting reset to the cursor defined for the control that is currently under the cursor! This happens during DoEvents(). As yet I have not found a good way to solve the problem.
Joel
VssConnect - Remote SourceSafe(r) Access http://www.voxcode.com[^]
|
|
|
|
|
What about getting the form to display while the database operation is taking place? I can't even get the form to show up until the end of the Load event.
VB6 had a concept of Screen.MousePointer which set the cursor for the whole application. Does anything like that exist in .NET?
--
If it starts to make sense, you're in a cult.
|
|
|
|
|
|
One method that I use is to subscribe to Application.Idle then in your idle event handler, unsubscribe from the idle event and then do your long operation. This should allow your form to display before the long operation. There are probably other ways to do this also. You could also take a good look at Win Forms FAQ[^].
Joel
VssConnect - Remote SourceSafe(r) Access http://www.voxcode.com[^]
|
|
|
|
|
I am given 2 ArrayLists - arOriginal and arNow. I am supposed to populate ArrayLists arNew and arMissing. arNew is the ArrayList of items in arNow that are not in arOriginal. arMissing is the ArrayList of items in arOriginal but not in arNow. I also need to surmise that each ArrayList (arOriginal and arNow) can contain up to 2 million items. What is the fastest way to do the searching? I am almost ruling out doing a linear search using Contains().
|
|
|
|
|
copy the elements of arNow to a b-tree (not in .Net Framework Classes, will need to port something from Java word). tese for missing against the b-tree, since in a log2n search in the b-tree. If you leave them in a simple arraylist, you're pretty much stuck with a linear search...
Some ideas are so stupid that only an intellectual could have thought of them - George Orwell
|
|
|
|
|
I'd also consider using a hashtable for this. The creation cost of the hashtable is likely to be a fair bit lower than the b-tree would be, and the lookup cost will likely b less (or tunable to less if you're willing to have a low enough packing factor).
|
|
|
|
|
I have an extender that adds some common properties to all controls on my form. Everything works fine in the IDE. The problem is that I've got a property grid on my form to allow users to edit these properties, except they don't appear at run-time
You can access the properties through code so the extender is working at run-time but they do not appear in the Property Grid!
Help! Otherwise I'm gonna have to write a wrapper class for each control
|
|
|
|
|
hi friends,
i want to add an image to commandbarbutton in C#.
i have added appropriate code but im getting an error saying that "object reference not set to an instance of an object" when im trying to assign an picture to commanbarbutton.Picture property.
here is my sample code:
CommandBars objCommandBars;
CommandBar objCommandBar;
object str = "MyToolBar";
objCommandBars = (CommandBars)applicationObject.GetType().InvokeMember("CommandBars", BindingFlags.GetProperty , null, applicationObject ,null);
objCommandBars["MyToolBar"].Delete();
objCommandBars.Add(str,omissing,omissing,omissing);
objCommandBars["MyToolBar"].Position = MsoBarPosition.msoBarFloating;
cmdOpenI = (CommandBarButton)objCommandBar.Controls.Add(1,omissing,omissing,omissing,omissing);
cmdOpenI.Caption = "Test";
cmdOpenI.Tag = "Test";
String strFile = "F:\\a1.bmp";
Object lpDisp = null;
try
{
OleLoadPictureFile((Object) strFile, out lpDisp); //API relevant to LoadPicture in VB
stdole.StdPicture pic = (stdole.StdPicture)lpDisp;
if (pic != null)
{
cmdOpenI.Style = MsoButtonStyle.msoButtonIconAndCaption;
cmdOpenI.Picture = (stdole.IPictureDisp)pic;// here only im getting an error "object reference not set to an instance of an object"
}
}
catch(Exception exp)
{
System.Windows.Forms.MessageBox.Show(exp.Message);
}
cmdOpenI.Visible = true;
cmdOpenI.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(OpenIntranet_Click);
objCommandBars = null;
objCommandBar = null;
if i set the commandbutton type as 2,3 otherthan button type 1 im not getting an error. but i want the button type to be 1.
can anybody help me to achieve the task.
Thanks in advance
regards,
sns
|
|
|
|
|
Just a guess here, but since the code fails only when a picture is absolutely required (type 1 is strictly icon, whereas other two use text and thus don't require a picture to be shown), maybe the error is saying that pic's underlying image is always invalid, and that only matters when one is absolutely needed. In other words, although pic is not null, it may not contain a reference to a valid StdPicture.
Since StdPicture is a COM object, it is possible that it is non-null, yet its Handle property may be invalid. COM objects can be that way. Could you try verifying if pic.Handle is valid rather than if pic overall is non-null?
|
|
|
|
|
an error. am i correct?
if so im getting 8 digit +ve number when i read the handle.
im not able to locate still whats an error.
regards,
sns
|
|
|
|
|
Actually what i understood from handle means it will return -1 if it is an error. am i correct?
if so im getting 8 digit +ve number when i read the handle.
im not able to locate still whats an error.
regards,
sns
|
|
|
|
|
I am not so sure it would return -1 if the handle is invalid:
Console.WriteLine(pic.Handle);
It is difficult to determine what is valid here, since there is such a mixture of COM Automation and .Net, but you might try tracing back a little further. Did you try determining if lpDisp is valid before assigning it to pic? I cannot find a reference to OleLoadPictureFile(), so I am not sure if it might be any cause of trouble. The main thing is to verify that pic is a valid object, and that all its properties and methods can be called.
Another test you might try is:
cmdOpenI.Picture = (stdole.IPictureDisp)lpDisp;
That bypasses any reference to pic.
|
|
|
|
|
i tried out all posiblities, and i think the out object of OleLoadPictureFile() is not returning correct format, because when i loaded with someother bmp and tried to get the type it is giving Object refernce not set to an instance of an object... dont know the reason, the same error is not coming for a1.bmp when i tried to read the type of pic.
can u suggest me someother method to load picture or with the existing one with change of some properties...
looking for a postive reply from u.
Thanking you.
regards
sns
|
|
|
|
|
I am also trying to do something similiar, where did OleLoadPictureFile(...) come from. Did you add a referenceto the project to make it available. I can't find any documentation on that method. If you could let me know I will dig into this further.
|
|
|
|
|
im happy to hear that u r also trying to do same thing what im trying,so i'll be getting some help regarding this.
this how u have to declare an API
[DllImport("oleaut32.dll", CharSet = CharSet.Unicode, PreserveSig = true, EntryPoint = "OleLoadPictureFile")] static extern void OleLoadPictureFile(Object varObj,[ MarshalAs(UnmanagedType.IDispatch )] out Object oOut);
so when u r referring this automatically u can call the method, in query itself i have specified how to call, u can refer the same. regarding help even i was not able to locate the same, no documentation, the thing is if it is VB so many documents available, but for C# no help.
for stdole u have to add a reference to stdole. try this. in case any pbm reply to me.
Thanks.
regards,
sns
|
|
|
|
|
I think I found what you are looking for. This was posted at devcity.com under CommandBarButton Picture thread. I don't want to take credit for the solution. Here is what was posted. I was attempting to change the icon displayed on a tool window using the ToolWindow.SetTabPicture(), which needed a IPicture object. Make sure your bitmap is the correct size. I was getting a parameter incorrect exception until I corrected the size of my bitmap. Hope this helps.
_commandBarButton.Style = MsoButtonStyle.msoButtonIconAndCaption;
//put an icon ont he button
Image _icon = System.Drawing.Image.FromFile("c:\\cloud.ico");
_commandBarButton.Picture = WService.ImageConverter.ImageToIpicture(_icon);
using System;
namespace WService
{
///
/// Summary description for ImageConverter.
///
public class ImageConverter : System.Windows.Forms.AxHost
{
public ImageConverter():base("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
{
}
public static stdole.IPictureDisp ImageToIpicture(System.Drawing.Image image)
{
return (stdole.IPictureDisp)ImageConverter.GetIPictureDispFromPicture(image);
}
public static System.Drawing.Image IPictureToImage(stdole.StdPicture picture)
{
return ImageConverter.GetPictureFromIPicture(picture);
}
}
}
|
|
|
|
|
Hi,
Thanx for the help given. i implemented the same method earlier, but im getting the same error. still im not getting the reason for that error, bcoz both methods OleloadPictureFile as well as GetIPictureDispFromPicture gives the proper image, the only thing is im not able to assign this to a commandbarbutton. im using shared addins through which im communicating to Microsoft Office 2000, in that im adding an customized commandbarbutton. I have referred Microsoft Office 9.0 object Library and stdole for picture.
To the commandbarbutton im able to add events, text and other so many properties except Picture and Mask...
Can u tell the reason why this error is coming, is any reference missing?.
regards,
sns
|
|
|
|
|
I will attempt to look at this again. The example code you initialy listed includes 'omissing' as the parameter to various methods. Where is this defined?
|
|
|
|
|
i have a fairly broad question here. What im intrested in doing is adding a extension to the standard windows context menu (i.e when you click on the bar desktop). i want to add exstentions too my encryption/decryption program. how can i do this ? if its easy... please reply with a good Code exsample.. if its a apsolute pain could you point me in the right direction to teach myself? (or both). thanks alot
Jesse M.
|
|
|
|
|
You will have to learn COM first to achieve this.
To do this from .net you need to know about COM interop from .net
Have you a look at the following article
http://www.codeproject.com/shell/shellextguide1.asp[^]
There is a sample that comes along with framework sdk, search for Shellcmd in the samples folder, this tells you how to add a menu item to explorer's context menu.
Cheers
Kannan
|
|
|
|
|
I am designing and coding a C# application. It is intended to be a visual display of the navigations between the various files we have. Example:
A page file defines a page to display.
It contains a collection of events to be managed.
The eventmanager file tells me who handles each event.
The event file tells me when the event is handled, the next page to display and the rules to execute to determine if it's valid.
So each event represents a branch in my nav model.
I thought of doing this display like Frontpage navigation or Visio. I thought of doing a custom button with a simple square as its' graphics. Each page name would populate the button.text property and I would programmatically draw a line between each control. I was also going to do this as a fat client app.
What I want (the hard part) is since these navigations can be very shallow or they can be very wide that as I populate the form with these controls that it pops up the scroll bars as needed so that the client can scroll to the parts of the navigation model that they want to view. I should mention I was hoping to do this without having to move the entire model down as I hit the 'upper edge' of the form with a wide navigation, but doing a global move is fine if I have to.
For our first version we are only displaying the navigation model given a starting page. So there you have it. Has anyone built something like this? Am I going to be feeling lots of pain for the next month coding this? Any time bombs waiting to derail me as I execute it? Any advanced assistance would be greatly appreciated.
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|