Click here to Skip to main content
15,890,882 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
QuestionRe: [How to Convert data in textBox to .Txt file in Windows Form C++] Pin
Richard MacCutchan20-Nov-13 22:21
mveRichard MacCutchan20-Nov-13 22:21 
Questionstl thread safe Pin
G.aius.CodeCreator18-Nov-13 15:38
G.aius.CodeCreator18-Nov-13 15:38 
Questionwaiting on events for socket activity Pin
bkelly1318-Nov-13 14:05
bkelly1318-Nov-13 14:05 
AnswerRe: waiting on events for socket activity Pin
Orjan Westin19-Nov-13 23:03
professionalOrjan Westin19-Nov-13 23:03 
GeneralRe: waiting on events for socket activity Pin
bkelly1325-Nov-13 16:08
bkelly1325-Nov-13 16:08 
GeneralRe: waiting on events for socket activity Pin
Orjan Westin25-Nov-13 23:01
professionalOrjan Westin25-Nov-13 23:01 
GeneralRe: waiting on events for socket activity Pin
bkelly1326-Nov-13 8:07
bkelly1326-Nov-13 8:07 
QuestionWhat is the window argument in WSAAsyncSelect(...) Pin
bkelly1310-Nov-13 15:59
bkelly1310-Nov-13 15:59 
I am trying to figure out async sockets with the WIN API functions. My learning activity is to create a light-weight and fast class that can be used almost anywhere (within Windows OS of course) to create a TCP/IP interface. I used CAsyncSockets, got it working, but it was too slow. Blocking TCP/IP is fast enough, but has some difficulties I want to circumvent with async code.. In this article:
Programming Windows TCP Sockets in C++ for the Beginner[^]

The author references this call to set the socket mode to asynchronous:
//Switch the socket to a non-blocking asynchronous one
int PASCAL WSAAsyncSelect(SOCKET,HWND,u_int,long);


The MSDN page says the second argument is a handle to the window that will receive the messages.
Some details: I want to create a class that can be instantiated to create a TCP/IP interface from an application without a window interface. Specifically, my application will fetch telemetry data from some hardware, no user interface required there, I have the function calls to get the data. My app will open a socket as the server. When a client connects, it will send telemetry data to the user. No “window” or other user interface. No console window or DOS cmd window required or wanted.
Question: What can be put in as argument 2 for WSAAsyncSelect(…) Here it is from the MSDN page:
int WSAAsyncSelect(
  _In_  SOCKET s,
  _In_  HWND hWnd,
  _In_  unsigned int wMsg,
  _In_  long lEvent
);


Possible answer: The author included this next:

#define MY_MESSAGE_NOTIFICATION      1048 //Custom notification message

//This is our message handler/window procedure
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message) //handle the messages
    {
    case MY_MESSAGE_NOTIFICATION: //Is a message being sent?


It is not in the downloaded code and not described fully. Does this become the “window” passed in that argument?
Thanks for your time
If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig_106/


modified 10-Nov-13 22:09pm.

AnswerRe: What is the window argument in WSAAsyncSelect(...) Pin
Richard MacCutchan10-Nov-13 21:08
mveRichard MacCutchan10-Nov-13 21:08 
Generalcreate a window for callbacks Pin
bkelly1311-Nov-13 2:00
bkelly1311-Nov-13 2:00 
GeneralRe: create a window for callbacks Pin
Richard MacCutchan11-Nov-13 3:01
mveRichard MacCutchan11-Nov-13 3:01 
GeneralRe: create a window for callbacks Pin
bkelly1311-Nov-13 4:49
bkelly1311-Nov-13 4:49 
GeneralRe: create a window for callbacks Pin
Richard MacCutchan11-Nov-13 6:33
mveRichard MacCutchan11-Nov-13 6:33 
GeneralRe: create a window for callbacks Pin
bkelly1311-Nov-13 8:33
bkelly1311-Nov-13 8:33 
GeneralRe: create a window for callbacks Pin
Richard MacCutchan11-Nov-13 22:37
mveRichard MacCutchan11-Nov-13 22:37 
GeneralRe: create a window for callbacks Pin
bkelly1312-Nov-13 15:50
bkelly1312-Nov-13 15:50 
AnswerRe: What is the window argument in WSAAsyncSelect(...) Pin
Orjan Westin19-Nov-13 23:25
professionalOrjan Westin19-Nov-13 23:25 
GeneralRe: What is the window argument in WSAAsyncSelect(...) Pin
bkelly1321-Nov-13 14:51
bkelly1321-Nov-13 14:51 
QuestionMFC vs STL performance test Pin
Alexander Fedorov18-Oct-13 11:42
Alexander Fedorov18-Oct-13 11:42 
AnswerRe: MFC vs STL performance test Pin
Richard MacCutchan18-Oct-13 21:08
mveRichard MacCutchan18-Oct-13 21:08 
GeneralRe: MFC vs STL performance test Pin
Alexander Fedorov19-Oct-13 0:46
Alexander Fedorov19-Oct-13 0:46 
GeneralRe: MFC vs STL performance test Pin
pasztorpisti19-Oct-13 4:44
pasztorpisti19-Oct-13 4:44 
GeneralRe: MFC vs STL performance test Pin
Alexander Fedorov19-Oct-13 5:15
Alexander Fedorov19-Oct-13 5:15 
GeneralRe: MFC vs STL performance test Pin
pasztorpisti19-Oct-13 5:31
pasztorpisti19-Oct-13 5:31 
GeneralRe: MFC vs STL performance test Pin
Richard MacCutchan19-Oct-13 6:21
mveRichard MacCutchan19-Oct-13 6:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.