|
'An image on a particular path' sounds like a file, to me. To overwrite the file, open it for writing and do write the new image data to it.
|
|
|
|
|
Hi All,
I'm trying to create Instant Messaging software for Windows.
What are the options for the core chat technology?
Is Microsoft Bot Framework a good choice for one-one chat?
Its planed for man-bot so not sure about that...
In addition I don't want to implement it from the ground, WINSOCK etc
I prefer use an already tested platform or library for that
Is DCOM or MSMQ a good choise ?
please advice
mithrhill
modified 6-Feb-17 3:58am.
|
|
|
|
|
Hello,
I am a BCA student.I want to know about project on hostel mannagement system in c program with their source code.
Any one please send me the source code to my email:- chandanbhoi11@gmail.com
|
|
|
|
|
CodeProject is not a code writing service. See also the sticky post (actually) above yours:
Quote: 2. Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
11. If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
We will help if you got stuck at specific portions of your code. But if you need code written for you, you probably have to hire someone and pay for it.
|
|
|
|
|
Also, we do not do the assignments for students and it will be against our rules and will not help you in any way. The assignments are assigned to you to help you focus on programming.
If you are having trouble, consult your teacher and ask him to guide you in the process so that you can do it. If you still face issues, try group study and talk about the problem in the group and ask help from peer students.
However, if you face any problem during the programming; such as errors occur, do come here and we will help a bit.
One more thing: Sharing the email online will only help spammers, who are always building their email databases, to send lottery win emails. You get the point, please do not share the emails on online forums. They are not safe.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
I was told PostMessage would work for IPC the child process never gets control
|
|
|
|
|
How do you use it?
What message ID do you use?
|
|
|
|
|
The child probably wont see the message because the parent isn't passing it up. Very few messages are passed from a parent to a child unless you specify it beyond the obvious stuff like keyboard and mouse. Depending on the ID it isn't clear to me a message will be passed to a child window I need to know more about the window types and flags involved.
In vino veritas
modified 3-Feb-17 5:59am.
|
|
|
|
|
Hi
I have been having intermittent problems notifying a child window process with SendMessage
So I decided to go with the Microsoft Sanctioned way WM_COPYDATA
In my console Parent process I do GetConsoleWindow (which I observe returns what seems
a valid HWND),
I declare a COPYDATASTRUCT member on the stack (locally)
and do SendMessage I have gotten the child window HWND with FindWindow
in my MFC child window I have a messagemap entry
and nothing it never gets there I am running under both the console app and the MFC app
under Visual studio debugger so I can see what's going on
ON_MESSAGE(WM_COPYDATA,Debug_it)
|
|
|
|
|
See the first comment at WM_COPYDATA message (Windows)[^]:
Quote: Starting with Windows Vista, the application that is to receive the WM_COPYDATA message must call the ChangeWindowMessageFilterEx function. Otherwise the the message will not be received. It will be blocked by UIPI.
|
|
|
|
|
Thanks for your help I just tried
ChangeWindowMessageFilterEx I got a FALSE GetLastError returned ERROR_ACCESS_DENIED
This is because my process is at SECURITY_MANDATORY_LOW_RID
AnyWay I can Change this. Thing is I understand the concern for security however I (my process ) created the child process so I should be able and send messages
|
|
|
|
|
It's not a problem of sending messages but of receiving. So the only solution would be increasing the UIPI level of your MFC application or using another IPC method.
|
|
|
|
|
Thanks I didn't read it entirely
For a Mainframe in the OnCreate and for a modless dialog I'll put it in the OnInitDialog
|
|
|
|
|
Still works intermittently I am going to try DDE since my code is based on messages
|
|
|
|
|
Many, many years ago I wrote a very simple app to demonstrate the use of WM_COPYDATA with MFC and I see that it is still online : Inter-Process Communication Using WM_COPYDATA[^]
I rebuilt it just now in VS2015 (with very little effort) and it still works on W10. You might want to have a look at it as an example.
|
|
|
|
|
I originally had the WM_COPYDATA as a ON_MESSAGE message map handler than I noticed the OnCopyData I wasn't able to get it to work with that as well
My current method works fine as I don't have to wait for a reply with the SetEvent and shared storage thanks for your help
|
|
|
|
|
I am not sure the copydata can be local but for safety I would just use globalalloc anyhow
HGLOBAL hgbl = GlobalAlloc(GMEM_ZEROINIT, sizeof(COPYDATASTRUCT) );
COPYDATASTRUCT* cpd = (COPYDATASTRUCT*)GlobalLock(hgbl);
GlobalUnlock(hgbl);
GlobalFree(hgbl);
Not sure it's the problem but at least then when know the memory passed is valid to both parts.
In vino veritas
modified 3-Feb-17 6:06am.
|
|
|
|
|
I want to inplement a binary search algorithm of an order array.
int Array::Search(int target, int* start, int* tail){
if(start>tail){
cout<<"not find"<<endl;
return -1;
}
int offsetMid= (tail-start)/2/sizeof(int);
cout<<"offset: "<<offsetMid<<" mid " <<*(start+offsetMid)<<endl;
cout<<start<<" " <<tail<<endl;
if(target == *(start+offsetMid) ){
cout<<"mid"<<endl;
return (offsetMid+1);
}
if(*(start+offsetMid) > target){
cout<<"left"<<endl;
tail = start+(offsetMid-1)*sizeof(int);
return Search(target, start, tail);
}
if(*(start+offsetMid) < target){
cout<<"right"<<endl;
start = start+(offsetMid)*sizeof(int);
return Search(target,start , tail);
}
}
But it doesn't work, I know the parameter of the func should better be the index of the array rather than a pointor, I just want to try this way. The compiler I used is
gcc version 6.2.1 20160916 (Red Hat 6.2.1-2) (GCC) Another weird thing
int offsetMid= (tail-start)/2/sizeof(int); Both tail and start are the type of int*, but the difference of them is counted by byte, so I must divide it by sizeof(int) to get the offset value.
if(*(start+offsetMid) > target)
But when I want to plus the offset value to the start address to get the value in a particular position, I shouldn't time it by sizeof(int).WHY??
|
|
|
|
|
You have already asked this question in QA. Please do not repeat questions in multiple places. Choose your forum, and stick with it.
Cheers,
Mick
------------------------------------------------
It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
|
|
|
|
|
I'm so sorry about that. This is my first time come here, I'm not familiar with here.So I just want more people can see my problem. Thank you for you advice.
|
|
|
|
|
U are totally right, I found I made a silly mistake in Creator function that I DID'T post it up . Thank u for your answer and your patient, I hope my moron question didn't make you confused, if it is, I'm so sorry about that and the time u waste on my question.
|
|
|
|
|
Ok I want you to get out pen an paper and do this on a piece of paper
You have have two integers in an array and the pointer to the first one we will call zero. So the second pointer must be exactly one integer away so it will be sizeof(integer) from the first pointer.
Can you get what the result of this is (tail-start)/2 .. I will give you a hint if an integer is 2 bytes the answer is 1 byte. It doesn't matter what divisions you do after that you have lost alignment to the array your result can be some point in the middle of an integer.
Nothing in all the code above deals with that problem and it's really simple to fix all you need is to add a simple +1 in exactly the right place. Start by fixing the alignment problem and most of the rest will drop out which was sort of the second you cottoned onto what is the middle of the array and what does that actually mean. Take a one integer array what is the middle mean, your code has to know what to do with pathological case. The two integer array is an edge case on dealing with even number arrays where the middle of the array isn't aligned to an integer pointer.
This whole concept is sometimes called the post and fence problem, where you always need one more post than the gaps you span if you need to search.
modified 3-Feb-17 5:26am.
|
|
|
|
|
thank u for your answer and your patient. You are so nice! It really teach me a lot, I get more than I thought. Thank u!
|
|
|
|
|
No worries can I also give you a much safer option which I always try to teach to new graduates
Don't move the entries at all in the sort. Make yourself an array of pointers to the entries and shuffle your pointers in your private array.
The reasons are obvious
1.) The is no risk of damaging the original data and if you want to undo the function it's instant
2.) On most systems these day an integer is 32bits as is a pointer so it is the same speed to sort them.
3.) For complex types doubles, floats, strings the pointer is a lot smaller than the data.
4.) The source data doesn't have to be in the same place, it can be spread out all over the place the pointers don't care
A common test I set for new employees look like this .. Please write a routine to sort these animals
char* DomesticAnimals[4] = { "Cat", "Dog", "Goat", "Cow" };
char* RodentAnimals[4] = { "Mouse", "Rat", "Rabbit", "Fox" };
char* WildAnimals[4] = { "Elephant", "Rhino", "Lion", "Tiger"};
Basically you copy or move the entries you don't get the job.
The three different source arrays throws most graduates for a loop they feel they have to move something.
Even if they go for an "in place" sort they put wrong animals in wrong categories and they foul my database.
You don't move anything, you make you own private array of char* pointers and point alternate strings and sort whats pointed to with a routine. There are 12 entries above so all you need is
char* myArray[12];
Load each entry to a pointer in that array and sort, and you don't move anything and you don't risk my data if you botch it. This example above sort of makes it very clear why you don't ever move the data .. not ever!
If you want to see the trick of sorting pointers large scale open a windows folder viewer .. what do you think they are doing they don't ever really move or copy the data in anyway it's too risky and slow.
It sorts out those who can program from those who can just write code very quickly.
I would expect a good programmer to be able to write a bubble or quick sort on that array in about 20 lines of code.
Here is the standard Rossetta code for it which is 15 lines
Sorting algorithms/Quicksort - Rosetta Code[^]
In vino veritas
modified 3-Feb-17 13:39pm.
|
|
|
|