|
I have a class that subclass from CEdit .Now I want to subclass from this class.After I make generic class and subclass it from that class,after compiling I got many errors in my base class.Also I got an error that:
error C2504: 'CEdit' : base class undefined
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Make sure whether you include MFC header file
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
XSimon wrote:
MFC header
Could you name them please?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
I declare this below data.
[code]
CArray<unsigned char,="" unsigned="" char=""> m_data1, m_data2, m_data3, m_data4;
[/code]
I want to to sort m_data1, m_data2, m_data3, m_data4.
If you know how to do that, please tell me.
Thank you very much.
|
|
|
|
|
I honestly don't know, but this is one major reason why you'd be better off to ditch CArray for std::vector. I have a number of articles here on CP with regard to the STL to get you started.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
CArray doesn't have a built-in Sort function. So you'd either have to write your own (using Quicksort and friends).
I'd suggest just scrapping the whole idea of using CArray (and MFC collections) and move onto std::vector and std::sort (i used to be an MFC junkie, but I've been converted to STL ).
|
|
|
|
|
Hello!
Since you already have gotten a couple of suggestion to use STL, I thought I give you what you asked for
Here on CodeProject there is a article about this!
Mr. Martin Ziacek has described how to use quicksort together with CArray.
http://www.codeproject.com/cpp/qarray.asp
Mike Eriksson
Sonork 100.21825
|
|
|
|
|
I have a class that base from anothrt one.I want its constructor be a base class constructor.How can I do it?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
|
Thanks
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hello,
does anybody know how to get the unique LAN-ID from MFC C++?
I have to code a license control tool...
Thank you for answers!
Andreas Niedermeier
==----===
|
|
|
|
|
You can use the physical address of your net adapter
int CTcpCfg::GetMacAddress(LPMAC_ADDRESS pMacAddr)
{
NCB ncb;
UCHAR uRetCode;
int num = 0;
LANA_ENUM lana_enum;
memset(&ncb, 0, sizeof(ncb) );
ncb.ncb_command = NCBENUM;
ncb.ncb_buffer = (unsigned char *)&lana_enum;
ncb.ncb_length = sizeof(lana_enum);
//ÏòÍø¿¨·¢ËÍNCBENUMÃüÁî,ÒÔ»ñÈ¡µ±Ç°»úÆ÷µÄÍø¿¨ÐÅÏ¢,ÈçÓжàÉÙ¸öÍø¿¨
//ÿÕÅÍø¿¨µÄ±àºÅµÈ
uRetCode = Netbios(&ncb);
if (uRetCode == 0)
{
num = lana_enum.length;
//¶ÔÿһÕÅÍø¿¨,ÒÔÆäÍø¿¨±àºÅΪÊäÈë±àºÅ,»ñÈ¡ÆäMACµØÖ·
for (int i = 0; i < num; i++)
{
ASTAT Adapter;
if(GetAddressByIndex(lana_enum.lana[i],Adapter) == 0)
{
pMacAddr[i].b1 = Adapter.adapt.adapter_address[0];
pMacAddr[i].b2 = Adapter.adapt.adapter_address[1];
pMacAddr[i].b3 = Adapter.adapt.adapter_address[2];
pMacAddr[i].b4 = Adapter.adapt.adapter_address[3];
pMacAddr[i].b5 = Adapter.adapt.adapter_address[4];
pMacAddr[i].b6 = Adapter.adapt.adapter_address[5];
}
}
}
return num;
}
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
Hello;
I'm in trouble with setitem method of CListCtrl. Actually, i have set the item value, but it has not get the correct value at following code part.
<br />
int n=0, idx=0;<br />
CString pbBuffer;<br />
char chngval;<br />
char hexval[2];<br />
char* out;<br />
out = (char*)malloc(sizeof(char) * 41);<br />
memset(out, 0x00000000, sizeof(char) * 41);<br />
<br />
while(m_cPeriodList.GetCount()!=idx)<br />
{<br />
m_cPeriodList.GetText(idx, pbBuffer);<br />
n=wcstol(pbBuffer, '\0', 10);<br />
memset(hexval, 0, sizeof(hexval));<br />
for (int i=1; i>=0; i--) {<br />
chngval="0123456789ABCDEF"[((n >> i*4) & 0xF)];<br />
memcpy(hexval+(1-i), &chngval, sizeof(char));<br />
}<br />
hexval[2]='\0';<br />
idx++;<br />
strcat(out, hexval);<br />
}<br />
<br />
int zerocounter=(40-(idx*2))/2;<br />
for(int temp_idx=0; zerocounter!=temp_idx; temp_idx++)<br />
strcat(out, "00");<br />
<br />
lvi->mask = LVIF_TEXT;<br />
lvi->iSubItem = 3;<br />
lvi->iItem = 0;<br />
lvi->pszText = (LPTSTR)(LPCTSTR)out;<br />
m_list->SetItem(lvi);<br />
szTemp.Empty();<br />
<br />
free(out);<br />
Everythings going fine until "lvi->pszText = (LPTSTR)(LPCTSTR)out;". At this statement, the out value has "B0B0B0B0", but lvi->pszText show own value like "?????????????". What does it mean?
Thank you
|
|
|
|
|
Why are you mixing C and C++ ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Just a sample for myself. Sorry.
|
|
|
|
|
I've changed my code to C++ and life is good now.
INT iHexIdx=0; // Hex convertion loop index
LONG lRowIdx=0; // Row index pointer
LONG lRowLongValue=0; // Converted row value
CString rTemp; // Temporary value
CString rString; // Listbox selected item text
// Loop until end of list
while(m_cPeriodList.GetCount()!=lRowIdx)
{
// Get text from listbox
m_cPeriodList.GetText(lRowIdx, rString);
// Convert CString listbox value to LONG
lRowLongValue = _wtoi(rString.GetBuffer(rString.GetLength()));
// Convert byte to hex
for(iHexIdx=1; iHexIdx>=0; iHexIdx--)
rTemp.Insert((rTemp.GetLength()+(1-iHexIdx)),("0123456789ABCDEF"[((lRowLongValue >> iHexIdx*4) & 0xF)]));
// Increase row index
lRowIdx++;
}
// Fill empty bytes with 0
for(iHexIdx=rTemp.GetLength(); iHexIdx<=40; iHexIdx++)
rTemp.Insert(iHexIdx, _T("0"));
// Set comment
lvi->mask = LVIF_TEXT;
lvi->iSubItem = 3;
lvi->iItem = 0;
lvi->pszText = (LPTSTR)(LPCTSTR)rTemp;
m_list->SetItem(lvi);
|
|
|
|
|
How to Handle Escape button in Modeless Dialog
Thanks
Uday
|
|
|
|
|
You will need to use the IsDialogMessage function in your message loop to dispatch your message to the dialog rather than DispatchMessage.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
What's the fastest and easiest way to convert a BSTR to a MFC CString ?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
donno whether this is the fastest or easiest, but I've been coding it like this:
CString str = static_cast<LPCTSTR>( bstr );
|
|
|
|
|
Does that work ? I don't see how it can.....
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
|
_bstr_t is a wrapper class that does the conversion for you, so you can do this:
CString s((_bstr_t)BSTR);
This will create a _bstr_t, which will return a char * to the CString constructor.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
sorry i forgot, that bstr is of type _bstr_t. u r rite, Chris.
|
|
|
|
|
No worries
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|