|
thanks for reply ...
i'll reseach
|
|
|
|
|
Just a silly attempt: could you try to comment out all the lines below the offending one, until for loop ends?
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 create a new project with AppWizard. I select single document and do not use document view architecture, and it works fine. But if I comment out the line CPaintDC dc(this);
in the OnPaint handler and run it what happens is when I minimize the window and then restore it the status bar and the toolbar don not display. Clicking on the window brings back the status bar and moving the window or opening a menu brings back the toolbar. I thought it was something in my code on another program but this is all created by AppWizard and I'm not smart enough to figure it out. Has anyone else seen this or is it my computer?
|
|
|
|
|
I think that is not you computer or your code problem. You should not comment CPaintDC dc(this); Line.If you don't want to handle wm_paint message you have to comment out on_wm_paint() message(you should not handle it);If you are going to hanel it the line CPaintDC dc(this); Must be present.try by commenting the line on_wm_paint in BEGIN_MESSAGE_MAP.For more information on wm_paint read the following article from msdn.
http://msdn.microsoft.com/en-us/library/dd145213%28v=vs.85%29.aspx[^]
|
|
|
|
|
Thanks for your reply. My point is this is a new app created by AppWizard and I haven't
added anything. The only code in OnPaint is the declaration of the CPaintDC. It never gets used. I stepped through the construction code for CPaiintDC and I don't see anything to do with the toolbar or the status bar. Its not a problem its just something I noticed and was trying to figure out what one thing had to do with another.
|
|
|
|
|
I have seen a similar issue in a pure Win32 program when not calling BeginPaint() in the handler for the WM_PAINT message. I believe it has something to do with the way messages are cascaded through the windows from the frame down. Bottom line is to leave the basic structure of the wizard generated code intact, especially since you do not know what is under the covers in MFC.
I must get a clever new signature for 2011.
|
|
|
|
|
As Richard MacCutchan also mentioned, this most likely has to do with BeginPaint. I read it somewhere in MSDN that if you do not call this function in response to the WM_PAINT message, WM_PAINT will be re-posted into the message queue until BeginPaint is called in response to make sure a window will be repainted -sooner or later- as needed. I guess, by commenting out CPaintDC, you are flooding your process' message queue with WM_PAINTs, and once this happens, odd things start to happen.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
I have an SDI application that execute an specific moment an thread .From there , I send thorugh ::PostMessage(...) an CString :
CString* pMessage = new CString("Ready");
::PostMessage(m_window,WMU_UPDATE,0,(LPARAM)pMessage);
and , in CMainFrame I receive pMessage in the follow way :
LRESULT CMainFrame::OnUpdate(WPARAM wParam, LPARAM lParam)
{
CString* pMessage = (CString*)lParam;
SetMessageText(*pMessage);
delete pMessage;
}
and goes well , but still , in case that I shut down the application while second thread goes , I have memory leaks :
Dumping objects ->
strcore.cpp(118) : {1945} normal block at 0x003034F0, 268 bytes long.
I have to mention that when I close the application I wait to second thread to stop :
WaitForSingleObject(m_threadHandle, INFINITE);
How can I send CString through ::PostMessage in safe way ?
|
|
|
|
|
Why don't you properly synchronize (e.g. with Critical Section , Mutex ,...) the access to the shared resource (i.e. a CString allocated on the stack by the main thread) and use the message only to notify that the resource has been updated?
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]
|
|
|
|
|
Great ideea ! Now work fine ! Thank you !
|
|
|
|
|
You are welcome.
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]
|
|
|
|
|
Hi . How can I tell the compiler that should compile only VC6 code ? I have the follow code :
BOOL CMainFrame::ShowNotifyBaloon(PTSTR szBalloonTitle, PTSTR szBalloonMsg, DWORD dwIcon , UINT nTimeOut)
{
VERIFY((nTimeOut *= 1000) >= 10000);
ASSERT (dwIcon == NIIF_WARNING || dwIcon == NIIF_ERROR || dwIcon == NIIF_INFO || dwIcon == NIIF_NONE);
m_NID.dwInfoFlags = dwIcon;
m_NID.uFlags |= NIF_INFO;
m_NID.uTimeout = nTimeOut;
::strcpy(m_NID.szInfoTitle,szBalloonTitle);
::strcpy(m_NID.szInfo,szBalloonMsg);
return ::Shell_NotifyIcon(NIM_MODIFY,&m_NID);
}
that is not recognize in VC6 , but is in VC7 .... does exist some an compiler directive to compile only VC6 code and not VC7 code ?
|
|
|
|
|
There are a number of things you can look for. Open your stdafx.h and check
WINVER,_WIN32_WINNT,_WIN32_WINDOWS,_WIN32_IE,_MSC_VER
They define SDK and compiler version. You can use these in #if directives in your code to make it conditional.
|
|
|
|
|
Here is my stdafx.h
#if !defined(AFX_STDAFX_H__B5537D0B_2DD5_11E0_8FF9_0050BF29759A__INCLUDED_)
#define AFX_STDAFX_H__B5537D0B_2DD5_11E0_8FF9_0050BF29759A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>
#endif // _AFX_NO_AFXCMN_SUPPORT
and it's about _MSC_VER ? And which version is it ?
|
|
|
|
|
According to MSDN, if you type cl /? at the command line, you will see the full version for the compiler you are using.
Just make sure you know the difference between SDK version and compiler version before you proceed. You might be able to download a later SDK for your old compiler and make it work.
|
|
|
|
|
It should be 1200 for VC6.
|
|
|
|
|
Yes , it's 1200 , because if I write > 1200 won't compile VC7 code , but if I wrote >= 1200 compile VC7 code ,and , of course give error . Thanks !
|
|
|
|
|
I couldn't understand what you want to achieve exactly.
Flaviu 2 wrote: How can I tell the compiler that should compile only VC6 code ?
If you don't want to compile some codes in later releases than VC6. You can use this guard.
#if _MSC_VER <= 1200
...
#endif
But, your problem seems to be related with SDK version rather than compiler version. If so, (that is, a new feature which is not exist older vers,) you should use other macros such as WINVER, _WIN32_WINNT, _WIN32_WINDOWS, _WIN32_IE or _MFC_VER depending on your feature. Or you can use newer SDK as indicated by Niklas. Or may be, you just need to define target platform or similar appropriately on top of stdafx.h.
#define _WIN32_WINDOWS 0x0600
|
|
|
|
|
Hi ,
I have created a .DLL in one solution and I am trying to use that .dll in another solution.
In Visual Studio 2010 if I want to use same .DLL in the same Solution in which it was created , then I can do "Add->References->Configuratio~->Project"
But when I try to use this .DLL in another solution I cannt see .DLL in the "Project" tab.
How can I add reference to dll which is in another solution. MSDN shows the way for adding references of dll only for those which are in same solution.
|
|
|
|
|
Hi,
You can add the existing project to your solution and then add the lib of that dll project in linker options of the project you want add a reference.
Hope this helps
Nitheesh
Nitheesh George
http://www.simpletools.co.in
|
|
|
|
|
Use the Browse tab and add the reference from the folder of the other solution.
|
|
|
|
|
"Browse" is not available in visual studio for a C++ Projects.
|
|
|
|
|
For unmanaged C++ projects, you add a DLL reference as mentioned by Nitheesh George.
Open Project -> Properties -> Configuration Properties -> Linker -> Input .
Enter the name of the LIB file corresponding to the DLL in the Additional Dependencies text box.
|
|
|
|
|
In addition to what Superman said, be sure that the DLL is in the library search path used by Windows so it can be found when your program runs.
I must get a clever new signature for 2011.
|
|
|
|
|
Thanks a lot .
I tried by setting System environment variable,added Library include & Additional dependency and it solved my issue .
|
|
|
|