|
Hi all,
I used a list control with check box, and image list.
My aim is check box is in first column and image in second column.
I did as i want.. but one problem is
first image in image list is shown in first column along with check box?
I need to check box alone in first column..
Thanks a lot.
|
|
|
|
|
vicky00000 wrote: My aim is check box is in first column and image in second column.
Have you tried LVS_EX_SUBITEMIMAGES and CListCtrl::SetExtendedStyle ?
|
|
|
|
|
Thnks for your replay...
i already used? My question is how to avoid the image appended with check box in first column....?
|
|
|
|
|
Hi all!
I'm developing an console application with MFC support. Now I meet an exception when I execute the following code:
CBitmap *bitmap;
CDC memDC;
CRect rect;
CWnd *pWnd=m_pWndHide;
memDC.CreateCompatibleDC(&m_hDC);
int height = CAH_glo_y * width / CAH_glo_x;
bitmap = new CBitmap();
bitmap->CreateCompatibleBitmap(&m_hDC, width, height );
CBitmap* pOldBitmap = memDC.SelectObject(bitmap);
memDC.PatBlt(0, 0, width,height, WHITENESS);
...
I trace this error into a source file named SBHEAP.c in MFC then. The function stopped in is __sbh_alloc_block. The related code is following:
...
pEntry->pEntryNext = pHead->pEntryNext;
pEntry->pEntryPrev = pHead;
pHead->pEntryNext = pEntry;
pEntry->pEntryNext->pEntryPrev = pEntry;
...
I watch the value of pHead->pEntryNext . It is NULL. So I can't access it. But I don't know why and how to resolve it. This code will be executed many times before. But it is wrong when the 3 times. If someone can tell me or give me some good advice, I will be very glad. Thanks!
Regards
whiteclouds
|
|
|
|
|
whiteclouds wrote: bitmap->CreateCompatibleBitmap(&m_hDC, width, height );//(&dc, width, height );
Note that if width and height is too big then CreateCompatibleBitmap does fail. Also how did you get m_hDC. Is this a valid DC?
|
|
|
|
|
Hi, thomas!
Thanks for your reply.
I think I had found the reason. After I delete some variables that aren't be used any more, the exception is missing. But another exception is occur same as this when I use the code following:
time_t ltime;
struct tm *gmt;
png_time ttime;
time (<ime);
gmt = gmtime (<ime);
png_convert_from_struct_tm (&ttime, gmt);
png_set_tIME (png_ptr, info_ptr, &ttime);
I trace this exception into MFC and I found when a function named _mlock was invoked in the __tzset function, the exception occur. The related code like this:
_mlock( _TIME_LOCK );
I don't know the reason and hope you or others can give me some suggestion. Thank you!
Regards!
whiteclouds
|
|
|
|
|
How can I assign to a certain processor a process?
Can I list the processes assigned to a certain processor?
If possible, in VC++6
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
RomTibi wrote: How can I assign to a certain processor a process?
You can assign a process to selected processor(s) with SetProcessAffinityMask().
RomTibi wrote: Can I list the processes assigned to a certain processor?
You could enumerate the current processes and check which processors each
is set to use, perhaps using these functions:
EnumProcesses()
OpenProcess()
GetProcessAffinityMask()
CloseHandle()
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks a lot!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Hi,
Could someone please let me know why my code can not pass compilation? (VC++9.0,vista 64-bit)
The problems happens in the "<<" operator overload function. It seems my code can not pass some constness check.
#include <map>
#include <vector>
#include <iterator>
#include <algorithm>
#include <iostream>
using namespace std;
typedef pair<string,int> pairSI;
struct StringToSIPair
{
explicit StringToSIPair(int val) { intVal = val; }
pairSI operator () (string str)
{
pairSI psi = make_pair(str, intVal);
return psi;
}
int intVal;
};
void VecToMap(vector<string> &vecStr, int iniVal, map<string,int> &siMap)
{
transform(vecStr.begin(), vecStr.end(), inserter(siMap, siMap.begin()), StringToSIPair(iniVal));
}
ostream & operator << (ostream &out, map<string, int> &siMap)
{
for(map<string, int>::iterator it = siMap.begin(); it != siMap.end(); ++it)
{
out<<"key: "<<it->first<<" value: "<<it->second<<endl; // the compiler said there is a conversion problem
}
return out;
}
int main()
{
map<string,int> siMap;
vector<string> strVec;
strVec.push_back("bob");
strVec.push_back("alex");
strVec.push_back("alal");
VecToMap(strVec, 4, siMap);
cout<<siMap<<endl;
return 0;
}
regards,
Bob
|
|
|
|
|
First, I would recommend defining a type for your map. Something like :
typedef map<string,int> StringIntMap;
This could simplify some of the code.
Second, try using some temporary variables of the correct type to save the values of the first and second members of the iterator and then use those temps for the output. That should show you exactly what the compiler is expecting for variable types and allow you to cast if and as needed.
|
|
|
|
|
Hi, Rick,
Do you mean I should change the code like this?
ostream & operator << (ostream &out, map<string,> &siMap)
{
for(map<string,>::iterator it = siMap.begin(); it != siMap.end(); ++it)
{
string key = it->first;
int value = it->second;
out<<"key: "<<key<<" value: "<<value<<endl;
}
return out;
}
However, it doesn't fix the problem. I am confused because I think ostream has the ability to output string no matter it is const or not.
regards,
Bob
|
|
|
|
|
Suppose we have a number of type DWORD and we want to extract four 6-bit number and a byte from it. Some thing like this:
(DWORD) ---> 10100101101000110100011010101001
(Result) ---> 101001 011010 001101 000110 10101001
If you want to introduce me 'Bit Field Operators', be aware! It does NOT work in this manner.
Thank you masters!
|
|
|
|
|
Just shift and mask it?
the byte: dword & 0xFF
last 6bit value: (dword >> 8) & 0x3F
next 6bit value: (dword >> 14) & 0x3F
etc?
Would that work?
|
|
|
|
|
Possibly another approach is to use union. Just check the following code snippet.
#pragma pack(1)
union DWordParser
{
DWORD DwordValue;
BYTE Bytes[4];
};
DWordParser Parser;
Parser.DwordValue = 255;
BYTE ThirdByte = Parser.Bytes[2] & 0x3F;
But you have to sacrifice performance for readability.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Can you explain why you feel that bit fields won't work for you?
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
krmed wrote: Can you explain why you feel that bit fields won't work for you?
I'm guessing it's because he didn't know how to use them properly.
|
|
|
|
|
Hi all,
I have a multithreaded application written in c++ vs6.
I try to create a new dialog within an existing dialog in that application and when i call
ShowWindow(SW_SHOW)for the new dialog it doesnt do anything.
If i put a break point there, it seems that it stops in the call to ShowWindow and doesnt continue the execution.
Can someone explain this strange behavior and suggest a way to overcome this problem?
Thanks
Simon.
|
|
|
|
|
All these dialogs are created on the same thread?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: All these dialogs are created on the same thread?
ddd_shocron wrote: I try to create a new dialog within an existing dialog
Doesn't that tell you exactly what is being done? It's created within
led mike
|
|
|
|
|
|
yes all these dialogs are created in the same thread.
To be more precise i call the create function for that dialog in the ctor of the containing dialog
and i call the ShowWindow(SW_SHOW) from within the OnInitDialog ,just before
i return true for the OnInitDialog.
dj4400 formerly known as ddd_shocron
modified on Thursday, January 1, 2009 3:14 AM
|
|
|
|
|
dj4400 wrote: i call the create function for that dialog in the ctor of the containing dialog
If the containing dialog is used as the parent for the created dialog,
then that may not work - the parent dialog window (HWND) hasn't been created yet
at that point.
Try calling create for the child dialog in the parent's OnInitDialog() (after calling
the base class' OnInitDialog()).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark, you are right - i called the create function in the OnInitDialog and then it worked properly.
|
|
|
|
|
dear all
any problem? i couldn't find. thanks a lot
void CMeiTengDlg::OnPause()
{
if(Pause)
{
m_Pause.SetWindowText("Pause");
MCIWndResume(m_Video);
Pause = FALSE;
}
else
{
m_Pause.SetWindowText("UnPause");
MCIWndPause(m_Video);
Pause = TRUE;
}
}
void CMeiTengDlg::OnBrowse()
{
m_Video = NULL;
if(m_Video == NULL)
{
CFileDialog avi(TRUE,NULL,NULL,OFN_HIDEREADONLY,"MP3 Files (*.mp3)|*.mp3|AVI Files(*.avi)|*.avi|");
if(avi.DoModal() == IDOK)
{
m_Path = avi.GetPathName();
UpdateData(FALSE);
}
}
}
the resilt of compiling:
MeiTengDLg.cpp
.\MeiTengDLg.cpp(235) : error C2664: 'CWnd::SetWindowTextW' : cannot convert parameter 1 from 'const char [6]' to 'LPCTSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\MeiTengDLg.cpp(241) : error C2664: 'CWnd::SetWindowTextW' : cannot convert parameter 1 from 'const char [8]' to 'LPCTSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\MeiTengDLg.cpp(277) : error C2664: 'CFileDialog::CFileDialog(BOOL,LPCTSTR,LPCTSTR,DWORD,LPCTSTR,CWnd *,DWORD,BOOL)' : cannot convert parameter 5 from 'const char [48]' to 'LPCTSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Build log was saved at "file://c:\Documents and Settings\ZhiYuan Li\Desktop\MeiTeng\MeiTeng\Release\BuildLog.htm"
MeiTeng - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
|
|
|
|