|
Create a layared window. For more pls check SetLayeredWindowAttributes() in MSDN for how to create a layared window.
Then set the Transparent property( WS_EX_TRANSPARENT ) for the dialog.
Now the messages to the layared wnidow will be transferred to the window underlying it.
aks
|
|
|
|
|
|
Hi,
I need to break the infinite loop by pressing some key, 'x' for example.
How can I do it in C or C++ for console application?
Thanks.
|
|
|
|
|
Could you please explain what you are trying archive? Do you want to check whether the 'x' key is pressed, in between your loop? In that case check this - Non-Blocking input in Console Applications[^].
Just ignore my reply. Mark's idea is cool!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
modified on Thursday, January 1, 2009 2:13 PM
|
|
|
|
|
Just one way...
#include <conio.h>
...
int ch = 0;
do
{
if (_kbhit())
{
ch = _getch();
ch = toupper(ch);
}
} while (ch != 'X');
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark, the _kbhit() is really cool and my 5 points for you!
I was totally focused on "non-blocking input in C++ " while searching.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Heh thanks. I thought for sure there was a single non-blocking function, but I only seem to be able
to find it when I WANT the blocking function and I forget what it is
If anyone knows, please refresh my memory
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
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
|
|
|
|