|
Hi all,
I m using a Report View type CListCtrl.
i m able to compress width of list column header with using of mouse.and now this is disappear.
so i want even if i drag the column the width of column not to be zero.like GridControls.
here width of column not to be zero whether we drag the column.
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 have to derive a class from CListCtrl ( eg: CListCtrlEx ).
Override the CListCtrl::OnNotify() function.
BOOL CListCtrlEx::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
HD_NOTIFY *pHDN = (HD_NOTIFY*)lParam;
if((pHDN->hdr.code == HDN_ITEMCHANGINGW ||
pHDN->hdr.code == HDN_ITEMCHANGINGA)&&
pHDN->pitem->cxy < minWidth )
{
// If the compress width of list column header is less than the <minwidth> then return
*pResult = TRUE;
return TRUE;
}
return CListCtrl::OnNotify(wParam, lParam, pResult);
}
If you want each column to have different minwidth then you have to check the pHDN->iItem also.
aks
|
|
|
|
|
Thanks
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi All,
I m using a CTreeCtrl with Trackselect property.
for set font of treectrl i m using this.
CTreeCtrl trCtrl;
CFont fArial;
fArial.CreatePointFont (150,_T("Verdana"));
trCtrl.SetFont(&fArial,1);
But when i move my mouse on TreeCtrl Items than the item disappear.
i want to use both property please tell me how can i do this.
thank 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
|
|
|
|
|
"_$h@nky_" wrote:
CFont fArial;
fArial.CreatePointFont (150,_T("Verdana"));
trCtrl.SetFont(&fArial,1);
I think your CFont object is on stack. In that case, once the function returns, the font will be destroyed by the CFont destructor . Just make fArial as a member of your dialog and i hope your problem will be solved.
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
|
|
|
|
|
Hello all, first of all, happy holidays.
I have the following function to encode a file to a base64 string:
string FileToBase64 (string path)
{
ifstream myFile (path.c_str(), ios::in | ios::binary);
int size = FileSize(path);
char buffer[size];
string b64;
if ( myFile.read ( buffer, size ) )
{
b64 = base64_encode( reinterpret_cast<const unsigned="">(buffer), size );
}
return b64;
}</const>
So I call it with:
string enc = FileToBase64("C:\\music.mp3");
With small files worked ok, but this is around 5,6 MB.
And with that file, my App Crashed, and the debugger gave me an error in new_allocator.h line 62, thats is:
new_allocator() throw() { }
I supose, the string type has a limit of capacity, but if this is true, what can I do?
Is there a type like Longtext in mySQL?
Thanks in advantage.
|
|
|
|
|
Perhaps you could try to change the function signature to be called as
<br />
string enc;<br />
FileToBase64("C:\\music.mp3", enc);<br />
« Superman »
|
|
|
|
|
I think, the problem it will be there anyway, becouse changing the function siganture, will not avoid doing this:
string x = VERY LONG BASE64 STRING
It is not true?
|
|
|
|
|
Exactly at where does your application crash? Could you post the call stack and exact line? My findings are as follows.
Dark_eye wrote: int size = FileSize(path);
char buffer[size];
You are allocating the buffer for the entire file on stack. For a file for 5.6 MB you are allocating that much on stack. Believe me, stack is precious!
1) Allocate the buffer by using new.
char* buffer = new char[size];
2) if you get error while manipulating strings, then try using std::rope[^] which can withstand heavy strings. I guess, std::rope is not yet avaiable with visual studio STL implementation and you've to use STLPort[^] for that.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Oh thanks!!!!
Changing
char buffer[size];
to char* buffer = new char[size]; solved the problem.
Also the std::rope solution sounds very interesting, that is exactly what I was thinking when I said "something like Longtext in MySQL". And I use Dev-Cpp so, no problem with VC
Happy holidays to all the people in CodeProject
|
|
|
|
|
Hi,
my guess is you exceed your stack limit.
Solution: use a heap-based buffer instead of a stack-based one; it takes a bit more code to do so,
but then the buffer size will be limited to available heap space.
|
|
|
|
|
dear all
what is problem the following? thanks a lot.
.\AVI Player.cpp(53) : warning C4996: 'CWinApp::Enable3dControls': CWinApp::Enable3dControls is no longer needed. You should remove this call.
D:\All Install Application\VC\atlmfc\include\afxwin.h(4818) : see declaration of 'CWinApp::Enable3dControls'
Generating Code...
Compiling resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation. All rights reserved.
Linking...
AVI PlayerDlg.obj : error LNK2019: unresolved external symbol _MCIWndCreateA referenced in function "protected: void __thiscall CAVIPlayerDlg::OnPlay(void)" (?OnPlay@CAVIPlayerDlg@@IAEXXZ)
.\Release/AVI Player.exe : fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://c:\Documents and Settings\ZhiYuan Li\Desktop\MP3Player\Release\BuildLog.htm"
AVI Player - 2 error(s), 1 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped
|
|
|
|
|
Try giving this at the beginning of the file
<br />
#pragma comment( lib, "Vfw32" )<br />
« Superman »
|
|
|
|
|
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.
|
|
|
|