|
|
That looks useful. My TCP app can post messages to a dialog so the user can determine the state of the thread. One dialog might display the status of several instances of the message app. I will have to figure out how the app will get the ID to that dialog, but it may well be useful.
Thank you for the tip.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
Messaging is likely the best alternative (although not the only option). It is also common for people to make invisible windows simply for the messaging mechanism (instead of handling it by hand as in the article below).
Your other alternative could be to have the window occasionally check a critical section (or mutex) protected variable to know the current state.
modified 6-Jun-14 12:42pm.
|
|
|
|
|
This MFC dialog is just a test vehicle to develop the classes and thread that will perform all the TCP/IP I/O. I will add a button to poll the events set by the TCP code, or maybe a button that starts a timer that leads to a poll every couple of seconds.
Thanks for taking the time to reply.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
I use the polling method for high-frequency updates to a GUI. Since messaging can lead to a flood of messages updating things at such a high-rate you probably wouldn't make out the least significant digits.
|
|
|
|
|
I have a win32 COM which is developped to work as win32 and it can be registred to run as surrogate dll with client application x64.
1) Before modification of it to be called into out_of_procces,this dll use Microssoft.Jet.oledb.4 to connect and create mdb files.and this was working fine.
2) after the modification to let this dll be loadded by x64 application as surrogate and changing the Microsoft.Jet.oledb by Microsoft.ACE
This dll not work now when version of office is x64.
And this is normal because it is x32
Questions:
- can i check at run time if the dll is registred as x32 or x64 ?
- if yes can i define the driver of office related to the version of dll at run time
Ie:
If registred as 32 then use Microsoft.Jet.oledb
Else if dll surrogate (x64) then use Microsoft.ACE
Thank you
|
|
|
|
|
Hi,
Think outside the box. By calling the IsWow64Process function[^] you can detect whether or not you are loaded into a 32 or 64 bit process and act accordingly.
Best Wishes,
-David Delaune
|
|
|
|
|
Windows 7, Visual Studio 2012, winsock
Edit: Oops, posted in ATL rather than C++. If you are an admin type, please move it.
How is an event associated with a socket operation? For example:
[code]
iResult = listen(ListenSocket, 1);
[/code]
The socket is non-blocking and the code continues while waiting for the listen operation to complete. I want event: CLIENT_DETECTED (arbitrary name, I know how to create the event.) to be triggered when a client solicits a connection. Yes, I understand a bunch of code is needed to capture that event and do something.
Thank you for your time.
modified 18-May-14 22:06pm.
|
|
|
|
|
|
Hello,
OK, its there as in:
Quote: Note When issuing a blocking Winsock call such as listen, Winsock may need to wait for a network event before the call can complete.
I presumed that it could also be non-blocking. Then they carry on with:
Quote: Winsock performs an alertable wait in this situation, which can be interrupted by an asynchronous procedure call (APC) scheduled on the same thread.
So in order to kill the program when no client comes a-calling, I need to learn this. I will search but if you have a link to a good article on this, that would be appreciated.
Thank you for your time.
Edit: While re-reading the MSDN page on listen(), I noticed that the words are:
Quote: ... Winsock may need to wait for a network event....
Directing attention to the word "may," that means that there are circumstances in which Winsock does not need to wait for a network event. Should that statement have stated that Winsock "will" wait for a network event? Or is there another way out of the Listen call?
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
modified 19-May-14 19:46pm.
|
|
|
|
|
bkelly13 wrote: Should that statement have stated ... I cannot answer for Microsoft's wording. My reading of it is that listen always blocks for a connection to complete, it should not be too difficult to test.
|
|
|
|
|
I am going with that.
Thank you for taking the time to reply.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
I have finally progressed to the point of testing the listen() function. This app sets non-blocking attribute and the code steps right over the listen() call, with a noticeable pause.
Now the question becomes: Is there a proper method of stopping a listen in progress? There are WSASend() and other socket methods with additional arguments, but I did not find a WSAListen(); I will post that as a new question.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
How implement "my icon in system tray always visible"?
thanks.
|
|
|
|
|
What icon are you referring to, and what has this to do with ATL/WTL/STL?
|
|
|
|
|
ATL/WTL/STL has nothing, but I do not now how can I do this .
Maybe i can do this use registry windows or something else...
|
|
|
|
|
Member 10402390 wrote: ATL/WTL/STL has nothing So why have you posted in this forum?
Member 10402390 wrote: Maybe i can do this use registry windows or something else. Maybe you could give a proper explanation of your problem.
|
|
|
|
|
Richard MacCutchan wrote: Maybe you could give a proper explanation of your problem.
my problem:
my icon in system tray must be always visible
|
|
|
|
|
I'm sorry but that is nowhere near an explanation, it's merely a statement of what you want. No detail about the environment, programming language, what icon you are talking about etc.
|
|
|
|
|
Richard MacCutchan wrote: what icon you are talking
tray icon - obtained when the program is minimized to tray...
|
|
|
|
|
Hi,
I am using my own gridview derived from Clistview.
My problem is to make the first column always fixed on Horizontal scroll.
Can anybody knows the best solution for this in MFC..
Thank you in advance...
|
|
|
|
|
No, but you might get a better answer if you post it in the MFC forum.
|
|
|
|
|
Windows 7, Visual Studio 2012, MFC, TCP/IP operations using API calls for high data rate application
I am writing a TCP/IP thread to send data to a display device. It is a high data rate output utility and will use overlapped I/O and WaitForMultipleObjects(…) to detect when the outputs are complete. The event array has 23 events and the last 16 are for an array of 16 buffers used to output the data.
The obvious way is to use a switch statement to detect each event returned by WaitForMultipleObjects(…). Can I do this instead?
Note: All this pseudo code is for illustrative purposes only. None is expected to compile much less run.
message_pointer message_address_array[ 16 ];
…
event_detected = WaitForMultipleObjects(
EVENT_ARRAY_SIZE,
mp_common_data->event_array,
WAIT_FOR_ANY_EVENT,
WAIT_TIMEOUT_VALUE );
Switch( event_detected )
{
case EVENT_START_RUNNING:
{… break;}
case IO_EVENT_01:
case IO_EVENT_02:
case IO_EVENT_16:
{
event_index = event_detected – IO_EVENT_01;
message_address_array[ event_index ] = 0;
break;
}
Default {…}
}
Will this concept work? Will it be faster than a separate case for each event? I think it will be easier to maintain.
Or: I just thought of this: Before the switch do this:
event_index = event_detected – IO_EVENT_01;
if( event_index >= 0 && event_index <= LAST_EVENT )
message_address_array[ event_index ] = 0;
else
switch(…) etc, etc
Obviously there would be error checking and significant overhead code. To the core question, in either case, I would be doing event arithmetic, in a fashion. Is this concept valid?
Again, this does not pretend to be working code, just some pseudo statement to illustrate a concept.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
|
|
|
|
|
I have used similar constructs in the past and they work fine. Whether it is the 'right' way can only be determined by testing.
|
|
|
|
|
The logic is correct as WAIT_OBJECT_0 , WAIT_OBJECT_0 +1, ... are basically a constants and with switch it is valid to select between constants. However if your application is a high data rate app then be careful with the "linear search" of the WaitForMultipleObjects() function! It is actually documented (check its msdn page) that this function always returns the FIRST signaled handle from the array. This means if you have a "hyperactive" handle near the beginning of the array then the rest of the handles at higher indexes will starve. One technique to defend against this is "rotating" items in the array (or maybe a more fair algorithm is moving the currently signaled handle to the end of the array...).
In case of Overlapped IO I would rather suggest using an IO completion port (shortly: IOCP) that isn't hard to plumb on top of your existing overlapped code, the difficult part is the overlapped IO that is ready in your case.
|
|
|
|