|
can i execute "vsvars.bat" first?
vsvars.bat is tha batch file that registers the .net environment variables .
so could i somehow execute that batch in the context of my program so my program can retrive the paths from the environment variables then?
i actually peeked inside a quite wellknown obfuscator (and they use ilasm and ildasm)
and they retrive the path to both of them via the environmentvariable "path" , but that variable dont contain the .net paths unless vsvars.bat have been executed.
(they also display a mysterious dos window before their app starts , and i beleve they actually executes vsvars.bat in there somehow)..
so any ideas how i could start that bat file so that the vars are visible to my app?
//Roger
|
|
|
|
|
Well, there are a couple problems with that. That batch file is only included with the .NET Framework SDK. End-users will only have the .NET Framework Runtime. So they won't have ILDASM or VSVars32.bat.
And, you can run VSVars32.bat, but why not just hardcode the path? I don't think it's gonna change until you upgrade to another .NET Framework version.
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
Microsoft has reinvented the wheel, this time they made it round.
-Peterchen on VS.NET
|
|
|
|
|
Hi.
How can I colour some rows of a DataGrid?
I have to colour some row where one boolean or more value of the database is
true or false.
Demetrio
|
|
|
|
|
I detect the internet connection with the following method
//*************************************
try
{
server = DNS.GetHostByName("www.yahoo.com");
}
catch(Exception)
{
Console.WriteLine("Internet Connection not found"); // fail
return ;
}
//***********************************************
But it takes times to find if internet connection is up. I need a faster method.
Is there any?
karanba
|
|
|
|
|
Try using the Win32 InternetGetConnectedState() function.
-John
|
|
|
|
|
Can you give me a short code example how to use this function in C#. Is there any resource to add with the project...
thanks.
karanba
|
|
|
|
|
[System.Runtime.InteropServices.DllImport("wininet.dll")]
public static extern bool InternetGetConnectedState(IntPtr lpSFlags, int dwReserved);
if (!InternetGetConnectedState(new IntPtr(0), 0))
{
// not connected
}
|
|
|
|
|
Try and use the following code. Other than the using System.Runtime.InteropServices, I have not added an additional resources to the project. I hope this helps you.
-John
<code>
using System;
using System.Runtime.InteropServices;
namespace CSProject
{
class ConsoleApp
{
[STAThread]
[DllImport("wininet.dll")]
public static extern bool InternetGetConnectedState(double dFlags);
static void Main(string[] args)
{
double dFlags = 0;
bool bResult = InternetGetConnectedState(dFlags);
Console.WriteLine("Internet Connection: {0}", bResult.ToString());
}
}
}
</code>
|
|
|
|
|
Thanx All a get what I need
karanba
|
|
|
|
|
How can I detect the ISP(internet service provider) with my program.
thanx
karanba
|
|
|
|
|
The internet doesn't really work like this.
Try running pathping www.google.com at your command prompt. You could try running a trace like this from within .NET and look at the second or third hop but it wouldn't be very reliable.
To capture the ouptut of pathping off the command line see my other post at http://www.codeproject.com/script/comments/forums.asp?msg=375367&forumid=1646#xx375367xx[^]
Tatham Oddie (VB.NET/C#/ASP.NET/VB6/ASP/JavaScript)
tatham@e-oddie.com
+61 414 275 989
|
|
|
|
|
thanx.
And I also what to detect current bandwidth. What could I do?
karanba
|
|
|
|
|
|
No. Bad. You can't ping someone else's website as part of your application or service unless you have an agreement with them. There is such a thing as a ping attack. ibm.com no longer responds to ping, for example, because people were using it in this way. If google decides to do the same, his app won't work anymore. Your solution is good if his app is noncommercial or not used by many people.
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
how to copy one file from one path to another path (and over wight it ).
r00d0034@yahoo.com
|
|
|
|
|
You need to use the CopyTo() method of the FileInfo Class.
foreach (FileInfo file in filesInDirInfo)
{
file.CopyTo(newDirName);
}
david23g
|
|
|
|
|
I use a DataSet load a DBtable,and I want to know how many memory were used by the DataSet object.
sizeof keyword and System.Runtime.InteropServices.Marshel.SizeOf method can only be used for unmanaged objects.
how can I get a reference type object memory size???
lost my way
|
|
|
|
|
fftongzhi wrote:
how can I get a reference type object memory size???
You can do something like this:
DataSet ds = new DataSet();
IntPtr p = Marshal.StringToHGlobalAnsi(ds.ToString());
MessageBox.Show("Size: " + Marshal.SizeOf(p));
Marshal.FreeHGlobal(p);
[EDIT] On second thought, that is only giving you the size of a string . I will have to look into this.[/EDIT]
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
convert a object to string and get the string size,I have also felt that is a way.But some object contents can not conver to string ,you can just try this
byte[] bytelist=new byte[10]{1,2,3,4,5,6,7,8,9,10};
bytelist.tostring()=="byte[]" not the realy things we want. "12345678910"
so tostring can not get the size of a ref object :$
my method is write the object in to a memory stream and get the stream.length.
I feel some silly about this way,but where is the right way??
you can not get a object memory size in .net??? It means I made a world but I don't know what is it like!!! my god!!!!!!!!!!!
lost my way
|
|
|
|
|
You could also try to serialize the object into a MemoryStream and get its size, but this has some drawbacks:
1. It's awful slow.
2. It will return a much bigger size than the real one, because it will include type info needed for the deserialization process.
3. It will only work on types marked [Serializable]
I see dumb people
|
|
|
|
|
Is that all the VM language have the same problem?
It also can not get a ref object size in java.
My god,we are in a unknowable world.
lost my way
|
|
|
|
|
|
Is that to say we need not to know the memory requirements of our application??? If we are faced with a memory useing limited project,what can we do ?
lost my way
|
|
|
|
|
|
What other solution would there be? An object could contain a reference to a reference to a ...
You have to at some point serialize it out to memory to get the complete size it takes up.
|
|
|
|