|
That was actually the name of the product - remember it used to be Visual Studio .NET rather than just plain Visual Studio? 5 out of the 35 chapters cover .NET - the rest are plain Visual C++ and MFC (I know because it's on Safari & I can see it ).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Yes, that was very much what I was talking about. They can please publish another book to explain all the C++/CLI stuff instead of dedicating 5 chapters to show how .NET "fits in". But I see this is happening with a lot of books these days.
I can't wait for X86 .NET.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
How do give ( pass, transmit) value of variable
m_sPP_modal
From class modal window “CAdodc_MDI”
To variable
m_sPP_modeless
of modeless class “CMyModeless2”
and on the contrary - from class “CMyModeless2”
to class modal window “CAdodc_MDI ?
below 2 lines isn’t correctly into button ‘OK’ of modal window:
CMyModeless2 dlg2;
dlg2.m_sPP_modeless = L“text”;
below brief:
/////////////////////////////////////////
// Adodc_MDI.cpp : implementation file
#include "stdafx.h"
#include "ADO_MDI.h"
#include "Adodc_MDI.h"
#include "MyModeless2.h"
class CAdodc_MDI : public CDialog
{
CString m_sPP_modal = _T("text in Modal window");
}
//////////////////////////////////////
MyModeless2.cpp : implementation file
#define WM_GOODBYE WM_USER + 100
class CMyModeless2 : public CDialog
{
CString m_sPP_modeless = _T("text in Modeless window");
}
//////////////////////////////////////
// ADO_MDIView.cpp : implementation of the CADO_MDIView class
//
#include "stdafx.h"
#include "ADO_MDI.h"
#include "ADO_MDIDoc.h"
#include "CntrItem.h"
#include "ADO_MDIView.h"
#include "MyModeless2.h"
#include "Adodc_MDI.h"
LRESULT CADO_MDIView::OnGoodbye(WPARAM wParam, LPARAM lParam)
{ }
void CADO_MDIView::OnLButtonDown(UINT nFlags, CPoint point)
{ }
void CADO_MDIView::OnRButtonDown(UINT nFlags, CPoint point)
{ }
///////////////////////////////////////////////
///////////////////////////////////////////////
Below MORE DETAIL:
"MyModeless2.h"
#pragma once
#include "afxwin.h"
// CMyModeless2 dialog
#define WM_GOODBYE WM_USER + 100
class CMyModeless2 : public CDialog
{
DECLARE_DYNAMIC(CMyModeless2)
public:
CMyModeless2(CWnd* pParent = NULL); // standard constructor
virtual ~CMyModeless2();
// Dialog Data
enum { IDD = IDD_DIALOG4 };
CString m_sPP_modeless;
CView* m_pView;
CMyModeless2(CView* pView);
afx_msg void OnBnClickedButton3();
BOOL Create(void);
protected:
virtual void OnOK();
virtual void OnCancel();
public:
afx_msg void OnBnClickedOk();
afx_msg void OnBnClickedCancel();
};
/////////////////////////////////////
MyModeless2.cpp
#include "stdafx.h"
#include "ADO_MDI.h"
#include "MyModeless2.h"
// CMyModeless2 dialog
IMPLEMENT_DYNAMIC(CMyModeless2, CDialog)
CMyModeless2::CMyModeless2(CWnd* pParent /*=NULL*/)
: CDialog(CMyModeless2::IDD, pParent)
, m_sPP_modeless(_T(""))
void CMyModeless2::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT3, m_sPP_modeless);
}
BEGIN_MESSAGE_MAP(CMyModeless2, CDialog)
ON_BN_CLICKED(IDC_BUTTON1, &CMyModeless2::OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON2, &CMyModeless2::OnBnClickedButton2)
ON_BN_CLICKED(IDC_BUTTON3, &CMyModeless2::OnBnClickedButton3)
ON_BN_CLICKED(IDOK, &CMyModeless2::OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, &CMyModeless2::OnBnClickedCancel)
END_MESSAGE_MAP()
CMyModeless2::CMyModeless2(CView* pView)
{
m_pView = pView;
}
BOOL CMyModeless2::Create(void)
{
return CDialog::Create(CMyModeless2::IDD);
}
void CMyModeless2::OnOK()
{
if (m_pView != NULL) {
m_pView->PostMessage(WM_GOODBYE, IDOK);
}
else {
CDialog::OnOK(); // modal case
}
CDialog::OnOK();
}
void CMyModeless2::OnCancel()
{
if (m_pView != NULL) {
// modeless case -- do not call base class OnCancel
m_pView->PostMessage(WM_GOODBYE, IDCANCEL);
}
else {
CDialog::OnCancel(); // modal case
}
}
void CMyModeless2::OnBnClickedOk()
{
OnOK();
}
void CMyModeless2::OnBnClickedCancel()
{
OnCancel();
}
///////////////////////////////////////////
ADO_MDIView.h
// ADO_MDIView.h : interface of the CADO_MDIView class
#pragma once
class CMyModeless2;
class CADO_MDIView : public CScrollView
{
protected: // create from serialization only
CADO_MDIView();
DECLARE_DYNCREATE(CADO_MDIView)
// Attributes
public:
CADO_MDIDoc* GetDocument() const;
// Overrides
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // called first time after construct
// Implementation
public:
virtual ~CADO_MDIView();
protected:
// Generated message map functions
protected:
afx_msg void OnDestroy();
DECLARE_MESSAGE_MAP()
public:
CMyModeless2* m_pModeless;
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
LRESULT OnGoodbye(WPARAM wParam, LPARAM lParam);
};
//////////////////////////////////////////////
// ADO_MDIView.cpp : implementation of the CADO_MDIView class
#include "stdafx.h"
#include "ADO_MDI.h"
#include "ADO_MDIDoc.h"
#include "CntrItem.h"
#include "ADO_MDIView.h"
#include "MyModeless2.h"
#include "Adodc_MDI.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CADO_MDIView
IMPLEMENT_DYNCREATE(CADO_MDIView, CScrollView)
BEGIN_MESSAGE_MAP(CADO_MDIView, CScrollView)
ON_MESSAGE(WM_GOODBYE, OnGoodbye)
ON_WM_DESTROY()
ON_WM_LBUTTONDOWN()
ON_WM_RBUTTONDOWN()
END_MESSAGE_MAP()
// CADO_MDIView construction/destruction
CADO_MDIView::CADO_MDIView()
: m_pModeless(NULL)
, m_sReceivingFromModeless1(_T(""))
{
m_pModeless = new CMyModeless2(this);
}
CADO_MDIView::~CADO_MDIView()
{
delete m_pModeless;
}
void CADO_MDIView::OnDestroy()
{
// Deactivate the item on destruction; this is important
// when a splitter view is being used
COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
{
pActiveItem->Deactivate();
ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
}
CScrollView::OnDestroy();
}
void CADO_MDIView::OnLButtonDown(UINT nFlags, CPoint point)
{
if (m_pModeless->GetSafeHwnd() == 0)
{
m_pModeless->Create();
}
}
void CADO_MDIView::OnRButtonDown(UINT nFlags, CPoint point)
{
m_pModeless ->DestroyWindow();
}
LRESULT CADO_MDIView::OnGoodbye(WPARAM wParam, LPARAM lParam)
{
m_pModeless->m_sPP_modeless;
m_pModeless->DestroyWindow();
return 0L;
}
/////////////////////////////////////////////
Adodc_MDI.h
#pragma once
#include "afxcmn.h"
class CAdodc_MDI : public CDialog
{
DECLARE_DYNAMIC(CAdodc_MDI)
public:
CAdodc_MDI(CWnd* pParent = NULL); // standard constructor
virtual ~CAdodc_MDI();
enum { IDD = IDD_ADODC };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
virtual BOOL OnInitDialog();
CListCtrl* m_pListCtrl;
_ConnectionPtr m_pConn2;
CString m_sPP;
afx_msg void OnHdnItemclickList1(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnBnClickedOk();
int col;
int row;
private:
};
////////////////////////////////////////
|
|
|
|
|
Please read the posting guidelines. I don't think anybody will want to read all your source code.
As far as I understood, you want to pass a variable from one dialog to another one. Is that correct ? If yes, then take a look at this article[^]
|
|
|
|
|
See, for instance, this article [^].
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]
|
|
|
|
|
You could pass the value in the constructor:
CMyModeless2::CMyModeless2(CView* pView, CString sPP)
{
m_sPP_modeless = sPP;
m_pView = pView;
}
|
|
|
|
|
I am in the middle of porting one of my C++ project which is using old iostream (shipped with VC6.0) into new iostream implemented in stlport version 5.2
I found that some of the stream related methods are not available in the new iostream class.
The compiler gives me error for the following methods
streambuf::allocate()
streambuf::doallocate()
streambuf::blen()
ostream::osfx()
ostream::opfx()
streambuf::base()
streambuf::ebuf()
streambuf::setb()
Am I missing something?
Are there any equivalent methods available in new iostream library?
How can I substitute these functions when I port into new stlport/VS2008 iostream?
Thanks in advance
cheers
Varghese Paul
|
|
|
|
|
Varghese Paul M wrote: streambuf::allocate()
streambuf::doallocate()
streambuf::blen()
streambuf::base()
streambuf::ebuf()
streambuf::setb()
These all refer to the 'reserve area' of the pre-standard IOStreams streambuf. The standard basic_streambuf doesn't have this concept at all (I guess they decided it was better for that concept not to exist in an abstract stream buffer). This post[^], however, gives a suggestion for a possible solution.
Varghese Paul M wrote: ostream::osfx()
ostream::opfx()
These were functions that ran before (opfx) and after (osfx) every output operation. They've been replaced by the sentry nested class, so rather than this:
if (os.opfx()) { os.do_something(); }
os.osfx();
you have this
std::ostream::sentry se(os);
if (se) { os.do_something(); }
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi all,
i m working on Windows based mobile,here ActiveSync or Mobile device center is necessary.
How can i check ActiveSync or Mobile device centre installed on PC?
please help me for this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
I needing program for fax modem. please guide for me. thanks very much
|
|
|
|
|
Would you like cheese with that?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
May I ask for pizza & beer, sir? Plz, plz, urgentz...
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 code process for this problem
|
|
|
|
|
Well I badly need a new car!
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]
|
|
|
|
|
nguyen phan wrote: i need code process for this problem
This place is not a wishing well.
Please read the guidelines[^] before you can post further queries here.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Try TAPI.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
May i know how can i check my previous posts and replies...
|
|
|
|
|
Click on your user name and then Messages posted.
|
|
|
|
|
GOTO ( ) your Member Profile page [^] and then click on Message Posted link, it will open this page [^].
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]
|
|
|
|
|
hello:
I want to display the diagram charted by visio with mfc, and I can contorl the color of shapes at any time.
But I don't know how to bring about.
At first, I realize it by visio drawing control, but the program is started up very slowly, and the shape aren't zoomed with the zooming windows.
Now I don't do it, can you have another way to realize it expect the way using "visio drawing control"?
If you know, help me please!
thank you!
|
|
|
|
|
Hi there.
I have an application ofwhich threads concurrently act on multiple instances of a certain class called CChannel.
CChannel has a method called ::Send which must be protected. For that end I put in a place a Critical section as a data member of CChannel then I call EnterCriticalSection and LeaveCriticalSecion within ::Send. I avoided to use a global critical
section for performance reasons : indeed I do'nt want to have a blocking scenario when thwo threads call ::Send on two different instances.
At some point of time, I need to delete a Channel object. Since threads hold references to the pointer addresses, the application can easily crash if one thread tries to use a certain address pointing to an object that has been deleted by another thread.
To overcome this, instead of communicating addresses, rather I communicate access numbers. these number serv as a key for a map that stores context structures containing the actual addresses and also the per-instance CriticalSection. So the CriticalSection which used to be a data member of Channel is now out of the class (I will be able to delete a Channel object, but still use its acorresponding CriticalSection)
Here my solution, I am not confident, I think it works, but anyway I will be happy to be helped with a much more solid solution.
<pre>//This is the wrapper structure. it contains the criticalsection, the pointer to CChanel
typedef struct ChannelContext
{
CChannel* pChannel;
CCriticalSection cs;
} ChannelContext;
typedef std::map<UINT,ChannelContext*> channelMapT;
channelMapT channelMap;
CCriticalSection csMap; //(used to protect the map).
//The following two function can be called without problem by any thread :
//This function is called by a thread when it needs to act on a certain CChannel.
//it is meant to provide safe access to the CChanell. the calling thread only needs to check if the retunred
//address is not null, then consume pContext->pChannel, then when it finishes its job with the Channel is calls
//pContext->LeaveCriticalSection(&pContext->cs).
ChannelContext* requireChannelByKey(UINT accessKey)
{
EnterCriticalSection(&csMap);
channelMapT::iterator myIt=channelMap.find(accessKey);
if(myIt!=channelMap.end())
{
ChannelContext* pContext=myIt->second;
EnterCriticalSection(&pContext->cs);
LeaveCriticalSection(&csMap);
return pContext;
}
LeaveCriticalSection(&csMap);
return NULL;
}
//Function to delete an object.
void deleteChannel(UINT accessKey)
{
EnterCriticalSection(&csMap);
channelMapT::iterator myIt=channelMap.find(accessKey);
if(myIt!=channelMap.end())
{
ChannelContext* pContext=myIt->second;
EnterCriticalSection(&pContext->cs);
//Delete the entry.
channelMap.erase(myIt);
delete pContext->pChannel;
LeaveCriticalSection(&pContext->cs);
delete pContext;
}
LeaveCriticalSection(&csMap);
}</pre>
Thank you in advance. Note, if someone have ideas how Windows manages its internal structure then please enlignten me.
I think that HANDLE just act like the accessKey : it hides the pointer addresss. But what about synchrnoization ?
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
modified on Tuesday, April 7, 2009 4:07 AM
|
|
|
|
|
Ahmed Charfeddine wrote: typedef struct ChannelContext
{
CChannel* pChannel;
CCriticalSection cs;
} ChannelContext;
the CCriticalSection should be a pointer right?
What about using shared pointers? Check boost::shared_ptr[^]
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Thank you for your reply,
According to your suggestion, threads will act on the shared pointers instead of the pointers to the actual objects in memory.
Does that help avoid the program to crash when I explicitly delete an object and that another thread that tries to use it afterward ?
And what about synchronization ? If a thread is trying to use a share pointer, am I garanteed that the other thread that tries to access the same share pointer is blocked ?
Sarath. wrote: the CCriticalSection should be a pointer right?
In my case no.
I have anothe global function that creates a CChanel object. all it has to do is to create a new CChannelContext structure, initialize the CriticalSection and set the pChannel member to the address of the newly created CChannel then add the whol thing to the map. So in my point of view, creating the CriticalSection with the new operator or on the heap, is the same.
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
|
|
|
|
|
Hello,
When I maximize MainFrame and then the child frame, the child frame window has the colors from the Mainframe window. It is as if the background of mainframe is seen in the child window.
What must the problem ?
Priya
|
|
|
|
|
Call the UpdateWindow method on the child window after maximizing.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|