|
|
When you add your tray icon with Shell_NotifyIcon(), specify
a window handle and a callback message along with the NIF_MESSAGE
flag.
When the window receives that message, check the LPARAM
for WM_RBUTTONUP or WM_CONTEXTMENU. If you receive the
message you want, you can use TrackPopupMenu to show a menu, or
display some other kind of UI.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm a Windows programmer and use MFC heavily. But in many forum/newsgroup STL seems to be a must have for a c++ programmer.
So I'm curious that should I use STL or MFC's array/list in my project?
STL seems to be a standard, but MFC's array/list fit in the MFC structure well.
|
|
|
|
|
MFC containers are crap, they were a stopgap until they had STL in their compiler, and remained as a legacy support thing. They should never be used unless you have a compelling reason, you should use STL by default.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Here are some performance readings which i took for CArray and std::vector
Time taken to add 1 million elements( unsigned long )
CArray = 2.7360s ( 2736 ms ) //Will be faster if you set the size using SetSize()
vector = 0.0210s ( 21 ms ) //Will be faster if you set the size using reserve()
CList = 0.0260s ( 26 ms )
std::list = 0.1220 ( 122 ms )
CMap = 0.0820 ( 82 ms ) // Used InitHashTable( 200017 ) or else it will take ages to add elements
stl::map = 0.0399 ( 399 ms )
Though STL is not as well structured or as easy to use as MFC but performance wise they win hands down.
Note: Will using STL access the elements using iterators. It will be very fast.
|
|
|
|
|
I'm first decoding, then encoding a .MP3 format. But it is not working properly. I wanna know how can we use avcodec to encode or decode a audio or video file?
Any help would be highly appreciated.
Come online at:-
jubinc@skype
|
|
|
|
|
I know static class member method(or function) doesn't have this pointer, we should use static class member method like this:
<br />
CMyClass::staticMethod();<br />
but sometimes we'll forget it's a static class member method and do some miscorrect use like ordinary methods:
<br />
CMyClass obj;<br />
obj.staticMethod();<br />
Question NO.1:
Why doesn't the compiler tell me the errors?
Question NO.2:
If the compiler doesn't tell me these codes, do these code harm?
Question NO.3:
Why can't Search Message Boards by user now? I remember it could do so before this update of CP, I'd like to Search Message Boards by user to find if anybody answers my question before.
|
|
|
|
|
1 and 2) Because it's perfectly legal to call a static function on a class instance. There's nothing wrong with it, and the code won't harm .
|
|
|
|
|
Hello ..
can somebody help me in ..
Scenario ::
for the Image data processing i write code in c++ where the
pBuffer have the image data
unsigned char * pBuffer ;
pBuffer = new unsigned char[someSize];
// Did Some processsing by copying the data in pBuffer
Now finally Wrote the data from pBuffer. just after that i tried to release the memory.. for that
if(pBuffer != NULL)
delete pBuffer;
For the single run it does not give me any error but consequently if i ran for second Image it gives me
Debug Error !!
DAMAGE : After Normal block (#8081)at some address
please help me ..!!
Thanks in advance
Shikha
|
|
|
|
|
plz try to delete Buffer using....
delete [] pBuffer;
Just try this.
thanks.
|
|
|
|
|
Thanks Ashish for ur reply..
i tried with delete []pBuffer .. but doesn't workout for this ..!
as per my view the reason for my problem must be ..
it tries to delete the pointer which is Still in use because in the whole code when i delete the other poniters it is ok but as the last statement uses the pointer for writing the data and in the next statemnt it is tried to delete it ...!!
does it make sense ..?
|
|
|
|
|
Hello Shikha,,
Can you post some part of code in which you are allocating memory and writing on that memory.
Then after I can know what the real problem is.
Ok.Thanks.
|
|
|
|
|
As mentioned before, you should use delete[]. You should keep in mind this simple rule: when you use new, use delete; when you use new[] use delte[]. That's simple.
Now, for your problem, it looks like you are overwriting your buffer (you are writing data outside of your allocated memory). But it is very difficult for us to spot the problem because there is no relevant code. So, please post some relevant code where you are writing in the buffer (and how you allocate it). And please use the formatting tags for your code (unless it will be unreadable).
|
|
|
|
|
hi
i am creating vertical scroll bar for edit box,My problem is that how can i know the ractangle size of edit box so that i can give same vertical size to vertical scrool bar.I used
CRect rect;
objectOfCEdit.GetClientRect(&rect);
but i got an error on line second.How can i solve this problem
thank u in advance
|
|
|
|
|
Plzz write the full code.
Come online at:-
jubinc@skype
|
|
|
|
|
i have solve this.Can u tell me how can i count the number of lines on edit box
thank u
|
|
|
|
|
Hello..........all's
Can any one told me how to make run time combo box in VC++
my backend data base is Oracle
Regard's
Kaushik
|
|
|
|
|
Work has been finish ........
No need to reply now..
Bye all's
Regard's
Kaushik
|
|
|
|
|
Except combobox you can make each control at run time.
|
|
|
|
|
Any control can be created at runtime with CreateWindow() or
CreateWindowEx(). The lpClassName parameter determines the type of
control created.
For common control classnames, see Control Library[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Dear DirectShow experts,
I have got a DShow based audio application that can use DMO Audio Effects
(e.g. the DirectX built-in ParamEQ) and show their property pages in order
to let the user change the effect settings. The DMOs are handled through the
DMO Wrapper Filter of DShow.
All works fine since years under Win2k and XP, but not so with Vista. Audio
Processing also works as expected there, but if I try to get the Property
Page of an DMO, I get 0x80040154 (Class not registered) as result. What
might be the reason?
Here is the relevant part of the code:
-------
IBaseFilter* pIFilter = pMyFilter;
ISpecifyPropertyPages* lpSPP = NULL;
hRes = pIFilter->QueryInterface(IID_ISpecifyPropertyPages, (void**)&lpSPP);
if(hRes == S_OK)
{ // filter has property page
FILTER_INFO FilterInfo;
hRes = pIFilter->QueryFilterInfo(&FilterInfo);
if(SUCCEEDED(hRes))
{
CAUUID* pCAUUID = (CAUUID*)CoTaskMemAlloc(sizeof(CAUUID));
memset(pCAUUID, 0, sizeof(CAUUID));
hRes = lpSPP->GetPages(pCAUUID);
if(SUCCEEDED(hRes))
{
for (UINT j = 0; j < pCAUUID->cElems; j++)
{ // Create CPropertyPages and Property page sites.
IPropertyPage* pPropPage = NULL;
hRes = CoCreateInstance(pCAUUID->pElems[j], NULL, CLSCTX_INPROC_SERVER,
IID_IPropertyPage, (void **) &pPropPage);
ASSERT(pPropPage);
// with VISTA, this pointer is NULL and hRes == 0x80040154 (Class not registered)
// meanwhile with 2k and XP it works fine
if(pPropPage)
{ // further processing
}
}
}
if(pCAUUID->pElems)
CoTaskMemFree(pCAUUID->pElems);
CoTaskMemFree(pCAUUID);
}
}
lpSPP->Release();
-------
Thank you very much in advance for your advice!
Robert
|
|
|
|
|
If the program is the sort with a visible `int main(argc,argv)' function, the answer is easy.
But what in the Windows type of program that is called through a WinMain()? In Borland C++ 4.5, there are two system-declared variables _Argc and _Argv which on entry to WinMain point to the program's call argument table; but that does not work in Visual C++ 2008.
|
|
|
|
|
There's a Win32 function called GetCommandLine[^]
And CommandLineToArgv will split it into an array for you.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
|