Click here to Skip to main content
15,898,936 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Crc 32 bit Pin
Jochen Arndt20-Mar-17 2:36
professionalJochen Arndt20-Mar-17 2:36 
QuestionCatch double click on MDI client CMDIFrameWndEx Pin
_Flaviu16-Mar-17 22:19
_Flaviu16-Mar-17 22:19 
AnswerRe: Catch double click on MDI client CMDIFrameWndEx Pin
Richard MacCutchan16-Mar-17 23:46
mveRichard MacCutchan16-Mar-17 23:46 
GeneralRe: Catch double click on MDI client CMDIFrameWndEx Pin
_Flaviu17-Mar-17 0:02
_Flaviu17-Mar-17 0:02 
GeneralRe: Catch double click on MDI client CMDIFrameWndEx Pin
Richard MacCutchan17-Mar-17 0:26
mveRichard MacCutchan17-Mar-17 0:26 
GeneralRe: Catch double click on MDI client CMDIFrameWndEx Pin
_Flaviu17-Mar-17 0:40
_Flaviu17-Mar-17 0:40 
AnswerRe: Catch double click on MDI client CMDIFrameWndEx Pin
Victor Nijegorodov18-Mar-17 4:09
Victor Nijegorodov18-Mar-17 4:09 
QuestionHow to use a variable declared in another class in Visual C++ Pin
lolici16-Mar-17 3:17
lolici16-Mar-17 3:17 
Hello everyone,
I have created a list view(Declared in CDataDialog) with data . I want the list view to have as rows-cells as the conductors so I used :for (int i = 1; i<= m_DialogCon; i++) (m_DialogCon is the variable which representes the number of conductors but was declared in CFeaturesDialog). How could I use m_DialogCon variable in CDataDialog?
Here is the code:

void CDataDialog::InsertItems()
{
	HWND hWnd = ::GetDlgItem(m_hWnd, IDC_LIST1);

	// Set the LVCOLUMN structure with the required 
	// column information
	LVCOLUMN list;
	list.mask = LVCF_TEXT | LVCF_WIDTH |
		LVCF_FMT | LVCF_SUBITEM;
	list.fmt = LVCFMT_LEFT;
	list.cx = 50;
	list.pszText = L"Conductor";
	list.iSubItem = 0;
	//Inserts the column
	::SendMessage(hWnd, LVM_INSERTCOLUMN,
		(WPARAM)0, (WPARAM)&list);

	list.cx = 100;
	list.pszText = L"Resistivity";
	list.iSubItem = 1;
	::SendMessage(hWnd, LVM_INSERTCOLUMN,
		(WPARAM)1, (WPARAM)&list);

	list.cx = 100;
	list.pszText = L"Permeability";
	list.iSubItem = 2;
	::SendMessage(hWnd, LVM_INSERTCOLUMN,
		(WPARAM)2, (WPARAM)&list);

	list.cx = 100;
	list.pszText = L"Outer Diameter";
	list.iSubItem = 3;
	::SendMessage(hWnd, LVM_INSERTCOLUMN,
		(WPARAM)3, (WPARAM)&list);

	list.cx = 100;
	list.pszText = L"Inner Diameter";
	list.iSubItem = 4;
	::SendMessage(hWnd, LVM_INSERTCOLUMN,
		(WPARAM)4, (WPARAM)&list);

	list.cx = 100;
	list.pszText = L"Rdc";
	list.iSubItem = 5;
	::SendMessage(hWnd, LVM_INSERTCOLUMN,
		(WPARAM)5, (WPARAM)&list);

	list.cx = 100;
	list.pszText = L"x component";
	list.iSubItem = 6;
	::SendMessage(hWnd, LVM_INSERTCOLUMN,
		(WPARAM)6, (WPARAM)&list);

	list.cx = 100;
	list.pszText = L"y component";
	list.iSubItem = 7;
	::SendMessage(hWnd, LVM_INSERTCOLUMN,
		(WPARAM)7, (WPARAM)&list);
	
	// Inserts first Row with four columns .
	for (int i = 1; i<= m_DialogCon; i++)//here is the variable m_DialogCon                               
	                                     //from CFeaturesDialog
        {
		SetCell(hWnd, L"1", 0, 0);
		SetCell(hWnd, L"0.0000386063", 0, 1);
		SetCell(hWnd, L"1", 0, 2);
		SetCell(hWnd, L"0.025146", 0, 3);
		SetCell(hWnd, L"0.00971", 0, 4);
		SetCell(hWnd, L"0.09136", 0, 5);
		SetCell(hWnd, L"0", 0, 6);
		SetCell(hWnd, L"15.24", 0, 7);
	}
}


void CDataDialog::SetCell(HWND hWnd1,
	CString value, int nRow, int nCol)
{
	TCHAR     szString[256];
	wsprintf(szString, value, 0);

	//Fill the LVITEM structure with the 
	//values given as parameters.
	LVITEM lvItem;
	lvItem.mask = LVIF_TEXT;
	lvItem.iItem = nRow;
	lvItem.pszText = szString;
	lvItem.iSubItem = nCol;
	if (nCol >0)
		//set the value of listItem
		::SendMessage(hWnd1, LVM_SETITEM,
		(WPARAM)0, (WPARAM)&lvItem);
	else
		//Insert the value into List
		ListView_InsertItem(hWnd1, &lvItem);

}


class CDataDialog : public CDialog
{
	DECLARE_DYNAMIC(CDataDialog)
	
public:
	CDataDialog(CWnd* pParent = NULL);   // standard constructor
	virtual ~CDataDialog();

// Dialog Data
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_DIALOG2 };
#endif

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedOk();
	afx_msg void OnBnClickedExit();
	void InsertItems();
	void SetCell(HWND hWnd1, CString value, int nRow, int nCol);
	CString GetItemText(HWND hWnd, int nItem, int nSubItem) const;
	afx_msg void OnClickList1(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnOK();
	BOOL OnInitDialog();
	int nItem;
	int nSubItem;
};

AnswerRe: How to use a variable declared in another class in Visual C++ Pin
Jochen Arndt16-Mar-17 3:32
professionalJochen Arndt16-Mar-17 3:32 
GeneralRe: How to use a variable declared in another class in Visual C++ Pin
lolici16-Mar-17 4:04
lolici16-Mar-17 4:04 
GeneralRe: How to use a variable declared in another class in Visual C++ Pin
Jochen Arndt16-Mar-17 4:18
professionalJochen Arndt16-Mar-17 4:18 
GeneralRe: How to use a variable declared in another class in Visual C++ Pin
lolici16-Mar-17 5:35
lolici16-Mar-17 5:35 
GeneralRe: How to use a variable declared in another class in Visual C++ Pin
Jochen Arndt16-Mar-17 5:44
professionalJochen Arndt16-Mar-17 5:44 
GeneralRe: How to use a variable declared in another class in Visual C++ Pin
lolici16-Mar-17 6:49
lolici16-Mar-17 6:49 
GeneralRe: How to use a variable declared in another class in Visual C++ Pin
lolici16-Mar-17 13:32
lolici16-Mar-17 13:32 
GeneralRe: How to use a variable declared in another class in Visual C++ Pin
Jochen Arndt16-Mar-17 21:47
professionalJochen Arndt16-Mar-17 21:47 
AnswerRe: How to use a variable declared in another class in Visual C++ Pin
Munchies_Matt16-Mar-17 6:21
Munchies_Matt16-Mar-17 6:21 
PraiseRe: How to use a variable declared in another class in Visual C++ Pin
_Flaviu16-Mar-17 21:37
_Flaviu16-Mar-17 21:37 
GeneralRe: How to use a variable declared in another class in Visual C++ Pin
Munchies_Matt16-Mar-17 21:44
Munchies_Matt16-Mar-17 21:44 
GeneralRe: How to use a variable declared in another class in Visual C++ Pin
lolici17-Mar-17 11:23
lolici17-Mar-17 11:23 
QuestionIs it possible to find if an application is encrypted at runtime Pin
manoharbalu15-Mar-17 2:42
manoharbalu15-Mar-17 2:42 
AnswerRe: Is it possible to find if an application is encrypted at runtime Pin
Jochen Arndt15-Mar-17 3:00
professionalJochen Arndt15-Mar-17 3:00 
GeneralRe: Is it possible to find if an application is encrypted at runtime Pin
manoharbalu15-Mar-17 3:16
manoharbalu15-Mar-17 3:16 
GeneralRe: Is it possible to find if an application is encrypted at runtime Pin
Jochen Arndt15-Mar-17 3:28
professionalJochen Arndt15-Mar-17 3:28 
AnswerRe: Is it possible to find if an application is encrypted at runtime Pin
Randor 15-Mar-17 13:21
professional Randor 15-Mar-17 13:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.