|
I'm assuming you're not showing a lot of your code, and that the dialog display just fine until you press the button.
As for the threading stuff, as code-o-mat said, you can't use MFC in a thread. That's not completely true, but you have to be very careful. Anything that uses MCFs HWND <-> hWnd (etc) maps will fail. Feel free to use CString.
You have a couple of choices. You can either store the HWND for the edit control as a member variable, and use SetWindowText (m_hMyEditWnd, ), etc, or you could register a message, and post that from the thread to the dialog window to handle at its leisure.
See http://www.flounder.com/workerthreads.htm[^] for more information. It's a site worth reading everything on.
Iain.
|
|
|
|
|
pavansdmcse wrote: pObject->UpdateData(TRUE);
CString str = "";
str.Format("%d",i);
pObject->m_Dlg.SetWindowText(str);
pObject->UpdateData(FALSE);
pObject->UpdateWindow();
You mustn't manipulate IO controls from a secondary thread. Post a message back to the primary thread instead.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I'm newbie on visual c++ 2005 professional
I can compile this source program
//Program:avgrage.cpp
#include<iostream>;
using namespace std;
int main()
{
int limit; //variable to store the number of items in the list
int number; //variable to store the number
int sum; //variable to store the sum
int counter; //loop control variable
cout<<"Enter data for processing "<<endl;
cin>>limit;
sum=0;
counter=0;
while(counter<limit)
{
cin>>number;
sum=sum+number;
counter++;
}
cout<<"The sum of the "<<limit<<" numbers= "<<sum<<endl;
if(counter!=0)
cout<<"The average= "<<sum/counter<<endl;
else
cout<<"NO input."<<endl;
return 0;
}
with no any error but when I debug this code I got
pop up and tell me that "This application has failed to start because MSVCP80D.dll was not found.Re-installing the application may fix this problem"
How can I do ?
How to correct this problem?
Is this a problem of my visual studio?(I used vs2005 professional)or my wrong code?
|
|
|
|
|
What does the app's manifest look like?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How can I check app's manifest?
Is it in the windows folder or vs2005 folder?
or same as
x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.267_x-ww_689c3980.manifest
;
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestversion="1.0">;
;
<file name="msvcp80.dll" hash="9688a0c71fab7d6e1eb0d6660f32cb8522066b3a" hashalg="SHA1"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>QZqS17k8kQ9Gz+b4BCkYqfxX5dQ=</dsig:DigestValue></asmv2:hash></file>
<file name="msvcm80.dll" hash="a1ae1aabd5a225d3b2617b2e3c1cec5fb9cf8090" hashalg="SHA1"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>hPCDGDE1Xx7+Z66sYz8lAs4knrU=</dsig:DigestValue></asmv2:hash></file>
</assembly>
|
|
|
|
|
Check the intermediate folder - the place your object code goes.
Typically this is in the "Debug" folder under your project folder.
Look for a file named something like yourappname.exe.intermediate.manifest
It might be easiest to create a new project (Win32 console) with the app wizard
and plug your code in to the generated "main()" function.
I did that with your code:
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int limit;
int number;
int sum;
int counter;
cout<<"Enter data for processing "<<endl;
cin>>limit;
sum=0;
counter=0;
while(counter<limit)
{
cin>>number;
sum=sum+number;
counter++;
}
cout<<"The sum of the "<<limit<<" numbers= "<<sum<<endl;
if(counter!=0)
cout<<"The average= "<<sum/counter<<endl;
else
cout<<"NO input."<<endl;
return 0;
}
After a build, there's this in the generated intermediate.manifest file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.DebugCRT" version="8.0.50727.762" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
If a fresh VS 2005 created project doesn't run then you haven't insalled the debug CRT libraries.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
can we use loadimage function for all kind of images?? i.e. jpeg, tiff etc.
|
|
|
|
|
Nope.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
If you're using MFC/ATL , CImage class satisfy your requirements.
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 am using SDK for vc6.how will i use a jpeg image to attach it to cursor. as earlier i was using load inage function for bmp images
|
|
|
|
|
|
If you aren't using MFC/ATL then GDI+ maybe an option, 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]
|
|
|
|
|
Assuming you have a working bitmap (.bmp) example, one way to know for sure would be try it with other formats.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
i have tried it with other formats but actually as i am using loadimage to load HBITMAP and this function does not work with other formats thatswhy this example is not working with other type of images.
still i could not find a way to load my HBITMAP for other formats..
|
|
|
|
|
What are the possibilities to remove the MFC dependency, from an MFC extension DLL?
Means, the interface class cannot have MFC dependency, but no need to remove MFC from internal code (functionality side). I believe it is not possible, but i would like to know your opinions
For example, my extension dll has a custom button (named CCustomBtn) derived from CButton. In the client side, CCustomBtn is used to create control variable for the button to get the custom look and feel. So what I need is, avoid the MFC dependancy from this CCustomBtn class (and in the include header), with/without affecting the client side. ('without affecting' is preferred, but i think it is impossible)
Please share your ideas.
Thank you.
- NS -
|
|
|
|
|
If you have a class derived from an MFC class then everywhere you use that
class will have a dependency on MFC.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes. But my requirement is to use the same dll for both old vc6 projects and for new vc8/9 projects. So there is an option to avoid the MFC dependency. As far as I know, extension dll should be compiled using the same compiler and libraries those are to be used for the client side. So if there is a chance to avoid the MFC dependency with out degrading the functionality of the MFC extension dll, my requirement is satisfied.
|
|
|
|
|
I see two choices:
1) Don't use MFC in the DLL.
2) Make the DLL a "regular DLL" Linked to MFC
Option 1 may not be an option.
Option 2 may require significant changes to the App-DLL interface.
Kinds of DLLs[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank you. I think I have to stick on the Extension DLL and provide a different one compiled with VC8/9 for newer applications.
|
|
|
|
|
My MFC is rusty, but IIRC MFC extension DLLs must link with the DLL version of MFC. So basically, you can't do what you're asking for.
|
|
|
|
|
Yes.
But my requirement is to use the same dll for both old vc6 projects and for new vc8/9 projects. So there is an option to avoid the MFC dependency. As far as I know, extension dll should be compiled using the same compiler and libraries those are to be used for the client side. So if there is a chance to avoid the MFC dependency with out degrading the functionality of the MFC extension dll, my requirement is satisfied.
|
|
|
|
|
template<class T1, class T2 = T1> class X2
{
};
please explain what it means (class T2 = T1)?
|
|
|
|
|
If you are not specifying the type T2, then it will be T1...
Like X2<int> a;
same as X2<int,int> a;
|
|
|
|
|
|
Consider the following example
template<class class="" t2="T1"> class X
{
public:
T1 a;
T2 b;
};
void main()
{
X<int> m1;
m1.a = 10;
m1.b = 10;
X<int,float> m2;
m2.a = 10;
m2.b = 10.0;
}</class>
Here m1 is having both members as int type. It is created as X<int>, means T1 is int, and T2 which is not specified explicitly, became the default type. That is T1, which is int. So T2 is also int.
In the second case, m2, T1 is int and T2 is specified as float explicitly. Now T2 is float.
Hope now it is clear.
|
|
|
|