|
hi all,
have a question which i couldnt find an answer after searching for several days now.
Well everyone knows the "show desktop" button. what i need to do is to intercept its action and do soemthing else instead of the minimizetion of windows(or restoring). well from what i have read and found i gather that the icon calls shell.IDispatch4.minimizeall or undominimize all.
Is there any option to intercept it before its doing this shell line? and by that i mean does anyone knows what message its sending ? or any other method of interception u have will be more then welcome .
thanks in advanced,
Barak
|
|
|
|
|
OOPS , first message/question i ever send here , so i'm a noob when it comes to asking here ...
anyways I'm talking on Visual C++ programing enviorment.
sorry for leaving that detail out
|
|
|
|
|
One solution that I've come up with is subclassing. You can subclass the Quick Launch window, which is in actual a toolbar control (i.e. its window class is ToolbarWindow32 ), intercept the windows messages, and do whatever you want to do.
Gurmeet S. Kochar If you believe in God, it's because of the Devil
My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
I realize what's going on now, but I can't fix it. Take a look at this an it'll explain my situation.
#define VERY_LARGE_NUM 9999...
main()
{
double dummy[VERY_LARGE_NUM]
for(i...
{
//create a few threads
createThread....
}
....
}
The program bombs out when I try this because the dummy array allocates more than the 1 meg. Hence, I change the stack reserve and commit to a large value. This fixes the bombing out problem, but creates a new one. The create thread function will only create X num of threads while I want Y num of threads. I tried setting the stack param in the create thread func but it did nothing for me. What can be done. The /3GB flag is not an option because the target machine's OS does not support it.
|
|
|
|
|
Other than spinning a new process. Is there a soluation.
|
|
|
|
|
Risking asking a stupid question, have you considered allocating it on the heap (double *p = new double[BIGNUMBER]), not on the stack?
If for some strange reason you need to allocate it on the stack, the CreateThread API function allows you to specify a bigger stack size.
I see dumb people
|
|
|
|
|
The example was simply to demonstrate the situation. The real app uses all these classes. The original design called for them to be globals to make communicating between all the threads that we created. Hence, we, in essensce, have a main with a ton of classes that spin up a ton of threads. Your create thread suggestion leads me to my 2nd problem. I specified a bigger stack inside my project setting (Stack reserve and Stack commit). This move fixed my stack over-flow problem when running the app. However, I can't seem to call CreateThread pass a certain number of threads. I'm aware of the stack size parameter inside the API call, but it seems not to solve the problem. Does the stack reserve/commit set the stack size for all threads and the main process?
|
|
|
|
|
I don't understand why you're allocating such a large array from the stack. Why not 'new' and 'delete' or 'std::vector<double>'?
How many threads are a 'ton'?
Why so many threads? In general if your threads are ready to run then there's no point in having more than the number of CPUs your machine has. If they're not ready to run, they're waiting for input, then you still don't want more than a relatively small number (let's say less than 25) due to the overhead of thread creation, context switching and stack usage(!). In this case you should investigate a thread pool and overlapped IO.
Paul
|
|
|
|
|
i have the following problem, if i declare a variable in a local function and then assign a value in a try block under release min dependency the value is corrupt or the same as it was before the try block upon entering the catch. Please what am i doing wrong?? The code is below:
STDMETHODIMP CCMI_BioWrapper::QueryTemplate(BSTR Badge,BSTR *Response)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
int nRetCode;
CString strVal;
nRetCode = 0;
try
{
nRetCode = 99;
return S_OK;
}
catch(...)
{
// I would expect nRetCode to be 99 here
// however it is always 0, unless i do a debug build
// then it always works
strVal.Format("Q0 %d",nRetCode);
*Response = strVal.AllocSysString();
return S_OK;
}
}
|
|
|
|
|
how can i check the status of a URL, like http://www.codeproject.com
is active / down , Winsock or any other ..????
I want to change Myself..Can u help me?
|
|
|
|
|
How about InternetCheckConnection() ?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Great..Thankyou
I want to change Myself..Can u help me?
|
|
|
|
|
You can look at this example prog: [^]
onwards and upwards...
|
|
|
|
|
I need the API, not the exes..
I want to change Myself..Can u help me?
|
|
|
|
|
Here is the source for the app (bear in mind that this is just a quicky example app and not necessarily coded well ) [^]
onwards and upwards...
|
|
|
|
|
I am porting an old project to be able to use .Net. There is a struct type that needs to be used by an old library written in C and a new class library written with .Net. When I try to have a pointer to this struct as a member of a managed class I get the following error:
error C3160: 'piData' : cannot declare interior __gc pointer or reference as a member of 'PatInfo'
Here is the struct definition in a header file used in both projects:
typedef struct _reportFull{
ReportHeader * header;
ReportStruct * st;
ReportAngio * angio;
ReportNonSaved * ns;
} ReportFull;
Here is part of the PatInfo class definition from another header file:
__gc class PatInfo {
public:
PatInfo();
~PatInfo();
ReportFull __nogc *piData;
ReportFull __nogc *temp_data;
ReportFull __nogc *defaults_reference;
UserControl* dlg;
};
The error occurs when I try to make a derived class from PatInfo. I suspect that it would occur any time I use PatInfo.
Anyone know of a way to use pointers to unmanaged types within a managed class?
|
|
|
|
|
I keep getting a stack overflow error when running a multiple threaded app. I thought the OS allocated 1 meg and grew the stack when one uses createthread with zero for the stack size param. How do you use the param? I set the param to a more than sufficient value, but it changed nothing. Do I need set anything else? I noticed setting the stack commit/reserve in the proj setting fixed the issue. Why did this work. Any suggestions.
|
|
|
|
|
If you are writing a Win32 application and you use Viusual C++ and you make calls to some standard C library functions, then you should start your thread with beginthreadex instead of CreateThread. It initializes thread local storage for certain standard library functions. If you called one of these from your thread, you might have blown the stack. Otherwise, check for excessive recursion in your code. Maybe you just luckily made the stack large enough not to blow in this particular instance. I have used file and directory search code from threads, as a recursivee example, and I have yet to ever have to adjust any stack size thread related parameters away from their defaults.
|
|
|
|
|
I have a tree control in which I have a couple of top level items ( hParent == TVI_ROOT ).
I need to be able to select items from the different subtrees, so I'm using CMultiTree ( from codeguru ).
The question is :
Is there a way to search/select/manipulate all subtrees at the same time, with a single "root" item ?
I can search each subtree with a simple recursive method, but I need to search each sub tree individually; not a big deal, but if I need to add a new subtree, I will need to add it to each operation that will scan the different trees ( add, remove, select, modify ... )
I wanted to put each sub-trees under a single "root" item to do this, but the boss doesn't like it.
Maybe I got things wrong ... any suggestions ?
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
It may be my imagination, but you've answered your own question. Each top level item is a child of
the TVI_ROOT "item".
So if you have a HTREEITEM SearchChildren (HTREEITEM hSearchRoot) funtion, just feed it TVI_ROOT
as the search root.
Iain.
ps. SearchChildren was an example name...
|
|
|
|
|
Hi guys
There is an easy way to manage the following?.
I have 2 list controls one above the other and what I want is that when I move the horizontal scrollbar of the above listcontrol the down scrollbar move like it was linked. Is this possible easily?
Best Regards
Doc
|
|
|
|
|
Yes, but you'll have to write all of the scroll sync code.
onwards and upwards...
|
|
|
|
|
Where can I start to take a look about scroll sync?
Thanks
Doc
|
|
|
|
|
For starters, you can look at the MFC file ViewScrl.cpp to see how to handle scroll messages. Then, you would need to scroll the second control (via ScrollWindow or equivalent) when the first is scrolled.
onwards and upwards...
|
|
|
|
|
Incredible but true!!!!
http://www.codeproject.com/listctrl/synchscroll.asp#xx128601xx
Nice job.
Thanks anyway.
Doc
|
|
|
|