|
You mean like this the worker thread doesn’t have to wait for a reply from send message
Ok thanks
|
|
|
|
|
Do you pass any MFC object to the worker thread?
|
|
|
|
|
No not sure how WSAWaitForMultipleEvents is implemented in Windows MFC app
But it was always my understanding based on feedback from people such as yourself that any kernel object wait I.E WaitForSingle/Multiple should be done in a worker thread correct ?
|
|
|
|
|
ForNow wrote:
No not sure how WSAWaitForMultipleEvents is implemented in Windows MFC app
But it was always my understanding based on feedback from people such as yourself that any kernel object wait I.E WaitForSingle/Multiple should be done in a worker thread correct ? |
WSAWaitForMultipleEvents has nothing to do with MFC (note that it is defined in Winsock2.h header!).
And what does it have to do with your using WaitForMultipleObjects function?
|
|
|
|
|
I am using WaitForMultipleObjects rather thanWSAWaitForMultipleEvents for socket notification regardless don’t think the wait should be in the main thread
|
|
|
|
|
ForNow wrote: don’t think the wait should be in the main thread
If you would implement the Wait... in the main thread then you could wait forever and your main thread could be frozen forever.
BTW, how do you create/obtain the event HANDLEs that you pass in the WaitForMultipleObjects? Are they all correct?
modified 10-May-21 10:37am.
|
|
|
|
|
I am using CreateEvent as it gives me more flexibility i.e auto reset As opposed to WSACreateEvent I then pass everything in a structure pointed to by LPVOID had to build it with no alignment (Zp1) as I was getting slack bytes among members of the structure
thanks
|
|
|
|
|
Could you post some code snippets describing what you do?
|
|
|
|
|
sure be glad to in fact I appreciate it Am at work now (I work as a z/os Mainframe assemnbler programmer ) this has given me a chance to enhance my skills its 10:50 am here EST get off of work 5:00 - 5;30 will do it then thanks for your help
|
|
|
|
|
ForNow wrote: I pass all the info (HWND windows
The MFC framework does not always give you the *real* HWND to a window. As strange as this might sound, the MFC framework maintains two object maps. The 'real objects' and an internal 'temporary handle map'. MFC will sometimes give you a temporary CTempWnd instead. If you are passing the window handle of a MFC class then you need to use CWnd::GetSafeHwnd[^]. There are some rare occasions where GetSafeHwnd cannot give you the real window handle and will return NULL instead so you should probably check for that too.
Not many people are using MFC these days. You should consider moving on.
I can't think of much else that would cause WaitForMultipleObjects to throw an access violation. The only other thing I can think of... is a corrupt heap. Sounds like you are somehow passing garbage to WaitForMultipleObjects.
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks I had some other problems
I got rid of the WaitForMultipleObjects and set all my notifications on one event and extracted the correct one with WSAENumnetwork that worked when you say not many people are using MFC do yo mean they coding Windows C API
I found CAsynsockets to be a pain I couldn’t pass along notification to another window
Thanks
|
|
|
|
|
ForNow wrote: when you say not many people are using MFC do yo mean they coding Windows C API
I found CAsynsockets to be a pain I couldn’t pass along notification to another window
I guess he meant they use C#.
I used CAsyncSocket class successfully since many years (until I have changed the company to work for). I never had any problems with this class to work with both IPv4 and IPv6 sockets in IPC with multiple sockets through intranet and internet.
|
|
|
|
|
C/C++ has pointers which gives me flexibility same with native sockets “WSA” when I tried moving my derived CAsyncSocket object pointer notification from a main window to a dialog I ran into problems. No where in the documentation does it say there has to be HWND associated with your CasyncSockets but you have to
I was using CWinThread for notification it has a message pump but doesn’t have a HWND although there is hWnd member ( I think main windows ) member thanks
|
|
|
|
|
It is very hard to understand what you mean, much more harder is to understand what, how, and what for you have implemented in your project. The reason - you avoid to show your code/pseudocode snippets.
Sorry...
|
|
|
|
|
I’ll do that tonite ( it’s 8:45 est by me ) wanted to fix up my code
Thanks
|
|
|
|
|
Question:
Replace all the vowels of the given input string with a single digit number.
Input:
String of length L and all lower-case letters.
Output:
Input String replaced with the digit.
Program explanation:
Replace all the vowels in the given input string with a single digit number you get after all the below
steps.
Step 1: Get the index of the vowel in the given input.
Step 2: Multiply the index with 100.
Step 3: Sum all the prime numbers between 1 and the resulting number from last step.
Step 4: Add the digits of the number you get from the last step until you get a single digit.
Step 5: Now, Replace the vowel with the digit from the last step.
Input:
hello
Output:
h7ll9
Explanation:
Step 1: First vowel found at index 1.
Step 2: 1 * 100 = 100
Step 3: Sum of prime numbers between 1 and 100 is 1060
Step 4: Sum of each digit until we get single digit:
= 1 + 0 + 6 + 0
= 7
Step 5: Replace e with 7
Output now: h7llo
Step 1: Next vowel found at index 4.
Step 2: 4 * 100 = 400
Step 3: Sum of prime numbers between 1 and 400 is 13887
Step 4: Sum of each digit until we get single digit:
= 1 + 3 + 8 + 8 + 7
= 27
= 2 + 7
= 9
Step 5: Replace o with 9
Final output: h7ll9
Example 2:
Input : replace this
Output. : r7pl9c1 th5s
|
|
|
|
|
|
Step 0: Get input.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hello Team,
I am getting the below error while building my MFC project.
C2065 'IUrlHistoryStg2Ptr': undeclared identifier
I have included the <urlhist.h> header file and it is there under the 'External Dependencies' folder.
Could you please suggest me how I can resolve the issue.
Thanking you,
Saikat Das
Software Programmer
|
|
|
|
|
|
|
And according to the discussion below the article Access Internet Explorer's History in MFC :
Quote: Go to Parentinsert these in IEHistory.h
typedef IUrlHistoryStg2* IUrlHistoryStg2Ptr;
typedef IEnumSTATURL* IEnumSTATURLPtr;
|
|
|
|
|
|
Message Closed
modified 15-May-23 19:07pm.
|
|
|
|
|
Member 14968771 wrote: I still cannot use my "old - few years " account. Then post a question at Bugs and Suggestions[^] and the administrators will help you.
|
|
|
|