|
Thanks for you attention Maximilien.
Realy, today i do this ... but a have so many functions to call and the struct of IF is going to be bigger i was planned.
I want to create a text file and put inside then a struct of tasks as shown above:
1 - Text description of task 1
1.1 - Text description of task 2 (Below to task 1)
1.1.1 - Text description of task 3
2 - Text description of task 4
2.1 - Text description of task 5
2.1.2 - 1.1 (reused it and your childs, if there are)
It seems complex, but it isn't for my aplication and the objective is wish.
As you can see, with this method i can create complex tasks just manipulating the file. obviosly i pass and return data and parameters between the functions using files seems like .ini
the ideia It will be like this:
.h
void GPC_1_2{};
.cpp
--> I create a deque or table and put inside then all functions names found inside text file
--> I receive a command from entrace process to execute task "GPC_1_2"
--> now a want to get the memory address for "GPC_1_2"
--> Using the memory address, i want to start GPC_1_2 function
Ps: Sometime ago i saw, but not save, a code to find the memory address function. it was using just the name of function inside a string object.
Sorry for the poor english, it is not my native language. I'm Brazilian
|
|
|
|
|
You might be able to use LoadLibrary() and GetProcAddress() to accomplish this. See here[^] and here[^].
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
Excellent suggestion. Dynamically lookup names of functions found in a DLL entry vector. That'll do it.
|
|
|
|
|
Chris,
I beliave it works, but i will need many of DLLs and a process to manage then. The struct i'm using will must change a lot to work this way
Samuel
|
|
|
|
|
Samuel Nunes de Arruda wrote: i will need many of DLLs and a process to manage then
This is not true. You can put all your functions into a single DLL and load it once using LoadLibrary() [^]. You can then find any of the exported functions using GetProcAddress() [^] with the name that you read from your text file. You can do this with minimal changes to your existing code.
|
|
|
|
|
You can use an map of function pointers to accomplish this.
This is assuming all the functions have the same signature, that is same return type and same numbers and types of parameters.
typedef void (*VoidFuncType)();
map<string, VoidFuncType> functions;
functions["myFunction1"] = myFunction1;
functions["myFunction2"] = myFunction2;
...
string func = "myFunction1";
...
functions[func]();
Note that myFunction1 and myFunction2 are functions or methods in your code.
If they are member functions, then the typedef will need to be different, and so will the subsequent usage.
Be sure to
#include <map>
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
modified 28-Sep-11 17:11pm.
|
|
|
|
|
Thank you ahmed,
Your solution can solve the problem because all the functions are using the same prototipe:
bool XXXXXX( Cstring )
The CString is the name of a file where the parameters (All data generate by de functions) are saved
to the next
The file represent the task data.
Realy thank you.
Samuel
|
|
|
|
|
Glad to be able help.
Good luck with your project.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
hi,
I have an aplication whose view is based in TabControl. It has three tab and one of them have a Edit control. I'd like show text in this edit control when I press a button. I thought do a global variable that keep a valor, for example 1, and in the method, to do a control that show text only if the variable have valor 1.
But my problem is after press button, don't happen something. I think that I must to update the view with the method onUpdate or something like that.. but I dont know how.
What do you think?
This is my aplication:
http://i54.tinypic.com/1e9qtx.png
This is code :
http://www.megaupload.com/?d=1QT43LOQ[^]
|
|
|
|
|
Global variables are usually not a good answer to anything. What you should do is post a message to the view and tell it to update the control whenever you need a value displayed or updated (use SendMessage() or PostMessage() ). You should not access the control directly from any window that does not own the control.
In the future, try and post applicable code in your question.
|
|
|
|
|
Ok, but I dont know how to update the control so that when I press the button show a message
|
|
|
|
|
Well, there's a number of steps:
1. To get notification of a button press, make sure the button control owner is catching the notification message.
2. To alert the other control's owner of the button press, the message handler of the button press should SendMessage() or PostMessage() to the edit control owner window requesting he make the change. The owner window needs a message defined and appropriate message handler.
3. Within the owner of the edit control, the message handler for changes to the edit control should take the parameters passed to it, then set the window text.
Which step do you not understand? As you can see, this is a somewhat complex process if you don't know how messaging works. You need to do a bit of research.
|
|
|
|
|
I don't have idea about messaging works, can you give me information? any page or something like that?
|
|
|
|
|
|
Good evening everyone I'm new to this forum, I wanted to ask if anyone can help me find the code of the algorithm Apriori in C. Thanks to all.
|
|
|
|
|
Maybe start with this article[^].
Sorry, I realized after posting that the article is C#, not C.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
thank you anyway for your assistance, I hope someone can help me
|
|
|
|
|
|
I compiled the code but I have these errors. I do not understand where I am to put ever.
can anyone help me?
error LNK2028: unresolved token (0A000476) "class std::set<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> >,struct std::less<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> > >,class std::allocator<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> > > > __cdecl apriori(unsigned int const &,class Matrix const &,unsigned int const &)" (?apriori@@$$FYA?AV?$set@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@U?$less@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@@2@V?$allocator@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@@2@@std@@ABIABVMatrix@@0@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
error LNK2028: unresolved token (0A000477) "void __cdecl display(class std::set<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> >,struct std::less<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> > >,class std::allocator<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> > > >,class std::map<unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<unsigned int>,class std::allocator<struct std::pair<unsigned int const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > >)" (?display@@$$FYAXV?$set@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@U?$less@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@@2@V?$allocator@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@@2@@std@@V?$map@IV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$less@I@2@V?$allocator@U?$pair@$$CBIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@@2@@2@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
error LNK2028: unresolved token (0A000478) "public: void __thiscall Matrix::getData(void)" (?getData@Matrix@@$$FQAEXXZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
error LNK2028: unresolved token (0A000479) "public: __thiscall Matrix::~Matrix(void)" (??1Matrix@@$$FQAE@XZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
error LNK2028: unresolved token (0A00047A) "public: __thiscall Matrix::Matrix(unsigned int,unsigned int)" (??0Matrix@@$$FQAE@II@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
error LNK2019: unresolved external symbol "public: __thiscall Matrix::~Matrix(void)" (??1Matrix@@$$FQAE@XZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
1>salvo.obj : error LNK2019: unresolved external symbol "void __cdecl display(class std::set<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> >,struct std::less<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> > >,class std::allocator<class std::set<unsigned int,struct std::less<unsigned int>,class std::allocator<unsigned int> > > >,class std::map<unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<unsigned int>,class std::allocator<struct std::pair<unsigned int const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > >)" (?display@@$$FYAXV?$set@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@U?$less@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@@2@V?$allocator@V?$set@IU?$less@I@std@@V?$allocator@I@2@@std@@@2@@std@@V?$map@IV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$less@I@2@V?$allocator@U?$pair@$$CBIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@std@@@2@@2@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
|
|
|
|
|
It looks as though you need some basic C++ and compiler experience before moving on to something as challenging as the apriori algorithm.
LNK2028
http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/e1417460-0ec7-400e-9df5-f16b98c7fd4d[^]
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
|
Youming Lee wrote: char **ptr_alph = (char **)malloc(wordCount * sizeof(char *));
Explain this, please. What do you mean "can't calculate the expression"?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
when i debug ,until the place "char **
ptr_alph = (char **)malloc(wordCount * sizeof(char *))",compileer shows the error. where can i put the photo of the screenshot?or email to you .i am afraid i can't tell the problerm. or it may be caused by another error.
|
|
|
|
|
Just copypaste the relevant lines from the compiler's output here.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
You havent asked a queation, you have asked us to fix your code.
So the answer is: NO.
Come back with a properly formulated question and we will answer it.
==============================
Nothing to say.
|
|
|
|
|