|
Hi all,
I am working on vs2005 (vc++8).
I have created one dll in vs2005(vc++8), in that we have one function which returns "std::string" .
when i load this dll in another vs2005(vc++8) application and call the function which returns "std::string",
we get following error:
Windows has triggered a breakpoint in vstestdll.exe.
This may be due to a corruption of the heap, and indicates a bug in vstestdll.exe or any of the DLLs it has loaded.
The output window may have more diagnostic information
For more detail code is as follows:
[code]
dll function :
std::string getDH1(int clo)
{
return std::string("abcdefghijklmnopqr");
}
.exe code:
#define TEST2_API __declspec(dllimport);
TEST2_API std::string getDH1(int clo);
int _tmain(int argc, _TCHAR* argv[])
{
string sam =getDH1(1);
return 0;
}
[/code]
|
|
|
|
|
Does your code use a static library version of the C runtime? If so, then this sort of error is quite likely, as the EXE and DLL have different C heaps, so when the std::string is destructed, the EXE is trying to free memory in the DLL's heap, which is bad.
Look in Project Properties, C/C++->Code Generation, Runtime Library option.
|
|
|
|
|
I hope I can express the question with my poor english.
I wanna write a dialog based program, and let user to set the time and at the given time, execute other programs(the user gives the exe file path).
Can give some code hint or source code like this?
Or a program in sourceforge having such function issue.
|
|
|
|
|
Why don't you use Windows 's Scheduled Tasks (see, for instance [^])?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I need implement this function in my program.
|
|
|
|
|
Well, you application may create enties for the windows scheduler, se, for instance [^].
It is IMHO the cleanest way.
[added]
Try also to use CodeProject 's article search engine [^], it's free...
[/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Thursday, February 5, 2009 8:54 AM
|
|
|
|
|
Task scheduler[^]? That's the API behind Windows Scheduled Tasks. You're much better off using facilities built into the OS than coding an equivalent yourself.
|
|
|
|
|
|
Dear all,
I used tree control in my dialog,i need to update values in a tree control at run time,while updating values during run time tree got collapsed and it is very bad to collpse while seeing a value,i need to update values at runtime without collapsing the tree control,please help me out.
Thanks in advance,
Regards,
angel
|
|
|
|
|
How do you update the values in the tree?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hello,
This is the code iam using to display the tree.
HTREEITEM hItemRootVAL ;
HTREEITEM hItemParentVAL ;
HTREEITEM hItemSubVAL ;
HTREEITEM hItemTableVAL;
CString str;
hItemRootVAL = m_treePSISIInfo.InsertItem("PROGRAM",2,4, TVI_ROOT);
hItemParentVAL = m_treePSISIInfo.GetNextItem(hItemRootVAL, TVGN_CARET);
if(hItemParentVAL == NULL)
{
hItemParentVAL= m_treePSISIInfo.InsertItem("ONE",1,1,hItemRootVAL);
hItemSubVAL = m_treePSISIInfo.GetNextItem(hItemParentVAL, TVGN_CARET);
if(hItemSubVAL == NULL)
{
hItemSubVAL = m_treePSISIInfo.InsertItem("Table",0,0,hItemParentVAL);
hItemTableVAL = m_treePSISIInfo.GetNextItem(hItemSubVAL, TVGN_CARET);
if(hItemTableVAL == NULL)
{
str.Format("Table value 1 = 0x%02d",value1);
hItemTableVAL = m_treePSISIInfo.InsertItem(str,3,3,hItemSubVAL);
str.Format("Table value 2 = %d",value2);
hItemTableVAL = m_treePSISIInfo.InsertItem(str,3,3,hItemSubVAL);
str.Format("Table value 3 = 0x%04x",value3);
hItemTableVAL = m_treePSISIInfo.InsertItem(str,3,3,hItemSubVAL);
str.Format("Table value 4 = %d",value4);
hItemTableVAL = m_treePSISIInfo.InsertItem(str,3,3,hItemSubVAL);
str.Format("Table value 5 = %d",value5);
hItemTableVAL = m_treePSISIInfo.InsertItem(str,3,3,hItemSubVAL);
str.Format("Table value 6 = %d",value6);
hItemTableVAL = m_treePSISIInfo.InsertItem(str,3,3,hItemSubVAL);
str.Format("Table value 7 = %d",value7);
hItemTableVAL = m_treePSISIInfo.InsertItem(str,3,3,hItemSubVAL);
}
}
Actually in this code value1,value2........up to value7.frequently these values change at runtime. when ever these values got changed i need to update those values with out collpsing the tree.please help me how to do.
Regards ,
Angel.
|
|
|
|
|
And you delete all the items in the tree and insert them again every time there is a change? If so, rather than rebuilding the whole tree all the time, use CTreeCtrl::SetItemText[^] to change the text in the tree, this should leave the expanded-collapsed states untouched.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
What about making a note of which node is open, do the update, and then open that node back up afterwards?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi, i have a SDI app without toolbar and I need to add images to some of my menu items.
How can I do it?
Thanks.
|
|
|
|
|
there are thousands of example articles out there.
did you search any by chance ?
|
|
|
|
|
Yes, but they all include some user drawn class.
I was wondering could it be done for standard menus? Sorry for my poor language.
|
|
|
|
|
nope, the standard menu don't support this.
but using owner drawn menus wouldn't be too hard if using an all made class...
|
|
|
|
|
|
Thanks.
I used 'BCMenu' because I already have it included in my project.
|
|
|
|
|
Hello All,
I hav written a dialog based application. By pressing a button I want to open a .WMV video. I have used ShellExecute() function. Then How to set it to Full Screen through program?
Thanks & Regards
Sairam
|
|
|
|
|
sairam madem wrote: I have used ShellExecute() function.
What are you passing as the last argument?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
IF you dont need to Media player you cna use of MCI functions and they are easy to use like this for example.
CString str=_T("play f:\\93.mpg");
mciSendString(str,0,0,0);
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Is there a WIN32 function that will tell me whether any modifier key is pressed?
The context is a mouse hook function that is only interested if one or more modifier keys (shift, ctrl, alt) is pressed. If no key is pressed it just passes the event to the next hook.
I know that GetKeyState() returns the state of a specified virtual key, and that GetKeyboardState() returns an array of states. But a function that just tells me if ANY modifier key is pressed would add less latency in cases (most of the time) when a key is not pressed.
Thanks for listening
|
|
|
|
|
What's wrong with GetAsyncKeyState() ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Thanks for the reply.
Like GetKeyState(), I think GetAsyncKeyState() just tells me about a single key. I would prefer a single function call that tells me whether any modifier has been pressed, thus saving several system calls in the hook context.
|
|
|
|