|
yeah! That seems to be a possibility. I could hook GetSystemMenu() and add another system wide window message hook for WM_COMMAND and handle the message. But I strongly feels that there is some easy way to do it.
Well, thanks Sarath for the thought. Ofcourse you always "Shares your thought"!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
What about Using EnumWindows to get all top level windows and then modify the menu? Also you will have to add hook for new window creation notifications. I dont know if it will work but just a thought..
Regards,
Sandip.
|
|
|
|
|
That's also a possibility to experiment. I think, in order to handle the message, i've to add one message hook as well. isn't it? Well, thanks a lot Sandeep and my 5 points.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
I haven't tried it with 'Mouse Hook', but did with 'Windows Procedure Hook'. Installed a hook for WH_CALLWNDPROC (Windows procedure) and handled the 'WM_INITMENU' message in the hook. Once you get the window handle in the hook, I hope you don't need any more clues....
- Malli...!
|
|
|
|
|
That seems to be a cool Idea! Let me try it out. Thanks a lot malli, and please accept my 5 points.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
My pleasure.....
- Malli...!
|
|
|
|
|
Hi guys,
I downloaded a zip utility source code. When I used it in my program I received:
..\Zip_Utils\zip.cpp(2992) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
I have the source. Of course, I can easily add '#include "stdafx.h"', but that is not the point.
The question is: what is so special of "stdafx.h" that require including it in every .cpp that I add???
P.S. I don't know does it matter, but I'm writing in VS2005 in C++ for Windows Mobile 5.0, native, without STL, WTL, MFC.
|
|
|
|
|
akirilov wrote: The question is: what is so special of "stdafx.h" that require including it in every .cpp that I add???
Because it's the key to using the precompiled header (.pch) file.
The bigger question is how was the project's author able to compile the project without making the changes you've had to?
"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
|
|
|
|
|
Because it's the key to using the precompiled header (.pch) file.
So I have to include "stdafx.h" in every .cpp that I'm using?
Than probably I have to start reading about precompiled header (.pch) file...
|
|
|
|
|
akirilov wrote: So I have to include "stdafx.h" in every .cpp that I'm using?
Yes, if that's the way the project has been configured. You can, however, turn it off for individual files (e.g., C files).
"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
|
|
|
|
|
|
Thank you, that was very helpful!!!
|
|
|
|
|
Hi all
How can i set validation of edit box for numeric and decimal?And orevent string entry.
|
|
|
|
|
npvc wrote: How can i set validation of edit box for numeric and decimal?
Are you referring to the ES_NUMBER style, or possibly a masked-edit control?
"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
|
|
|
|
|
validation like on the C#?
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 )
|
|
|
|
|
Below gives the Senario.
CMultiThreadDlg : is the class Name
m_Dlg : is the variable name defined for Edit Box.
Here when i click a Button, I call AfxBeginThread(....).
MyThreadProc is called.
I want to display in Edit Box , from 1 to 100 (say)..
But it gives Exception. ASSERT Fail...
So how can i display Text in Edit Box using AfxBeginThread Procedure..
UINT MyThreadProc( LPVOID pParam )
{
CMultiThreadDlg *pObject = (CMultiThreadDlg *)pParam;
for(int i=0;i<100;i++)
{
pObject->UpdateData(TRUE);
CString str = "";
str.Format("%d",i);
pObject->m_Dlg.SetWindowText(str);
pObject->UpdateData(FALSE);
pObject->UpdateWindow();
Sleep(1000);
}
return 0; // thread completed successfully
}
void CMultiThreadDlg::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
CMultiThreadDlg pNewObject = new CMultiThreadDlg();
AfxBeginThread(MyThreadProc, pNewObject);
}
Please Reply.
Thanks..
|
|
|
|
|
Well, you don't create your dialog at all, just instantiate its class and hand it over to the thread as a parameter. You need to call DoModal or Create on the dialog to actually have the dialog around. And don't try to fiddle with windows/controls in a different thread than they were created in.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
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. <
|
|
|
|