ExclamationC++ DLL in WebBrowser Problems!

Posts 1–7 of 7 · Page 1 of 1
C++ DLL in WebBrowser Problems!
Hello

Firstly I so sorry my bad english.

I hope mpgh users help me

I write c++ dll.
I use dll in form code
Sources here:


Source Files:

Main.cpp
Code:
#include <Windows.h>
extern int DesignMain();

DWORD WINAPI Main(LPVOID ParaMetre)
{
	DesignMain();
	return 1;
}

BOOL APIENTRY DllMain(HMODULE xH,DWORD xD,LPVOID xL)
{
	if(xD==DLL_PROCESS_ATTACH)
	{
		CreateThread(0,0x1000,(LPTHREAD_START_ROUTINE)Main,0,0,0);
	}
	return 1;
}
Header Files:

HackMenu.cpp:
Code:
#include "HackMenu.h"

using namespace Test;

int DesignMain()
{
	Application::EnableVisualStyles();
	Application::SetCompatibleTextRenderingDefault(false);
	HackMenu^ xHack=gcnew HackMenu();
	Application::Run(xHack);
	return 1;
}
I ınject the dll any game form coming. Thats verry good and cool.

I add button textbox commobox I add ALLL AND ANY ERROR COME THATS VERRY GOOD!

BUT I ADD WEBBROWSER AND DEBUG. Not come any error but I ınject any game: Game is freeze!

I try add form2 and I add button form2 . If click button form1 come and form1 have webbrowser.

I ınject game dll and form2 come not problems ! But click button Dont come form1 and I have this Error :

Code:
ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current threads is not in a single-threaded apartment

I search google but I cant solved Please help me please Thats so important

Note: I use vb 2012 and I give my project please download it and solved project and send me. Or please tell me solved please
Code:
void DesignMainSTA()
{
	Application::EnableVisualStyles();
	Application::SetCompatibleTextRenderingDefault(false);
	HackMenu^ xHack=gcnew HackMenu();
	Application::Run(xHack);
}

int DesignMain()
{
        Thread^ thread = gcnew Thread(gcnew ThreadStart(&YourNamespace::DesignMainSTA));
        thread->SetApartmentState(ApartmentState::STA);
        thread->Start();
        thread->Join();
	return 1;
}
Something like that.
Thank your for answer. But I'm new c++ users and I cant fix error Please look at the picture and how I fix error ?

I use visual studio c++ 2012 please help me men .

My project name: Test . Please give me true codes men

Why any body dont help me ?

I add using namespace System::Threading; and dont error thread but I have two Errors:

1-)IntelliSense: "ApartmentState" is ambiguous

2-) IntelliSense: class "Test::HackMenu" has no member "DesignMainSTA"

Some one help me please
11.png133 KB · 23 downloads
Make sure to add this at the top:

#include <System.Threading>

Also, try changing:
&HackMenu::DesignMainSTA

to:
&DesignMainSTA

Your picture was not approved so I couldn't see it. Also, refrain from triple posting.
Quote Originally Posted by master131 View Post
Make sure to add this at the top:

#include <System.Threading>

Also, try changing:
&HackMenu:esignMainSTA

to:
&DesignMainSTA

Your picture was not approved so I couldn't see it. Also, refrain from triple posting.
Dear master131;
Thank you for answer. No any person answer me but your answer. I am grateful to you

Okey I soludition problems. You'r say add top " #include <System.Threading>" and I try add but I have error "Cannot open source file System.Threading."

And I try add namespace system.threading and it's okey. And you'r say &HackMenu:esignMainSTA changing to: &DesignMainSTA and I made is and okey.

Last error IntelliSense: "ApartmentState" is ambiguous . But I try build and says buildsuccess but Have "ApartmentState" is ambiguous error. But that's no problem. I try dll any game and inject dll form and webbrowser coming In short, the problem is solved .

Notice: I'm so sad because my english language Not A CLass
Quote Originally Posted by tamkafadan42 View Post
#include <System.Threading>
Code:
using namespace System::Threading;
Quote Originally Posted by Biesi View Post


Code:
using namespace System::Threading;
Thanks, my bad. I haven't worked with C++/CLI in a long while. The #include would add a reference to the DLL, oops.
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us