|
I dynamically load a Dll in my Doc,it can access the variables of Doc,but not the functions,and get two errors.
CfgCom.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CMainDoc::MSCommSet(void)" (?MSCommSet@CMainDoc@@QAE_NXZ)
..\..\Bin/Cfg_Com.dll : fatal error LNK1120: 1 unresolved externals
Thanks for any help!
|
|
|
|
|
I suspect you should link your program with "your.lib" (assuming you want to use your.dll). Normally, "your.lib" is created after building "your.dll" and contains references to exported functions.
|
|
|
|
|
???,I don't use mydll.lib.
I use "AfxLoadLibrary" to dynamically load mydll.dll,and use "GetProcAddress" to call the exported functions.it works.
now ,i want mydll.dll to call public functions of doc.like "CMainDoc::MSCommSet(void)"
in fact i export a CView from this dll.
|
|
|
|
|
How To Draw Outside Window Context
|
|
|
|
|
|
char *ptr = new char[10];
memcpy(ptr,"Balkrishna",10);
//strcpy(ptr,"Balkrishna");
ptr[10]='\0';
AfxMessageBox(ptr);
delete ptr; // why does this crashes, ANy soultion??
--------------------------------------------------------
on contrary
char *ptr = new char[10];
memcpy(ptr,"Balkrishna",10);
//strcpy(ptr,"Balkrishna");
//ptr[10]='\0'; if i comment it works, but with garbage, WHY
AfxMessageBox(ptr);
delete ptr; //WONT CRASH HERE
|
|
|
|
|
"Balkrishna" contains in fact 11 characters !!!
Don't forget the trailling '\0' that "closes" your C-Style string.
So, by doing strcpy() you make an overflow and write in a memory space that is not yours...
to prevent such crash, declare char ptr[11] (or more)...
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Dear TOXCCT,
Balkrishna is 10 character, BTW even if i take 9 char and 10th is null, still it will crash.....
|
|
|
|
|
Balkrishna is 10 characters, but i said "Balkrishna", that equals to {'B', 'a', 'l', 'k', 'r', 'i', 's', 'h', 'n', 'a', '\0'} .
however, i don't know more, but maybe you could help me a bit more by copying the error message, and also the context if necessary...
oops, Mr DavidCrow's right, i didn't see
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Balkrishna Talele wrote:
ptr[10]='\0';
You don't have "permission" to access the 11th byte of this memory location.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
O o... Thanks,...a lot
cheers
Balkrishna
|
|
|
|
|
By the way,
incorrect deletion of pointer to an array,
use
delete[] ptr;
instead of
delete ptr;
|
|
|
|
|
You're seeing a failed assert, not a crash. The assert message will say something like "damage after normal block" which means you wrote past the end of the memory block you allocated (in this case, you allocated 10 bytes but wrote to 11).
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I HAVE USED
setAttribute(bstrAttributeName, varValue)
TO APPEND ATTRIBUTE NAME AND VALUE.BUT IT IS A MEMBER OF IXMLDOMELEMENT SO THE ATTRIBUTE IS APPEDED IN THE ROOT TAG .HOW TO APPEND ATTRIBUTE IN OTHER TAGS
|
|
|
|
|
|
|
|
Ah! I was slightly ashamed of being rude... but I could not resist!
|
|
|
|
|
|
Hi,
How can i save the values which are entered in the dialogs say an edit button.
also how can isave values entered in combobox at runtime so that the next time i run the application the combo box gets populated with the values which were entered previously.
Thanks
U get wht u Give
|
|
|
|
|
charu123 wrote:
How can i save the values which are entered in the dialogs say an edit button.
first, Edit button don't exist. I consider now you were talking about an Edit Box control.
CEdit* pEdit = GetDlgItem(ICD_MYEDIT); <font color=#008000>
CString strEditContent;
pEdit->GetWindowText(strEditContent); <font color=#008000>
charu123 wrote:
also how can isave values entered in combobox at runtime so that the next time i run the application the combo box gets populated with the values which were entered previously.
you must save it outside the app (file, registry...), and search for it into OnInitDialog() to fill your control with the value (SetWindowText() )
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I got it Thanks
U get wht u Give
|
|
|
|
|
I've a problem about splitters. When i want to use more than one view in a window. copy-past commands are automatically disabled and i can't use them in the applications. I use wizard to create Explorer view, to test if i do something wrong, but again they are disabled.
is there anyway to activate them automatically.
Also when i try to use ID_EDIT_COPY COMMAND from Accelerator Commands, the error message is : "Add/Remove of the function is impossible, because the parent class code is read only"
|
|
|
|
|
I have tried for some time to get a flat CCombBoxEx
There is this article on CodeProject that describes a flat ComboBox
http://www.codeproject.com/combobox/combobox_flatcombo.asp[^]
Unfortunately, I have not managed - and boy have I tried - to get it to work... Is there an easy way? What do you guys use? Is it free?
Thanks for any suggestion!
|
|
|
|
|
Every article has it's own forum, so ask there!
Don't try it, just do it!
|
|
|
|