Click here to Skip to main content
15,920,508 members
Home / Discussions / C#
   

C#

 
QuestionReminder Project Pin
MumbleB3-Oct-07 7:57
MumbleB3-Oct-07 7:57 
AnswerRe: Reminder Project Pin
kubben3-Oct-07 8:15
kubben3-Oct-07 8:15 
AnswerRe: Reminder Project [modified] Pin
Adam.m.Nelson3-Oct-07 8:24
Adam.m.Nelson3-Oct-07 8:24 
GeneralRe: Reminder Project Pin
MumbleB3-Oct-07 9:01
MumbleB3-Oct-07 9:01 
GeneralRe: Reminder Project Pin
Adam.m.Nelson3-Oct-07 9:52
Adam.m.Nelson3-Oct-07 9:52 
GeneralRe: Reminder Project Pin
MumbleB3-Oct-07 20:24
MumbleB3-Oct-07 20:24 
GeneralRe: Reminder Project Pin
Adam.m.Nelson4-Oct-07 2:36
Adam.m.Nelson4-Oct-07 2:36 
QuestionCreating own DLL for use with DllImport [modified] Pin
Kristian Sixhøj3-Oct-07 7:43
Kristian Sixhøj3-Oct-07 7:43 
I have created a DLL called uptimelib.dll, which
has one function:
public static string GetUptime()
{
    double secs, mins, hours, days, hours2, mins2, secs2;
    double ticks = Environment.TickCount;
    secs = Math.Floor(ticks / 1000);
    mins = Math.Floor(secs / 60);
    hours = Math.Floor(mins / 60);
    days = Math.Floor(hours / 24);
    hours2 = hours - (days * 24);
    mins2 = mins - (hours * 60);
    secs2 = secs - (mins * 60);

    return days + "days, " + hours2 + "hours, " + mins2 + "minutes, " + secs2 + "seconds";
}

The problem is, I want to be able to use this function in other projects, just by importing the dll using DllImport(). Therefore, I have put uptimelib.dll in System32 folder, and imported it into my project:
[DllImport("uptimelib.dll")]
public static extern string GetUptime();

But whenever I try to use the function, it throws an exception saying "Uptimelib.dll does not contain an entry point named GetUptime()". I have checked that everything is spelled correctly, and so on.

How do I fix it?

Thanks in advance.


-- modified at 14:18 Wednesday 3rd October, 2007

Virtual1ty

"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"

AnswerRe: Creating own DLL for use with DllImport Pin
Anthony Mushrow3-Oct-07 12:58
professionalAnthony Mushrow3-Oct-07 12:58 
GeneralRe: Creating own DLL for use with DllImport Pin
Kristian Sixhøj4-Oct-07 4:47
Kristian Sixhøj4-Oct-07 4:47 
QuestionHow do you set the Selected Item in a DataGridViewComboBoxColumn cell? [modified] Pin
Adam.m.Nelson3-Oct-07 7:41
Adam.m.Nelson3-Oct-07 7:41 
QuestionBound datagridvewview column ordering confusion Pin
Matthew Cuba3-Oct-07 7:39
Matthew Cuba3-Oct-07 7:39 
AnswerRe: Bound datagridvewview column ordering confusion Pin
Adam.m.Nelson3-Oct-07 8:03
Adam.m.Nelson3-Oct-07 8:03 
QuestionbindingNavigatorDeleteItem_Click Pin
bluegrassman3-Oct-07 7:11
bluegrassman3-Oct-07 7:11 
QuestionMDI Pin
sajid.salim.khan3-Oct-07 6:51
sajid.salim.khan3-Oct-07 6:51 
QuestionC# howto CyclePort Usb device ? Pin
etaofodete3-Oct-07 6:23
etaofodete3-Oct-07 6:23 
AnswerRe: C# howto CyclePort Usb device ? Pin
VirtualVoid.NET3-Oct-07 23:42
VirtualVoid.NET3-Oct-07 23:42 
QuestionSaving an self painted image from a pictureBox Pin
MyPiano3-Oct-07 6:08
MyPiano3-Oct-07 6:08 
AnswerRe: Saving an self painted image from a pictureBox Pin
Ajay.k_Singh3-Oct-07 7:02
Ajay.k_Singh3-Oct-07 7:02 
GeneralRe: Saving an self painted image from a pictureBox Pin
MyPiano5-Oct-07 2:58
MyPiano5-Oct-07 2:58 
QuestionDefault script in dot net is? Pin
GunaChinna3-Oct-07 5:09
GunaChinna3-Oct-07 5:09 
AnswerRe: Default script in dot net is? Pin
Pete O'Hanlon3-Oct-07 5:19
mvePete O'Hanlon3-Oct-07 5:19 
AnswerRe: Default script in dot net is? Pin
DotNetXenon3-Oct-07 8:24
DotNetXenon3-Oct-07 8:24 
AnswerRe: Default script in dot net is? Pin
Abhijit Jana4-Oct-07 4:44
professionalAbhijit Jana4-Oct-07 4:44 
QuestionGet any specific value from this xml [modified] Pin
Bummer83-Oct-07 4:43
Bummer83-Oct-07 4:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.