Click here to Skip to main content
15,921,250 members
Home / Discussions / C#
   

C#

 
QuestionProblem with p/invoke in c# Pin
t4ure4n7-Apr-06 8:11
t4ure4n7-Apr-06 8:11 
AnswerRe: Problem with p/invoke in c# Pin
Steve Maier7-Apr-06 8:31
professionalSteve Maier7-Apr-06 8:31 
AnswerRe: Problem with p/invoke in c# Pin
Dan Neely7-Apr-06 8:35
Dan Neely7-Apr-06 8:35 
AnswerRe: Problem with p/invoke in c# Pin
Graham Nimbley9-Apr-06 15:10
Graham Nimbley9-Apr-06 15:10 
Have I look at pinvoke.net [^] for the actual code to dump into VB or C# to use the p/invoke function.

As this is just normal code you can put it anywhere you like, even in seperate assemblies and referencing them.

For example to use MessageBox from user32.dll:

using System;
using System.Runtime.InteropServices;    

public static class PInvokeHelper
{
    [DllImport("user32.dll", CharSet=CharSet.Auto)]
    public static extern int MessageBox(IntPtr hWnd, string text, string caption, uint type);
}

public class TestInvoke
{
    public void SayHello()
    {
        PInvokeHelper.MessageBox(IntPtr.Zero,"Hello, World!","Hello",0);
    }
}


Hope this helps.
Graham.
GeneralRe: Problem with p/invoke in c# Pin
t4ure4n10-Apr-06 8:30
t4ure4n10-Apr-06 8:30 
QuestionThe P/Invoke Wizard Pin
t4ure4n7-Apr-06 7:50
t4ure4n7-Apr-06 7:50 
AnswerRe: The P/Invoke Wizard Pin
Steve Maier7-Apr-06 8:28
professionalSteve Maier7-Apr-06 8:28 
AnswerRe: The P/Invoke Wizard Pin
Office Lineman7-Apr-06 8:29
Office Lineman7-Apr-06 8:29 
QuestionHow to find trusted sites? Pin
T John7-Apr-06 7:33
T John7-Apr-06 7:33 
QuestionMixing Colors Pin
Gulfraz Khan7-Apr-06 7:27
Gulfraz Khan7-Apr-06 7:27 
AnswerRe: Mixing Colors Pin
Ravi Bhavnani7-Apr-06 10:56
professionalRavi Bhavnani7-Apr-06 10:56 
QuestionCall User Control load event... Pin
Kasic Slobodan7-Apr-06 7:26
Kasic Slobodan7-Apr-06 7:26 
AnswerRe: Call User Control load event... Pin
russellsoft7-Apr-06 11:09
russellsoft7-Apr-06 11:09 
GeneralRe: Call User Control load event... Pin
Kasic Slobodan9-Apr-06 7:24
Kasic Slobodan9-Apr-06 7:24 
QuestionDetecting if a printer is connected using C# Pin
jzelma7-Apr-06 6:21
jzelma7-Apr-06 6:21 
AnswerRe: Detecting if a printer is connected using C# Pin
Braulio Dez7-Apr-06 10:07
Braulio Dez7-Apr-06 10:07 
QuestionHow to avoid displaying the Printer setting dialog when printing from Crystal Report Pin
jzelma7-Apr-06 6:15
jzelma7-Apr-06 6:15 
QuestionSMS for PDA Pin
sedso7-Apr-06 5:52
sedso7-Apr-06 5:52 
QuestionList of .NET Framwork versions installed. Pin
T John7-Apr-06 5:46
T John7-Apr-06 5:46 
AnswerRe: List of .NET Framwork versions installed. Pin
Eric Dahlvang7-Apr-06 6:52
Eric Dahlvang7-Apr-06 6:52 
QuestionSqlException, but now SQL problem Pin
eggsovereasy7-Apr-06 5:18
eggsovereasy7-Apr-06 5:18 
AnswerRe: SqlException, but now SQL problem Pin
Guffa7-Apr-06 8:39
Guffa7-Apr-06 8:39 
GeneralRe: SqlException, but now SQL problem Pin
eggsovereasy7-Apr-06 10:37
eggsovereasy7-Apr-06 10:37 
QuestionWMEncoder Voice Level Detection Pin
Shajeel7-Apr-06 3:30
Shajeel7-Apr-06 3:30 
QuestionTree Control - Paged/On Demand population Pin
AJ1237-Apr-06 3:01
AJ1237-Apr-06 3:01 

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.