|
This normally means that you need to add a reference to the DLL to your project. Choose Add Reference... in Solution Explorer to add the relevant DLL to your app.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
does anyone know if xmlnode.Attributes is case sensitive
eg is xmlNode.Attributes["Type"].Value the same as xmlNode.Attributes["TYPE"].Value
Thank you
|
|
|
|
|
Dude, three hours ago you replied to someone in another CP forum by telling them to get an XML primer, and now you ask this question? It seems you should follow your own advice, yes?
|
|
|
|
|
Is it possible to build an assembly that uses PInvoke to use functions from a Win32 DLL and then expose this assembly via COM to a VB 6 application?
I built a .NET assembly and successfully exposed methods via COM to VB 6. However, when I tried to expose a Platform Invoked method, it fails stating that the method doesn't exist.
I'm thinking this whole "public extern static methodName()" business is the root of all evil.
Thanks!
---Dan---
|
|
|
|
|
It should be possible, although from your post it is not possible to understand the value or benefit of doing it.
danvdw03 wrote: I'm thinking this whole "public extern static methodName()" business is the root of all evil.
That's the way I view it. What I mean is that there are other solutions that I would exhaust before settling on PInvoke.
|
|
|
|
|
Dear Developers
I need to provide an environment that users can build a formula usuin field names of a database
table and some string functions like "substr","left", and "right".The environment saves formula
in a string variable,and when user clicks a button,my code must run that formula over values of
those fields for selected record of that table.
Now,I have that environment and it returns formula as a sring to me,but I don't still have any
idea how to run this string.Do I have to write some code to compile it?I found that .Net has
some namespaces for building dynamic methods,I mean Document object model,but if I want to use
classes of this namesapce I have to convert that formula to IL,which is more difficult for me.
Is there any other idea how I can run a user defined expression inside my code and show up its
result to user?That expression can be like this,if we suppose all table field names start with
"fld":
"fldDKCode+fldDKSerial+Substr(fldDKDate,3,2)+fldDKId+Left(fldDKUserName)"
and I have a database table named TBDKUsers,includes all fields mentioned above.When user clicks
on Run button,my program must show the result of this expression for selected record of TBDKUsers.
Thnakk you very much
Reza
|
|
|
|
|
Original here[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
Is anyone running VS2008 with IE8RC2? I am having an issue where 'active content' is being blocked in the designer. I can view forms without any problem, but I run into this when viewing the designer for a service installer. I've only been able to find one other mention of this problem but unfortunately the forum post was unanswered. Anyone have any ideas?
-Jim
|
|
|
|
|
I haven't figured out the cause of the problem yet but I was able to get around it. I noticed the .resx for the installer was not found. I happened to have recently removed the existing one to let it re-create it. I restored the resx and it now loads in the designer.
-Jim
|
|
|
|
|
Hi all,
I have two .NET assembly(one library and one WinForm exe) , which i am going to release to the external world. I do not want the public methods of my library to be consumed by anybody other than my exe. Is there an elegant way of doing that?
Regards,
James
|
|
|
|
|
You could always apply a licence to the dll and only allow access to methods if the consumer honoured the licence.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
You could make all the classes internal and declare your exe as a friend.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
How protective do you want to be? You could have the assembly require that certain information be supplied by the calling application before it would work. If the code simply uses a "have things been validated" check, it might not be too hard to bypass, but if some magic constants play a key role in the operation of your assembly you could store them encrypted and use some type of cryptographic handshake with your main application. Unless the assembly and application are both adequately secured against reverse-engineering it will be possible for someone with access to both to reverse-engineer what's going on, but it would be considerably trickier than bypassing a simple validation check.
|
|
|
|
|
hi
value returned from the API GetSystemMetrics(SM_NETWORK) is always 3 for me.
Wat does it mean
i have seen fromthe msdn that the SM_NETWORK is used to identify whether the system has network connection or not. Least significant bit is set if the system has network coonection or else it will clear that bit.
but i am gettign value as 3.. What is the reason for it ?
thanks
|
|
|
|
|
The only bit that's documented is the least significant. Other bits in the return value may or may not be set, but there is no documentation on what they mean.
|
|
|
|
|
Hey guys, what's up?
I have this web service I wrote which works perfectly fine when run on Windows Server 2003 with SP1. However, when I run the same thing on Windows Server 2003 with SP2, I get "Method not Allowed" 405 http error.
Anyone knows what might cause this?
Thanks,
Lior
|
|
|
|
|
|
At this point most of us should also receive like a Google MVP award. I mean besides harassing these dim wits it's about the only other thing I do around here any more.
|
|
|
|
|
I am writing a Visual Studio 2008 Tool Window plugin that exposes a custom toolbox. I create controls on Forms using the 'ToolboxItem' class. I would like to append to the ToolboxItem dependencies, such that my assembly will be auto-inserted as a reference after the control creation. Here's an example of what I'm trying to do:
ToolboxItem tbi = new ToolboxItem(typeof(CheckBox));
AssemblyName[] depends = tbi.DependentAssemblies;
List<assemblyname> listDepends = new List<assemblyname>();
listDepends.AddRange(depends);
listDepends.Add(new AssemblyName("MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e7d025b3483b4afc"));
tbi.DependentAssemblies = listDepends.ToArray();
The control gets created fine, but 'MyAssembly' is not added to the project references. 'MyAssembly' is installed in the GAC - I've double checked that the full path is correct.
Thanks,
Aaron
|
|
|
|
|
AFAIK, this isn't possible. Imagine what would happen if a malicious application injected itself as a dependency into the Form class. Load Form class = load malicious application into memory = bad in one way or another
The best thing you could do would be making a derived class, and add your assembly as a reference
|
|
|
|
|
I found this one the hard way, http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=295677[^]. After writing and testing a bunch of code that relied on reading from persisted DataTables one of our test databases had columns with single spaces. While this post discusses .NET 3.0 I am seeing the behavior in .NET 2.0. I have not tested to see if it is fixed in any later versions.
However, if I read the same file, which is still persisted with a DataTable object (DataTable.WriteXml()), into a DataSet object instead and use the first DataTable in the DataTableCollection the whitespace is [appears to be, for me anyway] preserved properly in the DataTable
DataSet someData = new DataSet();
someData.ReadXml("somepersistedDataTable.xml");
DoSomethingToDataTable(someData.Tables[0]);
void DoSomethingToDataTable(DataTable dt)
{
}
Not sure if this is the correct place, or a repost for that matter, but wanted to share just in case someone else was having similar issues.
|
|
|
|
|
Hi all,
i am retrieving total physical memory using GlobalMemoryStatus() as follows :
public struct MemoryStatus
{
public uint Length; //Length of struct
public uint MemoryLoad; //Value from 0-100 represents memory usage
public uint TotalPhysical;
public uint AvailablePhysical;
public uint TotalPageFile;
public uint AvailablePageFile;
public uint TotalVirtual;
public uint AvailableVirtual;
}
MemoryStatus stat;
[DllImport("kernel32.dll")]
public static extern void GlobalMemoryStatus(out MemoryStatus stat);
GlobalMemoryStatus(out stat);
uint totPhy = stat.TotalPhysical;
My question is
1) Is the stat.TotalPhysical return the actual physical memory installed int he machine ?
2) I am getting neagtive value like -271691776 for the vista mahcine(Os type : 6.0.6001) and Windows Server 2000 .
Can someone please help me out.Thanks in advance
|
|
|
|
|
Hi,
I suggest you switch to GlobalMemoryStatusEx() and MemoryStatusEx (with "long" members)
since IIRC the old ones don't cope with memory sizes beyond 2GB.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
On top of what Luc said, you say you got negative numbers?? How?? Since unsigned integers can't return negative numbers, you had to use some calculation that introduced them. This says that your methodolgy is wrong.
|
|
|
|
|
GlobalMemoryStatus(out stat);
usrSysInfo.totalPhysicalMemory =(UInt32)IPAddress.NetworkToHostOrder((int)stat.TotalPhysical);
tempArray = BitConverter.GetBytes(usrSysInfo.totalPhysicalMemory);
SysInfoMemStream.Seek(offset, SeekOrigin.Begin);
SysInfoMemStream.Write(tempArray, 0, sizeof(UInt32));
offset += sizeof(UInt32);
I am converting the data to NetworktoHostOrder and convert to byte and trasfer it to the server. Server will do reverse process and get the actual data..
I dont know how the RAM value is in negative.
Similary i want to know whether the GLobalMemoryStatusEx method returns the actuall RAM isntalled in the machine or the RAM available to the users.
|
|
|
|