|
If I got you (the requirements aren't very clear), yes. However you should learn a bit how threads (or processes if you like) work. Have a look at: "About Processes and Threads"
[^] at MSDN.
Another worthy reading is the Newcomer's: "Thread and Processes series"[^] series.
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]
modified on Wednesday, July 13, 2011 3:22 AM
|
|
|
|
|
|
Sorry. Fixed now.
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]
|
|
|
|
|
Well, you can have multiple processes work together by communicating between them using pipes or sockets, but like it was already suggested, threads would probably be the most applicable solution to this. If the processes are doing the same thing, there's a perfect example of using CWinThread derived threads, by deriving (or subclassing), its easy to make multiple instances of the desired thread.
|
|
|
|
|
If you do in fact mean 'process' then the first step in the solution is explaining exactly what form the 'list' takes.
|
|
|
|
|
list taking some information that is communicate using ports,
i am having 2 and more port number for communication.
one port can use details from list and communicate after finish it use another item to do this ,coz if i want to access the port that is already in use it gives an error of access denied.
so please help me how can i do this?
thanks in advance.
|
|
|
|
|
Beej's Guide to Network Programming
Not so much for threads and processes but for a great read on ports. If I have understood your need correctly, this reference should help you.
|
|
|
|
|
The "List Hold'n'Synchron Kernel" could lie in a singleton COM EXE-server,
while some its clients could:
- ask for a value associated with a cockie-ID from the server
- precess on that value
- send the modified value associated with the cockie-ID to the server
You could also play
with the different appartment models of the server...
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
can anybody please provide me any sample or example code.
|
|
|
|
|
Hi Developers,
I want to set the multi selection property of a list box as TRUE through the code, in OnInitDialog(). I can do it from the resource view( dialog box ), but that dialog has used in so many modules.
Thanks.
Amrit Agrawal
|
|
|
|
|
See the notes here[^], this property cannot be turned on programmatically.
The best things in life are not things.
|
|
|
|
|
Just replace your resource list box by a static box (IDC_STATIC_LIST, "VISIBLE" = false),
then create a member list box in the OnInitDialog() function
by usage of the client position of the IDC_STATIC_LIST, current resource styles,
and the (passed in dialog constructor) multiselection flag
(Do not destroy any child explicitly)
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
Hi developers,
I want to handle TVM_DELETE or TVN_DELTEITEM from a custom tree control in other file( which is derived from CFormView ). From tree control, I am trying to send
<pre> SendMessage(TVM_DELETEITEM, WPARAM(0), LPARAM(hItem));
I have handled this msg in view file like this
<pre> ON_MESSAGE(TVM_DELETEITEM, OnTvmDeleteItem )
but it simply delete the item and doesn't caught at OnTvmDeleteItem().
I have also tried to send TVN_DELTEITEM with ON_NOTIFY_MESSAGE(), but still it doesn't work.
Pls help me out.
Thanks.
|
|
|
|
|
Amrit Agr wrote: I want to handle TVM_DELETE or TVN_DELTEITEM from a custom tree control in other file( which is derived from CFormView ). What do you mean by that? You want to give the implementation of the handlers for those notifications in a different file than the one that hosts your CFormView derivative's implementation?
Amrit Agr wrote: From tree control, I am trying to send
SendMessage(TVM_DELETEITEM, WPARAM(0), LPARAM(hItem));
You are sending that message from the tree control where? How? To where? TVM_DELETEITEM is sent TO the tree control usually to delete an item, not by the tree control.
Amrit Agr wrote: I have handled this msg in view file like this
ON_MESSAGE(TVM_DELETEITEM, OnTvmDeleteItem )
but it simply delete the item and doesn't caught at OnTvmDeleteItem(). This implies that you want to handle the delete-item in your custom tree control, is that correct?
Amrit Agr wrote: I have also tried to send TVN_DELTEITEM with ON_NOTIFY_MESSAGE(), but still it doesn't work. You use ON_NOTIFY_MESSAGE to catch messages, not to send them, what you say here is confusing.
Please try to explain a bit more clearly what exactly you are trying to do.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
I want to handle deletion of tree item in other file, because I have to do some database work.
But this custom tree is used in so many applications, so that I can't send to directly to any window. I have handled that TVM_DELETE message in other file, and assume It should get called. but it can't reach at the specified function.
Should I try PreTransalteMessage() in other file after mapping WM_KEYDOWM do the particular deletion and database work?
|
|
|
|
|
You want to get a notification when an item (or more items?) are deleted from the tree?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
From what you are saying here you are mis-using this message. You should capture the TVN_DELETEITEM notification in your TreeView control and use the information passed to you to decide what action to take. You should then call your alternative function directly to perform whatever actions are necessary; there is no need to use (and you probably should not use) SendMessage() for that purpose. Something like:
ON_NOTIFY(TVN_DELETEITEM, id, DoTvnDelete)
...
LRESULT DoTvnDelete(...)
{
LRESULT lrc = DoDeleteAction(parameters ...);
return someResult;
}
The best things in life are not things.
|
|
|
|
|
Thanks Rechards,
I was going on the right direction.
Amrit Agrawal
|
|
|
|
|
I am using mmioxxxx library / API to build and save wave in RIFF file.
I can record the audio wave, save it in file and play it Windows Media Player.
However, I cannot load the file and verify the RIFF format in my code properly.
The “data” chunk is not aligned – I get two characters and then “da”.
Consequently I cannot use waveOutOpen and play the file myself.
All audio recording code presented here either does not save and load the RIFF file to play it or skips some header information.
I would like a sample code using either CFile or mmioxxxx file to compare with my code so I can find this “bug”.
I do not need anything else, I think I got the wave API covered.
Any constructive help will be as always appreciated.
PS I feel this is a long shot so I did not post my code. I do that if requested.
Cheers
Vaclav
|
|
|
|
|
I think I found it - the header structures if file saved and file loaded did not match.
|
|
|
|
|
I've had a similar sounding experience when writing out file-header structures in the past.
For me, the solution was as simple as checking that sizeof(my_header_struct) did indeed equal the correct size of the header struct. I found that it didn't and also found parts of it becoming misaligned.
After determining that the structure size was wrong, I found that the compiler was 'thoughtfully' padding the struct for me to a 4/8/16 byte multiple to make it quicker to access in memory. It was as simple as compiler directives to ensure that the struct was as specified and did not include this padding.
Using gcc, the relevant directives are:
#pragma pack(push, xxx)
#pragma pack(pop) Where xxx is the size of the alignment block you'd like - i.e if xxx = 2 then the struct will be padded to a multiple of 2 bytes. For my use, xxx very nearly always = 1. Just place the first directive before the struct is defined and the second after it, you may place several structs between the directives if needed.
I don't know if this is/was the problem - digging through old code, I can remember that this was needed for BMP headers, and if memory serves me correctly - I also needed this when reading the sound samples from the old games Doom & Rott.
Cheers
|
|
|
|
|
I have narrowed it down to missaligment of RIFF "data" descriptor.
I found one coder just doing a do / while loop to find the "data".
I am doing just that, it is a kluge but so far so good.
I am ready to get the real data out.
Thanks for the suggestions.
Vaclav
|
|
|
|
|
I appears that RIFF WAVE "format" chunk has an additional and so far unidentified variable.
It suppose to be used when the wave compression format is different than 1 = no compression.
That is why the actual data chunk identifier "data" was missalligned.
Vaclav
|
|
|
|
|
I'm just being lazy here but is there a way in the Visual C++ IDE (any version) to have it tell you what exceptions have been declared (by any of the methods or methods called by those methods etc...) to be possibly thrown?
The only way I know of is to dig through MSDN researching each method call which can get time consuming since there are so many overloaded method variations that I tend not to assume the possible exceptions that could be thrown by one overloaded method will be the same as another overloaded method.
|
|
|
|
|
WinError.h contains all of the error codes generally thrown by WinAPI/MFC calls, but generally speaking, there's no clear way of knowing what each method will throw without looking into the documentation associated with that specific method.
|
|
|
|