|
shir_k wrote: Should i need to write any code for copying data from control list
yes you have to write the code for implement same. look this code for copying data in to clipboard memeory http://www.codeproject.com/clipboard/archerclipboard1.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
HI,
I went through the link u have sent that doesn't matches with my requirement.First thing is am using control list box and am not having any button to copy.What i need is
1) Select the data in the control list by using mouse
2)copy by pressing ctrl+ C
3)pasting in a notepad or word document(outside the project).
Thanks
|
|
|
|
|
Use accelerator for Ctrl + C. Thus you will get the event (Ctrl+C press) and follow as ThatsAlok said
- NS -
|
|
|
|
|
Could u plz tell me how to use accelerator for Ctrl+c
|
|
|
|
|
From within the IDE, press Ctrl+R and select Accelerator from the list of types. Click the New button. Double-click the newly added accelerator item. Check the Ctrl checkbox. Type a C in the Key combobox. Press Enter. You should now have a Ctrl+C accelerator key. Check out the LoadAccelerators() function.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
you have to handle WM_KEYDOWN message for ctrl+c and there you have to read the text from listctrl and copy that into clipboard.. which can be copied anywhere using ctrl+ v
|
|
|
|
|
Hi Guys,
Can u ppl please explain step by step how to do it.Sorry for the trouble.
Am writing code in MFC Application.
Thanks for the help i was able to do it.
-- modified at 1:33 Wednesday 12th September, 2007
|
|
|
|
|
I would like my UDP server to send the data when the client connects; say at a rate of 100 msec.
But I can only get it working when the Server does a receive first (so the client has to do a send) then the Server does the send.
Can this be done? The server fails if I do not do the Receive and the client fails if I dont run the server first.
See code below:-
while(g_bUDP_Socket_Created && g_bUDPStatus)<br />
{<br />
bytesRead = recvfrom (conn_socket, (char *)&RxBuffer, sizeof(RxBuffer), 0, (struct sockaddr *)&from, &length);<br />
if (bytesRead == SOCKET_ERROR) <br />
{<br />
g_szFormatting.Format("Couldn't receive data, %d",WSAGetLastError());<br />
::MessageBox((HWND)NULL,g_szFormatting, NULL,MB_ICONEXCLAMATION );<br />
closesocket (conn_socket);<br />
WSACleanup();<br />
return -1;<br />
}<br />
<br />
retval = sendto (conn_socket, (char*)TxBuffer, sizeof(Tx_Data), 0, (struct sockaddr *)&from, fromlen);<br />
if (retval == SOCKET_ERROR)<br />
{ <br />
g_szFormatting.Format("Couldn't send data, %d",WSAGetLastError());<br />
::MessageBox((HWND)NULL,g_szFormatting, NULL,MB_ICONEXCLAMATION );<br />
closesocket (conn_socket);<br />
WSACleanup();<br />
}<br />
}
|
|
|
|
|
Are you getting an error? If so, what is the error code returned by WSAGetLastError()?
Andy202 wrote: say at a rate of 100 msec.
That isn't a rate, that's a duration.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
If I comment out the receive I get error 10057 on the send.
All I want to do is transmit a UDP message at 10Hz. The client can be running or not. I will use port 5001, but I do not need to know the client PC.
The client will need to know both Port and PC - correct?
Andy.
|
|
|
|
|
Andy202 wrote: If I comment out the receive I get error 10057 on the send.
The error is WSAENOTCONN.
That's expected since you're using the "from" address from the recvfrom(),
which isn't going to be a valid address without a successful recvfrom() call.
Andy202 wrote: I would like my UDP server to send the data when the client connects;
UDP is connectionless so you don't know if a client is connected or not.
It sounds like you need to either...
1) Keep track of clients that are listening - that would mean a client has to send a notification to
the server when it's ready to receive datagrams. The server can store a list of "connected" clients and
send the periodic datagrams to every address on the list.
2) Broadcast the periodic datagrams. Set the socket option SO_BROADCAST on the socket and send
to the broadcast address (INADDR_BROADCAST). The clients need to set the SO_BROADCAST socket option
as well.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks again for your Post Mark, I now get Error = 10057 when the Client is not running and Error = 10093 when the Client is running.
local.sin_family = AF_INET;<br />
local.sin_addr.s_addr = INADDR_BROADCAST;<br />
local.sin_port = htons(port);<br />
<br />
conn_socket = socket(AF_INET, socket_type, 0); <br />
<br />
if (setsockopt (conn_socket, SOL_SOCKET, SO_BROADCAST, (char *) &TxBuffer, sizeof (TxBuffer)) == SOCKET_ERROR)<br />
{<br />
closesocket (conn_socket);<br />
g_szFormatting.Format("setsockopt() failed: %d\n",WSAGetLastError());<br />
ReportMessages(g_szFormatting);<br />
WSACleanup();<br />
return false;<br />
}<br />
<br />
if (setsockopt (conn_socket, SOL_SOCKET, SO_REUSEADDR , (char *) &optval, sizeof(optval)) == SOCKET_ERROR)<br />
{ <br />
g_szFormatting.Format("Couldn't set SO_REUSEADDR %d\n ", WSAGetLastError());<br />
ReportMessages(g_szFormatting);<br />
closesocket (conn_socket);<br />
WSACleanup();<br />
return false;<br />
}
And in the Writer Thread:-
while(g_bUDP_Socket_Created && g_bUDPStatus)<br />
{<br />
<br />
retval = sendto (conn_socket, (char*)TxBuffer, sizeof(Tx_Data), 0, NULL , 0);<br />
if (retval == SOCKET_ERROR)<br />
{ <br />
g_szFormatting.Format("Couldn't send data, %d",WSAGetLastError());<br />
::MessageBox((HWND)NULL,g_szFormatting, NULL,MB_ICONEXCLAMATION );<br />
closesocket (conn_socket);<br />
WSACleanup();<br />
}<br />
Sleep(1000);<br />
}<br />
closesocket(conn_socket);<br />
WSACleanup();
|
|
|
|
|
Error 10093 WSANOTINITIALISED Successful WSAStartup not yet performed
Also...
You need to create a proper UDP socket:
conn_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP
); <br />
<br /> and sendto() needs a destination address.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
One final question Mark, if I just want to Broadcast UDP packets out on a local network, what destination address do I use?
|
|
|
|
|
Andy202 wrote: I just want to Broadcast UDP packets out on a local network, what destination address do I use
You could use the limited broadcast address 255.255.255.255 , however it is best to use the correct IP broadcast address of your local network segment (more successful in my own experience). You can calculate the correct broadcast address, see here.
/M
|
|
|
|
|
Hi,
I need any sample..code or advice for usb communication in MFC.
I need to do read and write operations on a usb device..
thanks in advance
Ashok
|
|
|
|
|
Which kind of device are you communicating with ? USB doesn't work like a serial port: you don't have access directly to the port but instead you get the handle of a driver. This driver is shipped with the device you want to communicate with and manages all the communication with the device.
To get the handle of the driver, simply call CreateFile supplying the correct driver name, then you should be able to use ReadFile and WriteFile. You can also do some more specific stuff by calling DeviceIOControl (in which you can pass some specific IO code which is dependent of your driver).
So, if you want more help, you'll need to give a lot more information (which device do you try to access, if you have documentation with it, ...).
|
|
|
|
|
can anybody help me make a program that can do any of these numerical method?
moss,newton method, secant method, taylor-maclauren,bisection method,gaussian elimination, gauss-seindal,lagrange method.
thanks guys!!
|
|
|
|
|
homework?
don't tell me that you don't find the way to implement the secant-method or bisection method !
You have only to implement the algorithm:
ask for a function f(x) and for the borders x1 and x2.
check that sign(f(x1)) != sign(f(x2)) .
Then compute x3 inside the interval (x1, x2). This according on the algorithm, in bisection case x3=(x1+x2)/2,....in secant method it's only the point where the line from (x1,f(x1)) to (x2,f(x2)) intercept the x-axe.
then choose the new interval (or x1-x3 or x3-x2) according on where is the root.
Then start again on the new interval.
Do this 10000...000 times and stop it. Or stop when the interval is "too small".
That's it.
Russell
|
|
|
|
|
thanks russell!
it a project actually..
|
|
|
|
|
ok, you convinced me.;)
Then you won this link[^].
(the routines are in C, not in C++. but it is easy to translate they)
Russell
|
|
|
|
|
thanks for the link that's really helpful.
|
|
|
|
|
mitsui58 wrote: can anybody help me make a program that can do any of these numerical method?
Yes, I'm sure someone can.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
you can use the GNU scientific library.
It will give your the needed method.
|
|
|
|
|
Can any one suggest me some ways to monitor the cts pin of the serial port using DCB.
S.Yamini
|
|
|
|