|
Are any exceptions being thrown?
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Hi,
Any suggestion on handling WM_NOTIFY, LVN_ODCACHEHINT and LVN_ODFINDITEM events from C# app?
-Kasturi
|
|
|
|
|
I am just learning C# and I was wonder if there is a way to make an instance of a class that is globally availible. Anyhelp would be appreciated. Thanks.
Steve
|
|
|
|
|
Can you describe what you mean by "globally available"?
When you say that I'm thinking something to do with the GAC (Global Assembly Cache), but then you refer to an instance of a class.
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Hello,
I have this private assembly, and I want to ensure that it can be used only
in my application. I have signed the assembly using strong name key pair
that I generated.
But when I am calling it dynamically (i.e. Assembly.Load) how can I ensure
security, i.e. check for the public key, so that only my application will be
able to use it coz only my application knows my public key?
Any ideas?
- Tariq
|
|
|
|
|
Role based security uses the OS's security DB to authenicate users (i.e. all the users of a particular application will have an account in the server, right?) If so, how many users can it hold?
|
|
|
|
|
How do I listen to events happening in any particular folder? (e.g. if a new file has been added to the folder or a file is deleted from the folder.)
|
|
|
|
|
System.IO.FileSystemWatcher
There is a cavet though:
(from the docs)
"FileSystemWatcher only works on Windows 2000 and Windows NT 4.0.
Remote computers must have one of these platforms installed for the
component to function properly. However, you cannot watch a remote Windows
NT 4.0 computer from a Windows NT 4.0 computer."
I'm not familiar with the respective Win32 APIs, but if this cavet doesn't exist there you could write some managed C++ to use the APIs directly, allowing you to target Win98/ME.
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Hi,
Im assuming an ArrayList is similar to Java's Vector class, however im having trouble accessing individual elements in the ArrayList and I cant see any methods there to get elements.
someone ?
|
|
|
|
|
You access it just like an array
ArrayList al = new ArrayList();
MyDataType elementZero = (MyDataType) al[0];
MyDataType elementOne = (MyDataType) al[1];
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Hi,
I have managed to get my program to load types successfully, but when it comes to try and invoke a method that they support i get a compile error.
Exception of type System.InvalidCastException was thrown.
The type array has been filled using this short code.
if(null != type.GetInterface(typeof(IPlugable).FullName)) {
Console.WriteLine("Loaded");
loadedTypes[idx++] = type;
}
This is the code which doesnt work. Anyone have a dime of an idea ?
public void LoadTypes(Type[] types) {
IPlugable yer = (IPlugable)Activator.CreateInstance(plugins[x]);
yer.AFuntion();
}
|
|
|
|
|
odd, from what i see there that code should work fine. Make sure that you don't have two different IPlugable's defined. If you do its probably a namespace issue thats causing the problem.
I assume that plugins[x] is the array thats filled in the first block of code?
Perhaps if you posted more code something will pop out.
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
I’m using List-view controls with the LVS_OWNERDATA style and I’m trying to handle notification messages LVN_ODCACHEHINT and LVN_ODFINDITEM.
Any help on this would be great.
|
|
|
|
|
I was considering trying to write something simple to interface with my scanner. Could someone point me in the direction of some .NET info dealing with this?
I know of the Still Image API, but is there something in .NET for it?
|
|
|
|
|
AFAIK there is no built in support for scanning. You might be able to interface with TWAIN through .NET interop, but its sure to be messy.
I heard that Lead tools was releasing an imaging product for .NET. That might have what you need.
--
Peter Stephens
|
|
|
|
|
I need to read a .ini file under windows directory.
But the name of the directory may be different on different machines.
In some machine it is winnt while on ohters it is windows.
So, how to get the name of the directory.
I used GetPrivateProfileString with VC++. and I tried the whole
afternoon to get it worked under C# but it just cannot return the string.
the declaration of GetPrivateProfileString in VC++ is:
DWORD GetPrivateProfileString(
LPCTSTR lpAppName, // section name
LPCTSTR lpKeyName, // key name
LPCTSTR lpDefault, // default string
LPTSTR lpReturnedString, // destination buffer
DWORD nSize, // size of destination buffer
LPCTSTR lpFileName // initialization file name
);
And I converted it to
static extern int GetPrivateProfileString(
string appName, string keyName, sttring default, ref string strReturn,
int size, string fileName);
But I got System.NullReferenceException.
How to solve these two problems or any one of them?
|
|
|
|
|
I don't know a lot about C#, but I do know there is a Windows API to get this directory:
UINT GetWindowsDirectory(LPTSTR lpBuffer, UINT uSize);
Look it up in MSDN for details.
The early bird may get the worm, but the second mouse gets the cheese.
|
|
|
|
|
If I declare it as
static extern int GetWindowsDirectory(ref string strDir, int size);
and call it as
string strDir = "";
GetWindowsDirectory(ref strDir, 20);
I still got the NullReferenceException.
The point is how to get the value back from the function.
|
|
|
|
|
You need to use the StringBuilder class instead of string.
StringBuilder strDir = new StringBuilder(20);
GetWindowsDirectory(ref strDir, 20);
James
Sonork ID: 100.11138 - Hasaki
"Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. " - Michael P Butler Jan. 18, 2002
|
|
|
|
|
Hai,
I wrote a windows service application using c#. I am able to install it using InstallUtil.exe provided by .NET framework. But I want to install the same service on a different machine which does not have .NET framework.
I think, InstallUtil.exe comes only when you install .NET (correct me if I am wrong). But I dont want to install .NET framework just for this utility.
Does c# provide any class which can be used to install a service? I read about ServiceProcess.ServiceController. But this only helps me to monitor the installed services.
Any suggestions...
omkamal
|
|
|
|
|
Oops Sorry folks.
I read that you need .net framework to atleast run a .NET application ( no matter its a service or whatever ). So there is no way but to rely on InstallUtil.exe.
Thanks anyways
omkamal
|
|
|
|
|
Hai,
Can anyone tell me how to get the name of the computer (in which the code is running) using c#?
thanks.
|
|
|
|
|
Thought this one should do
String s = System.Diagnostics.Process.GetCurrentProcess().MachineName;
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
Its giving me only a '.', its not giving me the name of the machine. any other suggestions????
omkamal
|
|
|
|
|
Ok. This is what I found out. I dont think there is a direct GetComputerName function in c# (as far as I know). Instead I read the following registry key
HKLM\System\CurrentControlSet\Control\ComputerName\ComputerName.
I hope this key is created in all machine because the System subkey stores sys related info.
If anyone wants to know the computer name, this is next to a good solution. Use, Microsoft.Win32 namespace for Registry related classes in c#.
One more thing "Naivete" and "omkamal" are one and the same. I just changed my username.
Thanks for your help.
omkamal
|
|
|
|