|
Thank you!
I hope you could help me.
-----Method != Objective,COM != Panda-----
|
|
|
|
|
How can I add an option to the Shutdown menu in the Windows 9x? (Or, should I say, can I add an option?)
icounter
|
|
|
|
|
There is an article about manipulating the start-up menu. I dunno if you can add anything to the shutdown dialog, I don't see why not...?
However you could I imagine display your options prior to the shutdown dialog using this authors techniques.
Start Menu
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I asked this questio earlier and didn't get an answer...perhaps I was to vague i'll try and be more specific.
I have derived a class from CControlBar(which is derived from CWnd so nothing should change much should it...?)
and naturally overriden the Create().
My window(derived CControlBar) is created but also creates it seems 2-3 others???
I used spy to verify the window was created and it's show a few more childs then I thought should be there...?
ANyways...using Spy I determined that the reason my CControlBar isn't showing is because it has a negative height.
0,0,320,-2...???
What do I have to do to show the Window...? i've done this a hundred times with generic CWnd, but the same doesn't apply to the CControlBar obviously.
When createing the CControlBar I specify a command ID within range:
AFX_IDW_CONTROLBAR_FIRST+32
What else am I missing...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Did you call CFrameWnd::DockControlBar or CFrameWnd::ShowControlBar?
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Here is the following code from CMainfFrame::OnCreate()
m_wndTool.Create(this, WS_CHILD |WS_VISIBLE, AFX_IDW_CONTROLBAR_FIRST+35);
m_wndTool.SetBarStyle(CBRS_ALIGN_TOP | CBRS_GRIPPER);
m_wndTool.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndTool, AFX_IDW_DOCKBAR_TOP);
I can't figure out what i could possibly be missing...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
HockeyDude wrote:
I can't figure out what i could possibly be missing...
CFrameWnd::ShowControlBar?
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Sorry
I didn't even notice that...I basically created a q and d app and modified a CDialogBar/CToolBar, neither had ShowToolBar and they worked so I never even noticed.
Thanx though...i'll try it out and hope it works, cuz this is driving me crazy...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I was afraid I would have to say this.
ShowControlBar didn't do it neither.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hmmm... I'm not sure which virtual methods you have to override when deriving from CControlBar. Did you play with CalcXXXLayout?
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
Yup i've tried all of that.
I took a CDialogBar and stripped it down to nothing, but the bare essentials....but when I remove the resource everything goes bad.
I'm going to pick apart the CControlBar today and hope I figure something out.
I don't understand why it's so different...it doesn't look like it adds that much functionality to CWnd...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi,
I like to port my current WTL apps to Visual Studio .NET but I've tried to build a standard WTL app first. I've included the paths to WTL and using WTL 3.1. The following warnings and errors occur:
Compiler warnings:
atlapp.h line 400: conversion from 'LONG_PTR' to 'LONG', possible loss of data
atlapp.h line 433: conversion from 'LONG' to 'WTL::CAppModule *' of greater size.
Runtime error:
Assertion: Allocate.cpp, line 247: (iCategory < m_pProcess->CategoryCount()) || (iCategory == -1)
Can anyone tell me if it is just a compiler setting or is there an update of WTL for Visual Studio .NET?
Thanks in advance,
Remon
|
|
|
|
|
You need to #define a symbol before #include'ing the WTL headers. It's one of those ".._TMP_IMPL" symbols, but I forget the exact name. It was mentioned on one of the front-page articles some months ago.
--Mike--
It's hammer time!
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Can you give me a direction where to search?
Thank you
Remon
|
|
|
|
|
Hi,
I just want to know how concurrent threads communicate to each other.
For example, there are 100 threads: thread1, thread2, thread3....thread100. AND thread1 acts as the server and all others are clients. (actually this point is not very important)
Now, thread2 sends an request to thread1 (server) for some services. (request will be sent to a global array that thread1 checks it very frequently) At this time, thread2 will suspend itself, and let thread1 to resume thread2 (ResumeThread())when thread1 thinks that it is OK to let thread2 continue. However, it is possible that thread1 will not resume thread2 very shortly due to some reasons, and it causes thread2 to wait for a long time. So, i want to add a time-out feature for thread2 here.
It is not very hard to keep track the waiting time in thread1 by using QueryPerformanceCounter(). However, how can thread1 send the time-out message telling thread2 to abort.
The main problem is TIME-OUT checking.........
Can anyone help me or have any beter solution..............(the above is my thinking...)
Thanks!!!!
|
|
|
|
|
You shouldn't use polling for inter-thread communications. You should use kernel synchronization objects (like events) and WaitForSingleObject/WaitForMultipleObjects APIs instead.
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
There are two ways of stopping a thread:- Telling it to stop (somehow),
- calling
TerminateThread . The last solution is almost guaranteed to generate memory and resource leaks and leave your program in a bad shape, so I'd suggest you don't even consider it as a viable alternative. So, basically if you want to stop a thread the only way is signal this wish in the hope that the thread notices and properly stops itself. How can you signal this?- Set a boolean variable thath the thread checks frequently. Make this variable
volatile to prevent certain erroneous conditions caused by optimizations in the code by the compiler.
- Signal an event with
SetEvent . This is specially fit if the thread spends most of its time waiting for an array of objects with WaitForMultipleObjects . The approach is not as good for threads devoted to computation. - If the thread has a message pump, send it a
WM_QUIT message. Not an option in your particular scenario, I guess.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I would suggest that the client thread post a message to thread1, passing it an event handle that thread1 will set when it thinks that the client should resume execution. Ex:
while (GetMessage(&msg, 0, 0, 0)) {
switch (msg.message) {
case WM_USER:
HANDLE hEvent = (HANDLE)msg.wParam;
::SetEvent(hEvent);
break;
}
}
The code above is part of the thread1's message pump. Now the client thead:
HANDLE hEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
::PostThreadMessage(dwThread1ID, WM_USER, (HANDLE)hEvent, 0);
DWORD dwWaitResult = ::WaitForSingleObject(hEvent, dwMyTimeOutInMillisecond);
if (WAIT_OBJECT_0) {
} else {
}
As you can see, thread1 receives messages from client threads, and client threads wait for thread1 to set the event, but can eventually give up waiting.
Error handling is missing for clarity.
Hope this helps
Michel
If I am wrong or said something stupid, I apologize in advance ![Wink | ;)](https://www.codeproject.com/script/Forums/Images/smiley_wink.gif)
|
|
|
|
|
I have encouraged a problem when trying to connect many clients (a thread for each client) to a single server (another thread). After the socket is received from the first client to the server, no other clients can get into the server. They are blocked!!! I've tried to use CasyncSocket. But still doesn't work. Can anyone please help me??
Thank you!![Roll eyes | :rolleyes:](https://www.codeproject.com/script/Forums/Images/smiley_rolleyes.gif)
|
|
|
|
|
Ok! I've found that different threads can get access to the server. However, another question comes up. In the same single thread (one client), how come when I try to send something to the server many times in a for loop, only the first time can access to the server (socket is received by the server), other times the access is blocked?? So, it's no longer a multithread problem. It's a single(client) thread communicate with another single thread(server).
Can someone please explain to me??
thank you!![Roll eyes | :rolleyes:](https://www.codeproject.com/script/Forums/Images/smiley_rolleyes.gif)
|
|
|
|
|
Hi,
I have a problem:
1. Thread (A) for users (1 to 100 users, so can have max 100 threads here)
2. Thread (B) for array_function
3. Global array - store all input value and work liked a queue for those inputs....(line-up)
Thread (B) keeps retreiving the item from array for input data. Thread (A) keeps sending new inputs to the array. If Thread (B) processed one input data in the queue, it will return a signal back to thread (A). Otherwise, those input data is waiting...... if the waiting time is too long, thread (A) will abort that input data.
Is it possible to implement? Can I use WaitForSingleObject(ThreadB, 5000) to do the time-out stuff?
How to return value (let say boolean flag) from thread B to thread A?
Thanks!!!!
|
|
|
|
|
Ok, here is it:
You cant write WaitForSingleObject(ThreadB, 5000), because wait functions for thread objects wait for thread termination.
Instead, you can create event object(s) with CreateEvent function prior to creating threads and give them handle (that CreateEvent returned) or name of the event(s), or write a name stringently into your code. Then if some thread alter shared data (array, etc.) it calls PulseEvent, all others WaitForSingleObject or WaitForMultipleObjects for the event(s).
Name or handle of the event(s), as well as array pointer can be determined in thread procedures by lpParameter parameter of CreateThread and CreateRemoteThread functions. This parameter is the only one of ThreadProc. Just convert it from LPVOID to LPYOUR_SHARED_MEMORY.
Hope, I explained it well
P.S.There are many other ways for interprocess signalling - mutexes, semaphores, messages, just take a look into 'Syncronization Objects' page of MSDN.
|
|
|
|
|
How to change the cursor to IDC_HAND only when the mouse is on a button ?
thanx![Rose | [Rose]](https://www.codeproject.com/script/Forums/Images/rose.gif)
|
|
|
|
|
subclass the button, then handle the WM_SETCURSOR message for the button. You can set the cursor to the hand in that message.
Or in your parent window you could simply handle the WM_SETCURSOR message, and if the cursor is over the rectangle where the button is located, you could set the hand icon.
|
|
|
|
|
Thanx![Rose | [Rose]](https://codeproject.global.ssl.fastly.net/script/Forums/Images/rose.gif)
|
|
|
|