Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Thread with parametarized callback?
Thread with parametarized callback? [message #37765] Sat, 10 November 2012 23:16 Go to previous message
crydev is currently offline  crydev
Messages: 151
Registered: October 2012
Location: Netherlands
Experienced Member
Hi, I am trying to start a new thread with a callback function that is requiring a parameter. I followed this example: http://ultimatepp.org/reference$GuiMT$en-us.html But I cannot get it compiled. My code is as following:

void ImdbManager::ImdbRunSearchOperation(String& pQuery)
{
	pQuery.Replace(" ", "+");
	String tmpHtmlstr = GetPage(String(IMDBSEARCHURL) + pQuery);
	if (IsResultPage(tmpHtmlstr))
	{
		Vector<ImdbLink> tmpLinks = ParseResultPage(tmpHtmlstr);
		WhenSearchGetCount(tmpLinks.GetCount());
		for (auto link : tmpLinks)
		{
			ImdbMovie m = ParseTitlePage(GetPage(IMDBTITLELINK + link));
			m.cUrl = link;
			WhenImdbMovie(m);
		}
	}
}

void ImdbManager::ImdbSearch(String pQuery)
{
	if (pQuery.IsEmpty())
	{
		return;
	}
	if (!PrepareImdbCache())
	{
		return;
	}
	Thread().Run(callback1(ImdbRunSearchOperation, pQuery));
}


Now by looking at the example, I should be able to compile this. I am still getting the following errors:

E:\upp\MovieManager\ImdbManager.cpp(138) : error C3867: 'ImdbManager::ImdbRunSearchOperation': function call missing argument list; use '&ImdbManager::ImdbRunSearchOperation' to create
	 a pointer to member
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Gate4<P1,P2,P3,P4> Upp::callback1(const O *,bool (__thiscall M::* )(P1,P2,P3,P4,Q) const,T)' : expects 3 arguments - 2 pro
	vided
        e:\upp\uppsrc\core\Callback1.h(500) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Gate4<P1,P2,P3,P4> Upp::callback1(O *,bool (__thiscall M::* )(P1,P2,P3,P4,Q),T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(494) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Gate3<P1,P2,P3> Upp::callback1(const O *,bool (__thiscall M::* )(P1,P2,P3,Q) const,T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(454) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Gate3<P1,P2,P3> Upp::callback1(O *,bool (__thiscall M::* )(P1,P2,P3,Q),T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(448) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Gate2<P1,P2> Upp::callback1(const O *,bool (__thiscall M::* )(P1,P2,Q) const,T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(408) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Gate2<P1,P2> Upp::callback1(O *,bool (__thiscall M::* )(P1,P2,Q),T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(402) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Gate1<P1> Upp::callback1(const O *,bool (__thiscall M::* )(P1,Q) const,T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(362) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Gate1<P1> Upp::callback1(O *,bool (__thiscall M::* )(P1,Q),T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(356) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Gate Upp::callback1(const O *,bool (__thiscall M::* )(Q) const,T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(299) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Gate Upp::callback1(O *,bool (__thiscall M::* )(Q),T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(293) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Callback4<P1,P2,P3,P4> Upp::callback1(const O *,void (__thiscall M::* )(P1,P2,P3,P4,Q) const,T)' : expects 3 arguments - 2
	 provided
        e:\upp\uppsrc\core\Callback1.h(240) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Callback4<P1,P2,P3,P4> Upp::callback1(O *,void (__thiscall M::* )(P1,P2,P3,P4,Q),T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(234) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Callback3<P1,P2,P3> Upp::callback1(const O *,void (__thiscall M::* )(P1,P2,P3,Q) const,T)' : expects 3 arguments - 2 provi
	ded
        e:\upp\uppsrc\core\Callback1.h(194) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Callback3<P1,P2,P3> Upp::callback1(O *,void (__thiscall M::* )(P1,P2,P3,Q),T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(188) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Callback2<P1,P2> Upp::callback1(const O *,void (__thiscall M::* )(P1,P2,Q) const,T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(148) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Callback2<P1,P2> Upp::callback1(O *,void (__thiscall M::* )(P1,P2,Q),T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(142) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Callback1<P1> Upp::callback1(const O *,void (__thiscall M::* )(P1,Q) const,T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(102) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Callback1<P1> Upp::callback1(O *,void (__thiscall M::* )(P1,Q),T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(96) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Callback Upp::callback1(const O *,void (__thiscall M::* )(Q) const,T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(39) : see declaration of 'Upp::callback1'
E:\upp\MovieManager\ImdbManager.cpp(138) : error C2780: 'Upp::Callback Upp::callback1(O *,void (__thiscall M::* )(Q),T)' : expects 3 arguments - 2 provided
        e:\upp\uppsrc\core\Callback1.h(33) : see declaration of 'Upp::callback1'


Can anyone tell me what is wrong here? I don't know how the threading of U++ works so I really don't know where to look for this. I also still don't understand how the callback to the GUI thread is done without exceptions as usually in C# for example you always have to invoke a callback in such case.
 
Read Message
Read Message
Read Message
Previous Topic: Error meaning
Next Topic: broken pick semantics
Goto Forum:
  


Current Time: Wed Jul 16 19:32:41 CEST 2025

Total time taken to generate the page: 0.03463 seconds