|
for now i just wanted only 4 one pc...........it would also b better if u told me on a different machine....tnx dude
|
|
|
|
|
eye nodding understanded
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
I have a requirement to connect a network drive, once it gets disconnected.
I am using WNetAddConnection2A() API of mpr.dll. It works fine for a console/windows application.
When I tried to use the same code in windows service, it’s unable to connect the drive.
WNetAddConnection2A() returns an int value. A non zero value is a failure and zero is a success.
In windows service it returns zero, still drive does not get mapped/connected.
int result = WNetAddConnection2A(n, password, username, dwFlags);
In ServiceProcessInstaller we have 4 types of Account. I tried with all of them and got the below return value from WNetAddConnection2A().
1- LocalService : 1312
2- NetworkService : 0 (Success, Still drive is not mapped).
3- LocalSystem : 1312
4- User : 0 (Success, Still drive is not mapped).
Error 1312: A specified logon session does not exist. It may already have been terminated.
Any help in this regard is appreciated. Also would like to know what kind of Account should I use.
Praveen Raghuvanshi
Software Engineer,
India.
|
|
|
|
|
What login account is your service running under?? If it's the LocalSystem account, mapping a drive won't work since LocalSystem doesn't have permissions to any network resources. Your code has to supply a username and password to map the drive as someone else to map a drive. Even then, there may be a problem with the resource already being used by that account, in which case, the map will fail.
Without knowing what account the service is running under and what the code looks like that maps the drive, along with any values it's passing to the function, it's pretty difficult to say what's going wrong.
|
|
|
|
|
Hello,
i want to create an mobile application that send command or signal via bluetooth in order to open/close a door.
This applicatin should run for all kind of device and special for nokia market.
Any ideas how to start ??
best regards.
dghdfghdfghdfghdgh
|
|
|
|
|
Google is your friend.
There are loads and loads of hits for bluetooth c#.
I was not aware that there were bluetooth enabled doors, do they do windows too?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
when i achieve my device may i will buy u the bad version, but tc, it should be so expensive.
dghdfghdfghdfghdgh
|
|
|
|
|
ellllllllie wrote: signal via bluetooth in order to open/close a door
Bluetooth enabled doors!
Nokia phones are Symbian OS based phones and AFAIK there is no in-built support for that in .Net. You will need to look into the redFIVELabs[^] product which enables you to run .Net applications on Symbian.
जय हिंद
|
|
|
|
|
I want the PDF file's data when it a PDF is opened in IE.
How can I do this using c#.
The COM reference AcroIEHelper.dll is added in my project.
ACROIEHELPERLib.AcroIEHlprObjClass acroIEHlpr = new ACROIEHELPERLib.AcroIEHlprObjClass();
acroIEHlpr is an Object element. From this how can I retrieve the information of PDF opened in IE.
How can I get the text of that PDF file?
|
|
|
|
|
Hi
i have a class called testparams:
[Serializable()]
public class TestParams {
public TestParams() {
}
private string m_filename;
[EditorAttribute(typeof(FileNameEditor), typeof(UITypeEditor))]
public string FileName {
get { return m_filename; }
set { m_filename = value; }
}
}
i use propertygrid and select the object :
TestParams TP = new TestParams();
propertygrid.SelectedObject = TP;
serialization :
private void Save(TestParams obj) {
XmlSerializer xs = new XmlSerializer(typeof(TestParams));
using (FileStream fs = new FileStream(Directory.GetCurrentDirectory() + "\\testparams.xml", FileMode.OpenOrCreate)) {
xs.Serialize(fs, obj);
}
}
}
The problem:
if the user selects the file with the "..." button and i try to serialize TP to xml nothing get written in the file !
when user writes his text freely the xml file is written correctly .
any help will be appreciated
shay
modified on Sunday, June 14, 2009 6:28 AM
|
|
|
|
|
Your use of GetCurrentDirectory is ill-advised. Since the CurrentDirectory can change at any time, without you knowing it, I recommend against using it unless you have a deep understanding of how the current directory is maintained from a system and application points of view.
Member 4086596 wrote: if the user selects the file with the "..." button
Of what control?? Are you showing a SaveFile dialog or what?? Use whatever full path this dialog returns, not CurrentDirectory.
|
|
|
|
|
it seems to me that BitVector32 only supports signed integer
and does not support un-signed integer, what is the reason?
thanks
|
|
|
|
|
Seraph_summer wrote: it seems to me that BitVector32 only supports signed integer
and does not support un-signed integer, what is the reason?
Why does it matter?
If it only supports signed ints (and I'm not sure that it is true, just can't be bothered to test it), it only supports signed ints. Use it if you can use signed ints, don't use it if you can't.
At the end of the day it is a struct, write your own to use signed ints, if you need one.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Becuase the signed integer is CLR compliant, and the unsigned integer is not.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Well I jast have this to classes, I'll write it:
public delegate List< T > LoadChildHandler< T >(int parentId);
public class ObjectBase< T >
{
public int ID { get; set; }
public LoadChildHandler< object > LoadChild;
}
public class Country : ObjectBase< Country >
{
public string CountryName { get; set; }
public List< City > Cities
{
get
{
return (City)LoadChild(ID); <--- Error
}
}
}
Error: Cannot convert type 'System.Collections.Generic.List<object>' to 'G1_OnlineStoreObjects.City'
How can i solve this problem?? advise plz...
C# Developer
|
|
|
|
|
You're trying to cast the objects inside the List, but you're actually casting the List itself. If you're using version 3.5 of the .Net Framework, then you can simply use return LoadChild(ID).Cast<City>();
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
WELL i have done LoadChild(ID).Cast< City >();
but Error occurs aggain: Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<g1_onlinestoreobjects.city>' to 'System.Collections.Generic.List< G1_OnlineStoreObjects.City >'. An explicit conversion exists (are you missing a cast?)
C# Developer
|
|
|
|
|
This is because the extension method Cast() returns an IEnumerable<t>. Just cast it to the property's type and you're done
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
I did not understand
right that: (City)LoadChild(ID).Cast< City >();
but occuers Error again
C# Developer
|
|
|
|
|
LoadChild(ID).Cast<City>() as List<City>;
Besides that, you seem to have a small amount of confusion with List casting. When you cast a List to a City, you do not cast the elements in the List, only the List itself. In order to cast the elements inside the List, you need to use the Cast() method. This method returns an IEnumerable; because List implements IEnumerable, you can cast the List. This does not cast the elements, just the containing class
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
well it's works but there is some another problem like this:
Here is class where I invoked function into delegate
public class CountryDAO : BaseDAO< Country >
{
public override Country Load(int id) //I try to do lazyloading
{
Country country = base.Load(id); //just loads from database to Country class objects
if (country != null)
{
country.LoadChild = LoadCity;// here I invoked it and here occurs error
}
return country;
}
private List< City > LoadCity(int parentId)
{
CityDAO cDao = new CityDAO();
return cDao.LoadList("CountryID=" + parentId.ToString());
}
}
Error: 'System.Collections.Generic.List< G1_OnlineStoreObjects.City > G1_OnlineStoreDAO.CountryDAO.LoadCity(int)' has the wrong return type
what's the matter, why cann't compile it?
I repeat it what you said me to cast bu it is not works again
C# Developer
|
|
|
|
|
This is because you have the wrong return type. The delegate is of type List<Country> LoadChild(int id) , but the delegate you try to convert it to is of type List<City> LoadChild(int id) . That's the main problem, but it seems more architectural than syntactic. Either your delegate type is wrong, City does not inherit from Country, or City and Country don't implement a common interface. Personally, I wouldn't use a generic delegate at all; I'd go for something like this:
public delegate List<City> LoadCitiesDelegate(int countryId);
public class CountryDAO : BaseDAO<Country>
{
public override Country Load(int id)
{
Country country = base.Load(id);
if(country != null)
country.LoadChild = loadCity;
return country;
}
private List<City> LoadCities(int countryId)
{
CityDAO cDao = new CityDAO();
return cDao.LoadList("CountryID=" + countryId.ToString());
}
}
This probably wouldn't compile, but it's a general idea of the way I would personally do it
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Maybe it'll work, but in my project I have many classes and Functions with generics and it's almost impossible to change all
I think I solve this like this, I write it:
public delegate List< T > LoadChildHandler< T >(int parentId);
public class ObjectBase< T >
{
public int ID { get; set; }
}
public class Country : ObjectBase< Country >
{
public LoadChildHandler< City > LoadChild; // I just declare delegate in child class and there are not resist between City and Country, well works fine
public string CountryName { get; set; }
public List< City > Cities
{
get
{
return LoadChild(ID);
}
}
}
and so all I want it to do in a different way...
Now I must dclare this delegate in other classes too, it would be fine to do solve this problem, without declaring in other classes and not such torture
C# Developer
|
|
|
|
|
Hi
I have a Windows form called mainwindow in my project. After it completes what it does, it closes and then recreates itself. But as I have noticed lately it recreates but doesnt't close itself.
Here is my code:
private void RestartAll()
{
depo.multipleformlocation=this.Location;
depo.multipleform = true;
depo.ekrangoruntusuadedi = 0;
this.Hide();
mainwindow _mainwindow = new mainwindow();
_mainwindow.ShowDialog();
this.Close();
Thread.Sleep(Timeout.Infinite);
}
How can I close(destroy) the old form completely and recreate that form? When I don't completely close that old form, because I do this closing and recreating process more than once my App's memory usage gets much higher.
Thanks in advance.
|
|
|
|
|
I am having a little difficulty in understanding where the cause of your problem might lie.
Just to clarify things, what class contains the RestartAll method in the code you posted?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|