|
thnx .. but .. no ...
the problem is still here ... and exactly is that .. that the process doesn't enter in the function .. so the problem is not what I write inside it .. but why the MeasureItem has not called ??????
|
|
|
|
|
Is myObj of type CListBox ? What is "ListBoxExtended?" Have you declared MeasureItem() as virtual in the listbox's declaration? What does the rest of the call to Create() look like?
|
|
|
|
|
ok .. I'll try to explane better ...
I have 2 Classes ...
class MCIconListBoxDesc : public CListBox // new ListBox class
class MCIconListBoxDescItem : public CObject // items for the list box
in MCIconListBoxDesc.h I have these function
virtual void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/);
virtual void MeasureItem(LPMEASUREITEMSTRUCT /*lpMeasureItemStruct*/);
then .. in the oninitdialog function of the project i write these lines to create new component
//m_lb is a MCIconListBoxDesc object
CRect lbRC(10,10,300,400);
m_lb.Create(WS_BORDER | WS_CHILD | WS_VISIBLE | WS_VSCROLL | LBS_DISABLENOSCROLL | LBS_OWNERDRAWVARIABLE, lbRC , this , IDC_MCLB);
then in MCIconListBoxDesc.h i write a function called
void AddNewMessage(MCIconListBoxDescItem *p_item);
//definition
void MCIconListBoxDesc::AddNewMessage(MCIconListBoxDescItem *p_item)
{
m_obArray.Add(p_item); // nothing important for my problem
this->AddString(p_item->GetDateTime());
this->SetTopIndex(this->GetCount()-1);
}
then ... when I try to execute and debug application, I put a breack point at the begin of the MeasureItem function but this not stop the process .. and it goes directly at DrawItem function.
how can I do ?
I tryed also to set MeasureItem as WM_MEASUREITEM
please someone help me
|
|
|
|
|
Remarks
By default, this method does nothing. Override this method and fill in the MEASUREITEMSTRUCT structure to inform Windows of the list-box dimensions. If the list box is created with the LBS_OWNERDRAWVARIABLE style, the framework calls this method for each item in the list box. Otherwise, this method is called only once.
|
|
|
|
|
IYes .. I've just red Visual Studio Guide ... and as u can see in the create Method I've wrote LBS_OWNERDRAWVARIABLE .... but the framework NEVER calls MeasureItem
|
|
|
|
|
Hi there!
And here is my question How to get the ID of a HTREEITEM?
I inserted Items with - e.g. - InsertItem( TVIF_TEXT, strPaket, 0, 0, 0, 0, iID, hParent, TVI_SORT );
Then i used GetSelectedItem() and GetItem() to get the placed ID (iID) ... but i alway get 0 as result of lParam of the TVITEM structure
|
|
|
|
|
GetItemData() is a much better function for what you want.
That being said, how are you using GetItem()? Are you setting the TVITEM data members properly before you call GetItem()? You have to set hItem to the item handle you got from GetSelectedItem() and mask to TVIF_PARAM.
HTREEITEM item = GetSelectedItem();
TVITEM tv = {0};
tv.mask = TVIF_PARAM;
tv.hItem = item;
if (GetItem(&tv))
UINT iID = tv.lParam;
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I found my error
I forgot to add the parameter TVIF_PARAM in the InsertItem method
|
|
|
|
|
hi!
i'm working on my first mfc-app having the following problem.
i got some arrays of classes as members of the main dialog. this works fine, only if i now add any other member (like an vector<int>) to one of the classes (which i do not use yet, they are only created and nothing is done with them yet), the programm either doesn't even start anymore, or exits with access-violation. or it works untill iquit the programm and then it throws the access violation. the debugger only brings some stuff from the (i think) main dialog constructer or destructor (depends), which i don't know what to read from.
so i guess there is some problem with the memory allocation of the main dialog because of the (not too big) members i attach. but i don't know how to solve it.
thanx for help.
alexis
|
|
|
|
|
How about some relevant code snippets?
|
|
|
|
|
that's how the class looks:
class CRawData
{
public:
Vector m_vEnergy;
Vector m_vIntensity;
Vector m_vFilter;
Vector m_vPower;
int m_iType;
vector<int> m_vIndex;
vector<int> m_vFilterAtIndex;
Vector m_vFactorAtIndex;
CRawData();
virtual ~CRawData();
void resize(int size);
void CopyFromRawData(CRawData &rawData);
bool GetFilterPoints();
bool CalcFilter();
bool FilterSteps();
};
a vector of this class is member in my main dialog. with m_vIndex, m_vFactorAtIndex and m_vFilterAtIndex i get the problem, removing them from the class solves the problem
(Vector is a typedef vector<double>).
like this:
class CRHContourDlg : public CDialog
{
// Construction
public:
vector<CString> m_sDataFile;
vector<CRawData> m_rRawData;
vector<CRawData> m_dData;
CRHContourDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CRHContourDlg)
enum { IDD = IDD_RHCONTOUR_DIALOG };
CButton m_wndFilterCheckBox;
CButton m_wndPLType;
CEdit m_sFilterExt;
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRHContourDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CRHContourDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnDestroy();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnQuit();
afx_msg void OnLoadDataFiles();
afx_msg void OnPlType1();
afx_msg void OnPlType2();
afx_msg void OnFilterSteps();
afx_msg void OnSaveFilterCheck();
afx_msg void OnChangeFilterExtension();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CGraphDlg m_dlgGraph;
};
if i now remove m_dData it works fine, like you see it it gives a access violation in the very beginning (not even showing the dialog). as i wrote already nothing is done with m_dData yet.
by the way: of course no complier errors ...
alexis
|
|
|
|
|
I tried your code as-is and it compiled and ran fine. What is the problem you are seeing? It must be something you are doing after the dialog box is displayed that is causing an access violation at shutdown.
|
|
|
|
|
Hi folks,
i have a problem with CString definitions; in a class ( Non-MFC class) i defined some private CString members. Now I added one more CString member; but when I was storing information to another CString member the value of the new defined CString held the same information. Looking at these members while debigging I saw that both members have the same address - how is that possible? I deleted one of the members and made new defintions - nothing changed....
What's going wrong?
I am using MS VC++ 6.0 with Service Pack 5
Thanks in advance
Michael Delvos
CEO Central European International Virtual Airways
http://www.fs2002.de
|
|
|
|
|
Show us the class definition.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
The member m_sBarcode and m_sFileNameLogo share the same address; more -whenever a define a CString within a member function, it has - immediately after its contruction - the same address and content as m_sFilenameLogo...
// Bon.h: Schnittstelle für die Klasse CBon.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_BON_H__1DEC1370_A4CA_4906_9AB1_C7F7D679BEC0__INCLUDED_)
#define AFX_BON_H__1DEC1370_A4CA_4906_9AB1_C7F7D679BEC0__INCLUDED_
#include "Printer.h" // Hinzugefügt von der Klassenansicht
#include "extern.h"
#include "winspool.h"
#include "Registry.h"
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CBon
{
public:
long m_JobId;
bool Initialize();
bool Initialize( CString p_sPrinterName );
bool CheckEanDataBon( long p_lSize, LPTSTR p_lpData );
void SetTestPrint();
bool BonDrucken();
bool BonAufbereiten();
bool SendDataBon( CString p_sData );
char GetImmediateStatusByte();
int GetImmediateStatus();
bool HasPrinterError();
long GetJobId( void );
CBon();
virtual ~CBon();
private:
CString m_sBarcode;
CString m_sFileNameLogo;
CPrinter m_Printer;
CStringArray m_sZeilen;
CString m_sData;
CPoint m_PrintPos;
int m_iLinesPrinted;
bool m_fTestPrint;
DWORD m_dwLogoDruck;
void GetWords( CString, CStringArray* );
bool ZeileAnalysieren( CString p_sZeile );
bool ZeileAufbereiten( CString p_sZeile );
int GetNumericValue( CString p_sPara );
CString SetSteuercode( CString p_sSteuerCode, CString p_sData );
CString GetSteuercode( DWORD p_dwSize, LPTSTR p_szData );
void CreateJobId( void );
};
#endif // !defined(AFX_BON_H__1DEC1370_A4CA_4906_9AB1_C7F7D679BEC0__INCLUDED_)
Michael Delvos
CEO Central European International Virtual Airways
http://www.fs2002.de
|
|
|
|
|
So if you store a string to m_sBarcode , m_sFileNameLogo gets changed as well?
Have you tried doing a rebuild-all? Sometimes the incremental compilation gets a little screwed.
Other than that, I can't think of any reasons why it would be doing this...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Its probably just CStrings reference counting going a bit screwy. VC++ 7 changed the CString class from a reference counted string to derive from a template char array to get away from some buggy elements, I'm guessing this is one of them.
|
|
|
|
|
What does the following produce?
CBon::CBon()
{
TRACE("m_sBarcode = %#x\n", &m_sBarcode);
TRACE("m_sFileNameLogo = %#x\n", &m_sFileNameLogo);
}
|
|
|
|
|
Well - thx to you all - I think it was a buggy project file or something like that - i put my classes into a new project and it works
Thx for your help guys
Michael Delvos
CEO Central European International Virtual Airways
http://www.fs2002.de
|
|
|
|
|
I need XModem class for Visual C++.
|
|
|
|
|
A Google search for "XModem class for Visual C++" works well for me.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Is there any API in VC++, that when called by the main thread, the main thread should wait until all the threads created by this main thread exit.
|
|
|
|
|
Have you looked at WaitForSingleObject() and related functions?
|
|
|
|
|
WaitForMultipleObjects()
Check out MSDN.
|
|
|
|
|
Hello, Sir:
I have a touble with CPU test. And I am working CPU Test. That test item have MCA ID Test, Numeric Coprocessor Test and FPU Test. Because I know a little about those. Can somepople help me? Maybe you have some about those. Can you help me? Or you can tell me some article about those? Thank in advance.
|
|
|
|