 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Henley Grandmaster Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 671
|
Posted: Mon Mar 03, 2008 6:44 pm Post subject: [Solved]Calling thread from DLL |
|
|
So basically I have a thread in my dll and a checkbox in my C# gui. I want it to call the thread from the dll when the checkbox is checked.
Something like this:
| Code: | if (mycheckbox.Checked == true)
{
//this is in C++: CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&ThreadNAME, 0, 0, 0);
} |
Would I be able to do that? And if I use DllImport for my dll, would there be no parameters?
Last edited by Henley on Mon Mar 03, 2008 7:23 pm; edited 1 time in total |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Mon Mar 03, 2008 6:52 pm Post subject: |
|
|
That woudnt work.
If you made a sepearte dll in C++ then u would DllImport it first, get the function that u wanna use.
then do
| Code: | if ( myCheckBox.Checked == true )
{
CallMyFunction(); // function name that u imported.
} |
and in your C++ Dll
| Code: | void __declspec(dllexport) CallMyFunction()
{
hTheadHandle = CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)&ThreadNameInCDll, 0, 0, 0 );
} |
_________________
|
|
| Back to top |
|
 |
Henley Grandmaster Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 671
|
Posted: Mon Mar 03, 2008 7:20 pm Post subject: |
|
|
| lurc wrote: | That woudnt work.
If you made a sepearte dll in C++ then u would DllImport it first, get the function that u wanna use.
then do
| Code: | if ( myCheckBox.Checked == true )
{
CallMyFunction(); // function name that u imported.
} |
and in your C++ Dll
| Code: | void __declspec(dllexport) CallMyFunction()
{
hTheadHandle = CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)&ThreadNameInCDll, 0, 0, 0 );
} |
|
Thanks thats exactly what I needed lol
forgot to mention that the dll was made in C++ o.o
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Mon Mar 03, 2008 7:26 pm Post subject: |
|
|
| Code: | | CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle("lol.dll"), "ohhai"), 0, 0, 0); |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Mon Mar 03, 2008 7:33 pm Post subject: |
|
|
| Flyte wrote: | | Code: | | CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle("lol.dll"), "ohhai"), 0, 0, 0); |
|
He Said that he's Calling it from a C# GUI, and he wants to call the function to create the thread within his dll.
C# doesnt even have CreateThread unless you Import it.
_________________
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Mon Mar 03, 2008 9:13 pm Post subject: |
|
|
| lurc wrote: | | Flyte wrote: | | Code: | | CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle("lol.dll"), "ohhai"), 0, 0, 0); |
|
He Said that he's Calling it from a C# GUI, and he wants to call the function to create the thread within his dll.
C# doesnt even have CreateThread unless you Import it. |
Bullshit.
Thread t = new Thread(new ThreadStart(VoidMethod_NoParamsHere));
t.Start();
_________________
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Mon Mar 03, 2008 9:33 pm Post subject: |
|
|
| samuri25404 wrote: | | lurc wrote: | | Flyte wrote: | | Code: | | CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle("lol.dll"), "ohhai"), 0, 0, 0); |
|
He Said that he's Calling it from a C# GUI, and he wants to call the function to create the thread within his dll.
C# doesnt even have CreateThread unless you Import it. |
Bullshit.
Thread t = new Thread(new ThreadStart(VoidMethod_NoParamsHere));
t.Start(); |
I meant The API Function, not the C# Threading.
_________________
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Tue Mar 04, 2008 5:21 pm Post subject: |
|
|
Oh, my bad.
Seemed like you were saying that you couldn't create threads in C# (which I disproved above).
_________________
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|