Click here to Skip to main content
15,886,199 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to return value from a thread Pin
User 433002813-Dec-08 16:10
User 433002813-Dec-08 16:10 
Questioninstalling application only once at one client Pin
praveenvkumarv13-Dec-08 2:45
praveenvkumarv13-Dec-08 2:45 
AnswerRe: installing application only once at one client Pin
Dave Kreskowiak13-Dec-08 5:41
mveDave Kreskowiak13-Dec-08 5:41 
QuestionDll LibMain Function? Pin
OptiPlex13-Dec-08 1:26
OptiPlex13-Dec-08 1:26 
AnswerRe: Dll LibMain Function? Pin
User 665813-Dec-08 2:19
User 665813-Dec-08 2:19 
GeneralRe: Dll LibMain Function? Pin
OptiPlex13-Dec-08 2:56
OptiPlex13-Dec-08 2:56 
GeneralRe: Dll LibMain Function? Pin
User 665813-Dec-08 3:11
User 665813-Dec-08 3:11 
QuestionRe: Dll LibMain Function? Pin
OptiPlex13-Dec-08 3:37
OptiPlex13-Dec-08 3:37 
Thank you

You see, im using a program called Winject to inject the dll. I guess that really does it all.
When it gets injected, it automatically calls the LibMain function and executes the code in my Dll.

But when I try to inject the dll I made in c#, it doesnt get executed, this is the code im using:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace MyDll
{
    public class clsMain
    {
        [DllImport("kernel32.dll")]
        public static extern IntPtr LoadLibrary(string lpFileName);

        [DllImport("user32.dll")]
        public static extern int MessageBox(int hwnd, string lpText, string lpTitle, int style);

        // LibMain here...
        public void LibMain(IntPtr hInstance, int fdwReason, int reserved)
        {
            MessageBox(0, "Injected from C#", "C# hello world", 0);
        }
    }
}


Thank you very much again!
- opx
AnswerRe: Dll LibMain Function? Pin
User 665813-Dec-08 4:24
User 665813-Dec-08 4:24 
GeneralRe: Dll LibMain Function? Pin
OptiPlex13-Dec-08 4:27
OptiPlex13-Dec-08 4:27 
GeneralRe: Dll LibMain Function? Pin
User 665813-Dec-08 5:11
User 665813-Dec-08 5:11 
GeneralRe: Dll LibMain Function? Pin
Dave Kreskowiak13-Dec-08 5:40
mveDave Kreskowiak13-Dec-08 5:40 
GeneralRe: Dll LibMain Function? Pin
OptiPlex13-Dec-08 6:06
OptiPlex13-Dec-08 6:06 
AnswerRe: Dll LibMain Function? Pin
Giorgi Dalakishvili13-Dec-08 4:38
mentorGiorgi Dalakishvili13-Dec-08 4:38 
QuestionSometing wrong in my code,can you check it?thx~! [modified] Pin
franva13-Dec-08 0:49
franva13-Dec-08 0:49 
Questionhow to retrive the excutions file of a MimeType? Pin
leeoze13-Dec-08 0:03
leeoze13-Dec-08 0:03 
GeneralRe: how to retrive the excutions file of a MimeType? Pin
Luc Pattyn13-Dec-08 0:33
sitebuilderLuc Pattyn13-Dec-08 0:33 
AnswerRe: how to retrive the excutions file of a MimeType? Pin
Giorgi Dalakishvili13-Dec-08 1:20
mentorGiorgi Dalakishvili13-Dec-08 1:20 
GeneralRe: how to retrive the excutions file of a MimeType? -> found the answer Pin
leeoze14-Dec-08 9:50
leeoze14-Dec-08 9:50 
QuestionArray List Problem Pin
ais0712-Dec-08 21:49
ais0712-Dec-08 21:49 
AnswerRe: Array List Problem Pin
CodingYoshi12-Dec-08 22:01
CodingYoshi12-Dec-08 22:01 
GeneralRe: Array List Problem Pin
Luc Pattyn12-Dec-08 22:50
sitebuilderLuc Pattyn12-Dec-08 22:50 
GeneralRe: Array List Problem Pin
ais0712-Dec-08 23:03
ais0712-Dec-08 23:03 
GeneralRe: Array List Problem Pin
Mycroft Holmes12-Dec-08 23:13
professionalMycroft Holmes12-Dec-08 23:13 
AnswerRe: Array List Problem Pin
Brij12-Dec-08 23:09
mentorBrij12-Dec-08 23:09 

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.