|
dll is in the same directory but C# code dont work in this way
|
|
|
|
|
Um, yes it does. The CLR looks for native libraries in the same way that all other applications (unless hard-coded with a path) do. The CLR looks for managed assemblies in a different way, but the application path is still checked for assemblies. Trust me. I've been doing this since 1.0 beta days and, unlike most people these days, I do actually read everything I can about what I do.
You still have never mentioned what is happening all this time. Is an exception being thrown? Is it even compiling? Are you just not getting a return value back?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
No exeptions
Just not getting a return value back
|
|
|
|
|
I just noticed, the strings are BSTR s. In this case, they are unicode and must be handled as such. The following should work:
[DllImport("endecode.dll", CharSet=CharSet.Unicode /* Optional in this case */,
CallingConvention=CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.BStr)]
static extern string decode([MarshalAs(UnmanagedType.BStr)]string data); BSTR is #defined as wchar_t , which is a wide character. This will never by ANSI on any platform. Before you posted something that implied the string was ANSI.
Also, make sure your C function declaration uses the C style declaration, otherwise it will be decorated. Since VB can all it, it's probably already correct. You can make sure by using the Dependency Walker (depends.exe), which is part of the Platform SDK and - if you choose the default options when installing VS.NET - should be in the <VS.NET Install Dir>\Vc7\PlatformSDK\bin directory. Open your unmanaged library and you should see the exported function. There should be no decoration (i.e., ordinals, etc.) on the function. If there is, you can forward-declare it like so:
#ifdef __cplusplus
extern "C" {
#endif
BSTR __stdcall decode(BSTR data);
#ifdef __cplusplus
}
#endif You can use a .DEP file, too, but that's "out-dated".
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How do I change the location of a control in C# within the code; could someone tell me what I'm doing wrong? Here's what I have:
pboP1.Location.X = 16;
pboP1.Location.Y = 96;
|
|
|
|
|
Location is a value type so your code won't work because the location you are changing isn't the location used by pboP1. (Actually, I have a feeling that the X and Y properties don't have setters either so this code should probably generate a compiler error)
What you need to do is:
pboP1.Location = new Point(16, 96)
EuroCPian Spring 2004 Get Together[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"Get in touch with your Inner Capitalist - I wish you much success!" -- Christopher Duncan, Lounge 9-Feb-2004
|
|
|
|
|
You can use Left and Top properties of
the control class to move the controls.
Thank You
Bo Hunter
|
|
|
|
|
Has anyone solved the (as far as I can tell) problem where moving the scroll bar with the mouse does not fire the VScroll event in a RichTextBox?
Appreciate any feedback...
|
|
|
|
|
Hey
I have a winservice as a .NET remote server. Now I also wants webservices, but I'm not sure to place the remote server under IIS. Is it possible to "talk" between a webservice application and a windows service on the same machine?
|
|
|
|
|
Anonymous wrote:
Is it possible to "talk" between a webservice application and a windows service on the same machine?
Yes, but webservice should be placed on the IIS of that machine.
Mazy
You're face to face,
With the man who sold the world - David Bowie
|
|
|
|
|
|
How what? You don't know how to call a webservice method from windows service? What exactly you want to do?
Mazy
You're face to face,
With the man who sold the world - David Bowie
|
|
|
|
|
Just the other way around ;o) I want to call my win service( .NET remote server) from a webservice. is it possible?
|
|
|
|
|
I need a hint about how to recieve packets (any type IP ,Tcp ,UDP) using C#
thanx alot
|
|
|
|
|
C# Network Programming[^] by Rich Blum is a really good source of information on Socket Programming in C#
EuroCPian Spring 2004 Get Together[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"Get in touch with your Inner Capitalist - I wish you much success!" -- Christopher Duncan, Lounge 9-Feb-2004
|
|
|
|
|
Hi all,
I've played around with the Shellnotifications...
(http://www.codeproject.com/csharp/shellnotifications.asp?target=Shellnotifications)
I want to read out the InternetExplorer History Notifications.
I've changed the Register Event to CSIDL_HISTORY but it didn't work correctly.
If I click on an IE link, nothing happens.
I have seen it working in a vb project.
(http://vbnet.mvps.org/index.html?code/shell/shchangenotify.htm)
Somebody got a solution?
|
|
|
|
|
I have an ArrayList of objects (all the same type). All of these objects (classes) contain a string property Name. I also have a variable CurrentMyObject that shows witch MyObject to use currently (there are a lot of MyObject instances, try to think of MyObject as of an adapter).
<br />
<br />
private MyObject CurrentMyObject;<br />
private ArrayList MyObjectsList = new ArrayList();<br />
public class MyObject<br />
{<br />
protected string name;<br />
public string Name {...}<br />
}<br />
<br />
...<br />
string something = CurrentMyObject.Name;<br />
...<br />
Is it possible to let the user set the CurrentMyObject from a dropdown meny in Property Editor inside IDE (design time)? I mean to create a list (maybe an array) of each MyObject instance's name string and the set the CurrentMyObject by the name property. There's no problem with setting the CurrentMyObject by a name, the problem is how to create the combobox inside Propert Editor to let the user to do that inside IDE (VS.NET property editor) ...
Regards, Desmond
|
|
|
|
|
You need to attach a TypeConverter via the TypeConverterAttribute that returns true for TypeConverter.GetStandardValueSupported (there are other ways as well). Read about the classes in the System.ComponentModel namespace, and read the section in the .NET Framework SDK, Enhancing Design-time Support[^]. Besides talking about TypeConverter s, there are a great many other design-time features you can exploit that are discussed.
BTW, many Types (like Enums) already have TypeConverter s associated with the Type, such that any property of that Type uses the TypeConverter unless the property is attributed using a TypeConverterAttribute that specifies a different TypeConverter to use.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks, unfortunately I cannot use enums (unless there is a way to construct a dynamic enum at runtime). It's a lot of reading I have to do (at msdn).
Anyway, could you please provide me with an example with this case here ?
|
|
|
|
|
I didn't tell you to use enums. Just that enums have a default TypeConverter associated with them. TypeConverter.GetStandardValuesSupported and TypeConverter.GetStandardValues aren't just for display enum members either. Lots of properties use this, whether it's displaying the names of controls (of a particular Type, perhaps) by getting the container and enumerating the controls, or anything like that.
If you read the documentation I gave you links for, there are plenty of examples in the topics. Besides, there's few methods to implement and they should be obvious how to use.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks, I will. I sometimes have trouble understanding english, it's really not my native language, so this should explane the misunderstandings.
|
|
|
|
|
Sorry. You could've fooled me, though! Your grammar is excellent - much better than most American's I've seen.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
That's because I try to write grammatically correctly as possible (I try to make use of what I've learned). I'm actually from Estonia (Europe, next to Finland over the Baltic sea).
|
|
|
|
|
I am currently involved in a barcode scanning project using .NET compact framework & C#. I need to programatically be able to set the timezone of the device when the application starts. The MSDN documentation only seems to have a gettimezone method in the timezone class & no way of setting it . Is there away to set this?
Any help would be much appreciated
CyMad
CF Developer
|
|
|
|
|
I don't know any .net way too, but you can use SetTimeZoneInformation() win32 function.
Mazy
You're face to face,
With the man who sold the world - David Bowie
|
|
|
|