|
Hi Cool Ju,
It was just a silly fault on my part.
i am extremely sorry about the whole matter.
During the initial phase, i had commented out the resource.h file.
Moreover, i had declared one function in MyClass.h but forgot to define it in MyClass.cpp. That gave a linker error and showed the mangled names of the function. Since the names were not so clear, i skipped reading it everytime.
Yesternight, i looked more closely to the error and read each line of it then realised my mistake.
Thanks for all the help.
And, sorry that i bothered you.
Thanks a lot!
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
I think IDC_MY_DIALOG ist not defined.
Did you include resource.h in your Source ?
Is there a Dialog with this ID in your resource ?
|
|
|
|
|
HI Karle,
Thanks for the help.
I had commented out "resource.h" in "stdafx.h"
Moreover, i forgot to define a function which i had declared in the header file. The linker error was so confusing that i wasn't able to understand the actual problem.
Now its working...
Thanks for the help.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
Hi guys,
When I try to link a DLL I get this error message.
Cannot Find TestDLL even with argument lookup.
TestDLL is a function defined in the dll.
I am a newbie to DLL. I have done it in other languages but not in VC. Can somebody tell me how to go about this.
Also kindly tell me the basic steps for working with a DLL.
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Hi,
How r u linking the dll (explicitly - lib or implicitly - run time loading)
Check this[^] for tutorials
Bye
Cool Ju
Dream Ur Destiny
|
|
|
|
|
Runtime linking
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
For Runtime Linking are you calling LoadLibrary(..) and GetProcAddress api?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Could you tell me your Flow... are you using LoadLibrary and GetProcAddress Api to dynamically load dll?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I am using neither of them.
I just included the necessary files and then the library path in project settings.
I don't if I am right.
Will need help.
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Here A Small code that will demonstrate dynamically loading of function from DLL.here, I will load mciSendString defined in WINMM.DLL .
// first make Function pointer
typedef MCIERROR (WINAPI * MCISENDSTRING)(
LPCTSTR lpszCommand,
LPTSTR lpszReturnString,
UINT cchReturn,
HANDLE hwndCallback
);
/// In function where you want to use about api
MCISENDSTRING fnmciSendString=NULL;
HMODULE hLibrary;
// load the library
hLibrary=LoadLibrary(_T("winmm.dll"));
// check is library loaded
if(hLibrary)
{
// if yes try to get Function addressfnmciSendString=(MCISENDSTRING)::GetProcAddress(_T("mciSendString"));
}
// check is we got Function Pointer
if(fnmciSendString)
{
// if yes call function
(fnmciSendString)(......);
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Thanks
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Help me. I write a UDP/IP transfer file programe,but don't transfer,Who can help ? Please leave Email , i'll talk about with UDP/IP transfer file.
i use MFC c++
........
-- modified at 3:12 Monday 21st November, 2005
|
|
|
|
|
::SetCursor(::LoadCursor(NULL,IDC_WAIT));
m_pMenu->TrackPopupMenu(TPM_CENTERALIGN,p.x,p.y,pParent,NULL);
::SetCursor(::LoadCursor(NULL,IDC_ARROW));
I wrote this code, it doesn't work correctly.
|
|
|
|
|
Try to use BeginWaitCursor
=================
Enjoy Programming
|
|
|
|
|
You can use the CWaitCursor (MFC) class. It's very simple to use.
I.e:
CWaitCursor wait;
|
|
|
|
|
I have a feeling the cursor handling used by TrackPopupMenu to show the selected item in the menu is overriding your SetCursor() call.
Software Zen: delete this;
|
|
|
|
|
I would like to know how to scroll the Edit box without flash?
In my condition, I need to keep the Edit box at the last row, so I need to scroll the Edit box after any update of the Edit box. This is my code:
if (m_LC_STATUS.GetLineCount()>11)
{
PKTstr=PKTstr.Right(PKTstr.GetLength()-m_LC_STATUS.LineLength(0)-2);
}
SetDlgItemText(IDC_LC_STATUS, PKTstr);
m_LC_STATUS.LineScroll(m_LC_STATUS.GetLineCount()-1, 0);
When I use this code, the Edit box is flash during update it.
Please help!
|
|
|
|
|
You can use CEDit::SetSel to select the last letter, and then clear the selection
=================
Enjoy Programming
|
|
|
|
|
Still the same because
SetDlgItemText(IDC_LC_STATUS, PKTstr);
Set the text into the Edit box at the beginning, then the SetSel or Linescroll move the display to the end.
So the display flash!
Please help!
|
|
|
|
|
Hi Everybody,
I have a list control in a CDialog, which is a member of the main CDialog, as follows.
class CMainDlg: public CDialog
{
CMyDialog mMyDlg;
}
class CMyDialog: public CDialog
{
CListCtrl *mMyListControl;
}
mMyListControl->InsertColumn works fine, but m_MyListControl->InsertItem doesn't work. It takes the program to CListCtrl::DrawItem and stops, because I haven't provided override for the DrawItem method. If I move mMyListControl to CMainDlg, then InsertItem seems working fine.
My questions are: Why does IntertItem not work? Is there a easy way to solve the probelm other than providing overide for the DrawItem method?
Any suggestions would greatly be appreciated.
Kevin
|
|
|
|
|
Do you check the own draw style in resource?
Try to check it off.
GL.
|
|
|
|
|
Many thanks, GL. I am relative new to VC++. Could you please provide some more details, or where can I find the relavent information? Thanks.
Kevin
|
|
|
|
|
Hi GL,
I tried your suggestion and it worked. Thank you very much. I spent fairly some time and couldn't figure the problem out but now the problem is solved with your help.
Have a nice evening.
Kevin
|
|
|
|
|
Hi peoples! This is my first post here, and hopefully not my last.
Anyway, I'll skip the intro and the backstory, and just tell you my problem- I have an aLife simulation in which there will be several 'creatures' which need to 'think' every frame. Originally, each would be controlled by an evolvable program, but due to time constraints in obtaining results from the simulation, I'm now planning a system whereby each section of the thinking method has several options, determined by the 'genetic code' of the creature.
An example, to clarify: There may exist several methods for choosing a target within a creature's visual field; the creature may want to focus on the brightest object, the fastest moving object, the object most like itself, the tastiest looking object, etc. etc.. Each of these strategies would be coded a slightly different way, and depending on what gene a particular creature has for 'target choosing' a different piece of code would need to be executed.
So, basically, I have a method, which I want to insert different snippets of code into, at runtime. My question is: what is the best method of achieving this? I have considered three possibilities so far:
1. A very big switch statement. It would simply choose which bit of code to execute depending on what the value of the gene for a particular thing is. This method would work, and would work well, but it would be a nightmare to maintain and is just a bit crap really!
2. Hard code the snippets as functions somewhere in another file, and store pointers to those functions in the creature objects- call the functions with the appropriate parameters in the 'think' method. This is tidyer, but is still not an elegant solution, and I can see problems developing in not knowing numbers of parameters and whatnot beforehand.
3. Some kind of clever plugin system, whereby each snippet of code is pre-compiled and able to be linked in and used at run-time. Very extensible, very slick, but really hard to do, a lot of work (since it'll be cross platform, a lot of compiling will need to go on I guess), and I'm not sure if it's really necessary, or particularly diferent from option number 2.
Hopefully one of you chaps will be able to suggest a mystery 4th option, I'm hoping for something similar to option 2 but a bit more elegant and robust! Thanks in advance for your help, folks!
|
|
|
|
|
Something like no 2:
Declare a helper class which is a gene repository. Any new gene (methods) which you want to add register themselves with this repository. All genes inherit from a pure virtual base class, so they have to implement an interface which allows your think procedure to interact with them.
Once you have the repository, you have to create a standard interface through which you need to access these genes. In your case you do not know in advance what parameters they are going to need, this means that you probably need to pass a pointer to an object which allows query access to the "world state"/"creature state" so that gene can make its decisions.
You can ask the repository for a list of the registered genes and store a pointer to the selected on in your creature class. You can then call functions on it.
We do something very similar to this to handle printing of reports where report sections register themselves with a repository, and we ask them if they apply to your document. If they do, they get added to a list which is used to generate the final report.
If you vote me down, my score will only get lower
|
|
|
|