|
Your EntryPoint should be the name of the function your trying to call in the DLL. If the function name in the DLL is Sum, then the EntryPoint should specify that.
[DllImport("DLL.dll", EntryPoint="Sum")]
public static extern int Sum(int x, int y);
If you wanted to change the name of the name of the function inside your application, you could do that also:
[DllImport("DLL.dll", EntryPoint="Sum")]
public static extern int DllSumFunction(int x, int y);
Now, the Sum function in the DLL would be called by the name DllSumFunction in your code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
the entry point is the start address of the dll.
and any way i tried as you told me but it did'nt work too
it says unable to find Sum.
marcoryos
|
|
|
|
|
Hi,
I'am writing a web page translation web service like Alta vista's babelfish translation service. I'am using Systran Web Translator 5.0. for translation.
Problem is that Systran does not expose its API. I have to call a dll from IEPlugin.dll from C# web service. This dll is not imported into C# project but some other component is calling this dll.
If someone has ever used this translation component then please let me know how to call this plugin from c#.
|
|
|
|
|
The TrackMouseEvent function fails and returns zero.
So I called (as msdn advised me) GetLastError() to get the error msg and it returns 998 which means:
ERROR_NOACCESS Invalid access to memory location.
Has anyone a clue what my OS is trying to tell me here?
I guess the error is caused by the c++ struct which the function takes as parameter.
( TRACKMOUSEEVENT Struct on MSDN )
<br />
[DllImport("kernel32.dll", SetLastError=true)]<br />
static extern int GetLastError ();<br />
<br />
[DllImport("user32")]<br />
public static extern bool TrackMouseEvent(TRACKMOUSEEVENT lpEventTrack);<br />
<br />
[StructLayout( LayoutKind.Sequential,CharSet=CharSet.Ansi)]<br />
public struct TRACKMOUSEEVENT {<br />
public long cbSize;<br />
public long dwFlags;<br />
public long hwndTrack;<br />
public long dwHoverTime;<br />
}<br />
<br />
<br />
and in the C# App Constructor:<br />
<br />
TRACKMOUSEEVENT foo = new TRACKMOUSEEVENT();<br />
foo.cbSize = Marshal.SizeOf(typeof(TRACKMOUSEEVENT));<br />
foo.dwFlags = TME_NONCLIENT;<br />
foo.hwndTrack = (long)this.Handle;<br />
bool bar = TrackMouseEvent(foo);<br />
MessageBox.Show(""+GetLastError());
|
|
|
|
|
TyronX wrote:
[StructLayout( LayoutKind.Sequential,CharSet=CharSet.Ansi)]
public struct TRACKMOUSEEVENT {
public long cbSize;
public long dwFlags;
public long hwndTrack;
public long dwHoverTime;
}
Well, according to the docs, these four fields should be DWORDS, or unsigned 32-bit integers. In your C# code, you're using long , which is a 64 bit signed integer. Change your long 's to int 's or uint 's and it should work. Also, change your hwndTrack type from long to IntPtr . Then it should work.
[StructLayout( LayoutKind.Sequential,CharSet=CharSet.Ansi)]
public struct TRACKMOUSEEVENT {
public int cbSize;
public int dwFlags;
public IntPtr hwndTrack;
public int dwHoverTime;
}
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for your Answer but I still get the same Error Message (with your TRACKMOUSEEVENT structure) :/
|
|
|
|
|
Thank you for reading my questions, please help me out if you can.
I have 4 tables: Forms, Profiles, InBound Msgs and OutBound Msgs. Now the Forms and Profiles are independent. Inbound & Outbound are constructed based on Forms and Profiles (using primary keys, IDs, from Forms and Profiles)
now Here is what i am trying to do, I am trying to create a treeview for each row in Profiles, I wanna list all the forms which belong to that row using Inbound and Outbound.
For example:
My Profile 1
- Form 1
- Form 2
My Profile 2
- Form 3
- Form 4
- Form 1
My Profile 2
- Form 1
- Form 4
- Form 2
etc
How do I use datarelation to do that? I understand that datarelation is to create a parent/child relationship... but how do i get the data from that relationship?
Thank you for helping .
Elapid For The Win
|
|
|
|
|
Hi there
I looking for a common dialog which only shows/selects the printer(s) (e.g. notepad: page setup -> printer [...the button in the right corner]). I didnt find this one yet
--------------------
select *
from users
where
iq > 60;
0 rows returned.
|
|
|
|
|
Hi,
It is easy enough to capture keybaord events into an out of focus window
(see Processing Global Mouse and Keyboard Hooks in C#
By George Mamaladze )
BUT does anyone know how to detect the HID device ID that sent the keyboard event from within the event handler?
Reason:
I have a generic USB IR remote control that generates standard keyboard events, but I want to route the remote keys to another out of focus application and not to the current in focus application. But at present I have no way to determine if a particular generic key (e.g. the "1" key)originated from the Keyboard or the remote.
Regards, Jeltz
|
|
|
|
|
i was developing windows service in C#. in that solution i added a setup project. the windows serivce build went fine. when i tried to build the setup project it showed "Error 1706.No valid source could be found for product Visual Studio .NET Enterprise Architect 2003 - English. The windows installer cannot continue. “ and my windows service didnt install..
how should i proceed from here..? kindly let me know
|
|
|
|
|
There is some possibly useful information here.[^]
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
thanks it worked
|
|
|
|
|
I've made a capture application in c# with DirectShow and I currently obtain an output file. I am now developping a video conferencing application and I would like to transform the capture to obtain a stream instead of the output file in order to be able to put this live stream on a serveur. And then the participant of the video conference will be able to read the stream from the serveur.
Is it possible to obtain a stream in output of a DirectShow capture?
Which method can I use in c# to do this?
Thanks
Julien
|
|
|
|
|
Hi!
I have completed a desktop application in C# and am now suuposed to make help files(.chm) for it. Can anybody give me few step by step tips, listing how the whole process of creating help goes.
cheers!
|
|
|
|
|
Install the "HTML Help Workshop" utility which comes with the Visual Studio. See the detailed help in this utility for creating HTML help (.chm file) for your program.
|
|
|
|
|
Thanx for showing the way out...I already have installed the MS HTML Help Workshop, the problem with its help is that its useful if u have already used HTML Help Workshop. Like it never talked about how to start off, where to write my help stuff, will it be a text file or a html?
Any simple explanations for a beginner with help files?
cheers!
|
|
|
|
|
You have to use the html files for particular topics to be included in the HTML Help Workshop. Basic steps are as under:
1. Create a new Help project using the File-New command.
2. Add HTML files for the topics to be included.
3. Add / create Index and Contents file which will be used for the Contents / Index tabs in your help system.
4. Add graphics files etc. inside your html topic files.
5. Change properties of the help project file as per requirements.
6. Compile the help project to give you the .chm file.
Details on these individual topics can be seen in the HTML Help Workshop utility's help file which gives step-by-step details.
|
|
|
|
|
I want to do the following: Create a Windows.Forms application put a WebBrowser control into it that connects to web browser. What I want to do is to run a local web server that starts when the application loads and stops when it is terminated.
Something that Visual Web Developer 2005 does and I think the Borland C#.
I don't want to use IIS.
Is there such web server?
|
|
|
|
|
|
Thanks a lot! That's what I was looking for!
|
|
|
|
|
Hi Code Project Guru's,
I recently stumbled upon this code to change languages... http://www.codeproject.com/csharp/FormLanguageSwitch.asp by Julijan Sribar
However, I cannot get it to work on my own projects...
I've tried all the basic stuff like setting my forms Localizable property to true & etc, but am really stumped. Have you got it to work in your own projects (with the Treeview control)?
FormLanguageSwitchSingleton.Instance.ChangeLanguage(this, new CultureInfo("de"));
Feedback greatly appreciated!!!
Lecky
|
|
|
|
|
Hi folks,
Do you guys know how I can list all the scheduled tasks in Windows? What API should I call?
Thanks a bunch.
|
|
|
|
|
I don't know if there is some FCL wrapper for it, but in C++, you use CoCreateInstance to get a handle to the task scheduler object, CLSID_CTaskScheduler. Given that, you can call Enum() to enumerate the scheduled tasks. Look up documentation on ITaskScheduler.
|
|
|
|
|
Any idea on how to operator overload in C#.Net?
Be Humble in Victory and Strong in Defeat. -Het
|
|
|
|
|
maybe this article helps:
http://msdn.microsoft.com/library/en-us/cssample/html/vcsamOperatorOverloadingSample.asp
|
|
|
|