|
Dhiraj kumar Saini wrote: Still its giving error in the InsertItem() and SetItemText() function.
Please Tell me what to do.
MSDN on iSubItem...
iSubItem
One-based index of the subitem to which this structure refers, or zero if this structure refers to an item rather than a subitem.
You are giving zero based, that should be the problem if it's a report style list.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi,
Actually i want ClistControl with only one column to show one data data. It does not contain anyother sub item. So iSubItem is given value zero and not one.
Dont know what to do.
Thanks
Dhiraj Kumar Saini
|
|
|
|
|
From where you are calling method UpdateFootPrintsForVisitor from your code?
Is the m_lstGetFootPrints object is valid at that time?
Just try ::IsWindow(m_lstGetFootPrints.m_hWnd) to make sure that the control is created and ready to work.
cheers
Varghese Paul
|
|
|
|
|
U r gr8
It worked ::IsWindow(m_lstGetFootPrints.m_hWnd)
Thanks a lot.
u r genius
Dhiraj
|
|
|
|
|
Dhiraj kumar Saini wrote: But it is giving runtime error...
Are we supposed to guess what this is?
"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
|
|
|
|
|
Hi,
I am developing a dialog application. In my dialog i have a tabcontrol which is having two tab pages. I have shortcut like Alt+x for my dialog. If the focus is in propertypage these shortcuts are not working. What should i do to enable those?
|
|
|
|
|
|
GetMessage and PeekMessage are used to get a message from message queue while PostMessage is used to post a message.
The major difference between GetMessage and PeekMessage is that GetMessage doesn't return until it finds a message to retrieve from the
Message Queue and PeekMessage() returns immediately weather there are any messages or not.
While PostMessage is used to post a message to window and it returns immediately without waiting for the response.
Manish Agarwal
manish.k.agarwal @ gmail DOT com
|
|
|
|
|
SendMessage
Which the same as PostMessage except it blocks until the message has been processed by the window.
|
|
|
|
|
Do you feel the documentation about [^] not satisfactory?
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 am trying to launch a dialog in modal-less mode but am getting error:
Bool CDialog::Create cannot convert from int to LPCTSTR but the tutorials says to do it this way. Any help appreciated. Here my prog:
THIS IS A MFC DLL
MAIN APP:-
// Ai.cpp : Defines the initialization routines for the DLL.
#include "stdafx.h"
#include "Ai.h"
#include "ProgressDialog.h"
BOOL CAiApp::InitInstance() {
CProgressDialog* MLDlg= new CProgressDialog;
MLDlg->Create(IDD_TRACEINFO, this);
MLDlg->ShowWindow(SW_SHOW);
return true;
}
---------------------------------------------------------------------
ProgressDialog header:-
#pragma once
// CProgressDialog dialog
class CProgressDialog : public CDialog {
DECLARE_DYNAMIC(CProgressDialog)
public:
CProgressDialog(CWnd* pParent = NULL); // standard constructor
virtual ~CProgressDialog();
// Dialog Data
enum { IDD = IDD_TRACEINFO };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedOk();
}; // END CLASS
---------------------------------------------------------------------
// ProgressDialog.cpp : implementation file
//
#include "stdafx.h"
#include "Ai.h"
#include "ProgressDialog.h"
// CProgress dialog
IMPLEMENT_DYNAMIC(CProgressDialog, CDialog)
CProgressDialog::CProgressDialog(CWnd* pParent /*=NULL*/)
: CDialog(CProgressDialog::IDD, pParent) {
}
CProgressDialog::~CProgressDialog(){
}
void CProgressDialog::DoDataExchange(CDataExchange* pDX){
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CProgressDialog, CDialog)
ON_BN_CLICKED(IDOK, &CProgressDialog::OnBnClickedOk)
END_MESSAGE_MAP()
// CProgressDialog message handlers
void CProgressDialog::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
OnOK();
}
---------------------------------------------------------------------
RESOURCE FILE :-
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Ai.rc
//
#define IDP_SOCKETS_INIT_FAILED 101
#define IDD_CONFIGURE_DIALOG 1000
#define IDC_TXMESSAGE 1000
#define IDD_TRACEINFO 1001
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 1002
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 1000
#endif
#endif
thanks
|
|
|
|
|
limesp wrote: Bool CDialog::Create cannot convert from int to LPCTSTR
Most probably you should pass the id of the dialog by using MAKEINTRESOURCE(DialogId) , this will do the trick.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
But what happed to the BOOL Create(UINT nIDTemplate, CWnd* pParentWnd = NULL); function?
|
|
|
|
|
Naveen wrote: BOOL Create(UINT nIDTemplate, CWnd* pParentWnd = NULL);
Yeah, me too thought about it, I can still see it in the headers though. Pretty strange that he got that error.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Found out the problem.
the other create overload is the one that i wanted
create(dialog number, handle)
because i am using 'this' for the handle but a dll does not have a "Form" handle so it defaulted to the overload that gave me that problem
create(template, handle)
so I use the default null for the handler.
It worked.
|
|
|
|
|
Hello everyone,
When using mapvariable[somekey] = somevalue to insert into a map variable, how to check whether there is conflicting key value in the map in an elegant way?
thanks in advance,
George
|
|
|
|
|
George_George wrote: mapvariable[somekey] = somevalue
[] operator already does a lookup before inserting. Or else just do a map find before calling [] operator .
For inserting an element into a map call insert function instead of [] operator .
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Sorry, Nibu. I think I have not made myself understood. My question is, how to check whether we insert a new key/value pair or overwrite the same key with new value if we use [] operator.
I know using insert could check whether overwriting or not.
regards,
George
|
|
|
|
|
George_George wrote: My question is, how to check whether we insert a new key/value pair or overwrite the same key with new value if we use [] operator.
You don't need to check, that happens automagically IMO.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
I am so bad to express my idea and question.
I want to ask my question in another way -- "using [] could never tell us whether we insert new pair or overwriting an old pair", correct?
regards,
George
|
|
|
|
|
George_George wrote: using [] could never tell us whether we insert new pair or overwriting an old pair
Yes IMO!
Source code for [] operator of std::map looks likewise...
mapped_type& operator[](const key_type& _Keyval)
{
iterator _Where = this->lower_bound(_Keyval);
if ( _Where == this->end() ||
this->comp(_Keyval, this->_Key(_Where._Mynode())))
_Where = this->insert(_Where,
value_type(_Keyval, mapped_type()));
return ((*_Where).second);
}
Take a look at the comment line and the return value, so we can't find out whether we have one or we don't have one, unless we do an explicit find. Also note that it's returning a reference.
George_George wrote: I am so bad to express my idea and question.
Could be my problem too.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Sorry my English is not very good. You mean there is no way to check whether insert a new element or overwriting existing element if we use [] operator?
regards,
George
|
|
|
|
|
George_George wrote: Sorry my English is not very good. You mean there is no way to check whether insert a new element or overwriting existing element if we use [] operator?
Yes!
From MSDN...
If the argument key value is not found, then it is inserted along with the default value of the data type.
operator[] may be used to insert elements into a map m using m[_Key] = DataValue; where DataValue is the value of the mapped_type of the element with a key value of _Key.
When using operator[] to insert elements, the returned reference does not indicate whether an insertion is changing a pre-existing element or creating a new one. The member functions find and insert can be used to determine whether an element with a specified key is already present before an insertion.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Thanks for your great comment, Nibu!
regards,
George
|
|
|
|
|
George_George wrote: When using mapvariable[somekey] = somevalue to insert into a map variable, how to check whether there is conflicting key value in the map in an elegant way?
You can use map::find() to check whether the key is already present in map. Well, the [] operator will overwrite the existing entry if the key already exists.
OT: Be a little careful while using [] operator with map, especially while reading from map. For instance, if you try to get a key-value which is not in map, it create a new entry and return the default value. For instance,
map<cstring,cstring> TempMap;
CString LookupKey = _T("key");
CString Value = TempMap[LookupKey];
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|