|
|
Great.
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]
|
|
|
|
|
Thanks Man!
And Happy New Year!!!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Happy new year to you!!!
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]
|
|
|
|
|
Hi all,
I have made a dialog based application in vc2008....
I have made a worker thread inside my application, now my problem is when I execute my application everything is running fine but my dialog box start displaying not responding and it looks like system is hanged but after few mintues it displays right output.....
Like everything working fine in background......
I am not getting what is the problem.......
Can anybody tell me how to resolve the problem....
Thanks in advance....
|
|
|
|
|
give us a little more information on what your App is and what you want the working thread to do. (Always do so)
Thank you masters!
|
|
|
|
|
VCProgrammer wrote: I have made a worker thread inside my application, now my problem is when I execute my application everything is running fine but my dialog box start displaying not responding and it looks like system is hanged but after few mintues it displays right output.....
Are you doing any lengthy background operation in UI thread? Which ultimately makes your UI freeze. In that case, spawn a new thread and do your background operations there which will make the UI responsive.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
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.
|
|
|
|