|
which file beginning? i put vfw.h already in my file. thanks
|
|
|
|
|
before posted first one, i already put it, now still same problem,thanks
|
|
|
|
|
That command is not for the .h file.
It is for the .lib file.
That is the unresolved error that you get.
« Superman »
|
|
|
|
|
Hi all,
i have a CTreeCtrl,i have handle working of enter key on WM_KEYDOWN function.
i want i i press the enter key and tree is collapse than it will be expand and if it is already expanded than it is collapsed.
i m also try Expand function of TreeCtrl but its not perfectly works.
please tell me how can i do this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
You can expand/collapse the tree nodes by pressing the +/- keys. So for mimicking the same behavior for Enter key, override the PreTranslateMessage() of your dialog and handle all keydown messages for your tree control. If the current item is expanded assign the keycode as VK_SUBTRACT to collapse and if its collapsed assign the keycode as VK_ADD to expand. Check the code snippet below.
BOOL CRabbitDlgDlg::PreTranslateMessage(MSG* pMsg)
{
if( pMsg->message == WM_KEYDOWN )
{
UINT CtrlId = ::GetDlgCtrlID( pMsg->hwnd );
if( CtrlId == IDC_TREECTRL )
{
if( pMsg->wParam == VK_RETURN)
{
HTREEITEM CurrentItem = m_TreeCtrl.GetSelectedItem();
if( m_TreeCtrl.GetItemState( CurrentItem, TVIS_EXPANDED ) & TVIS_EXPANDED )
{
pMsg->wParam = VK_SUBTRACT;
}
else
{
pMsg->wParam = VK_ADD;
}
}
}
}
return CDialog::PreTranslateMessage(pMsg);
}
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
I'm using VC++.NET and I wonder if Its debugger can show the values in binary form or not? By now I can see the variables only in dec and hex forms.
Thank you masters!
|
|
|
|
|
Jusef Marzbany wrote: I'm using VC++.NET and I wonder if Its debugger can show the values in binary form or not? By now I can see the variables only in dec and hex forms.
No in my knowledge. You can use windows calculater to to get binary form of a number, I do find it quite useful particularly for masking bits.
|
|
|
|
|
|
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
|
|
|
|