|
Help with what? Please don't expect people here to do your work for you.
Veni, vidi, abiit domum
|
|
|
|
|
Dhananjay RajeNimbalkar wrote: plz help ....
Steps:
1. Learn the basics of C++.
2. Presumably you are going to do this from the command line so learn how to accept input and write output to the console in C++.
3. Learn how to parse a string (input)
4. Learn how arrays work.
5. Find source for a morse code map.
6. Put all of the above together to make your application.
|
|
|
|
|
Read and heed here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I did one of those many years ago. Since everyone's morse-code sending speed is a little different, you have to take this into account.
For a morse-code message you have pulses of different lengths. Sort the pulses by duration. Then look for the biggest gap between durations: This is the threshold between a "dot" and a "dash".
Now you can translate the pulses into dots and dashes, and the rest is just programming technique.
|
|
|
|
|
Hello everybody,
I am in project with win32.
I am using OPENFILENAME structure for selecting a file (GetOpenFileName()).
Problem is, it is possible to delete a file in browse dialog, which will create some issues.
is there any way to prevent deleting the files in browse dialog?
Regards,
A. Gopinath.
|
|
|
|
|
In order to have full control, you might implement the hook procedure.
Veni, vidi, vici.
|
|
|
|
|
This comes to mind.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I'm working with a MFC program based on DHTMLDialog in visual studio 2010, one problem is that sometimes IME is disabled in my program, which means I can only input English(no chinese) in it, another is that sometimes chinese can be input but the IME candidate window don't appear.( )
one cause of the first problem found is that flash disabled IME of the program via some C api.
How can I repair it? I try to use WINNLSEnableIME but seems to be no effective
Regards,
buaaxiao
modified 5-Dec-13 7:37am.
|
|
|
|
|
|
Hello,
I am learning MFC programming with the book "Programming Windows with MFC (2nd Edition)". I have some questions about the book example from chapter 9.
When I open a file or click new file, the function CSquaresView::OnDraw() is called. I checked the stack, the reason is that CView::OnPaint() calls this function. But I don't understand how CView::OnPaint() is called. Is the message WM_PAINT generated if CSingleDocTemplate::OpenDocumentFile() is called by the default setting? Is it possible to change the behavior?
Thanks,
Brian
|
|
|
|
|
My best guess is that the framework is drawing the view because a new document has just been loaded into it.
What is it you are trying to achieve?
Probably the only thing you can change is how the message is handled, not that the message is received.
Override the CView's OnWndMsg function to alter how any message is handled.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
The CDocument class calls UpdateAllViews which in turn sends a WM_PAINT message to each view to redraw itself. In some cases you need to make that call in your code to ensure your views are current. You should check the documentation[^] for further details about its behaviour.
Veni, vidi, abiit domum
|
|
|
|
|
I set a break point in CDocument::UpdateAllViews(). It seems that this function is not called when opening or creating a file.
|
|
|
|
|
I found the reason. When either creating or opening a file, CSingleDocTemplate::OpenDocumentFile() is called. Then it calls InitialUpdateFrame(). Then InitialUpdateFrame() calls CView::OnUpdate() and CView::OnUpdate() calls Invalidate(TRUE).
|
|
|
|
|
I think you can find some documents from google about WM_PAINT, it is called by windows message
|
|
|
|
|
Hello,
I am trying to implement a faster way to do 2x2 binning of a 1024x1024 matrix of byte (char) databyte in MFC. The end result will be in a 512x512 matrix. I can do this using two for loops, but I am looking for a faster and efficient way to implement this.
Any suggestions?
thanks
PKNT
|
|
|
|
|
Presumably you are using a byte lookup rather than a mask operation.
You can try indexing from end to end and then using two indexes one for the first row (say position X) and then one one for the second (X+1024). However that would then require an if test each time to skip the second row once you reached 1024.
|
|
|
|
|
hi
I'm programming a c++ client to receive packets from a server (UDP broadcast). This is a hardware switch (One direction only) system so I have no information regarding the senders address or any other info. It all compiles and binds OK but no packets received.
WSAStartup(0x0101, &_wsaData);
memset((char *)&_sockaddr, 0, sizeof(_sockaddr));
_sockaddr.sin_addr.s_addr = _nAdapterIp;
_sockaddr.sin_family = _nadressFam;
_sockaddr.sin_port = _usPort;
_socket = socket(_nadressFam, SOCK_DGRAM, 0);
char broadcast='1';
setsockopt(_socket, SOL_SOCKET, SO_BROADCAST, &broadcast ,sizeof(broadcast));
bind(_socket, (sockaddr*) & _sockaddr, sizeof (_sockaddr));
char* recvbuf = new char[_nPacketSize + 1];
int nSize = recv(_socket, recvbuf, _nPacketSize + 1, 0);
Any ideas? Thanks,
|
|
|
|
|
One important thing to do is look at the return codes for the methods that you are calling and your socket constructor, most times they will give you a clue about what is wrong. Also, what are values _nAdapterIp, _nadressFam, and _usPort? Could you be suffering from endian type issues?
|
|
|
|
|
sorry abut that, I shorten it so the code will be clear....
The actual code has the tests:
if (WSAStartup(0x0101, &_wsaData) != 0)
{
fprintf(stderr, "Could not open Windows connection.\n");
exit(0);
}
char broadcast= (char)1;
if (setsockopt(_socket, SOL_SOCKET, SO_BROADCAST, &broadcast ,sizeof(broadcast)) != 0)
{
fprintf(stderr, "Could not set socket options.\n");
WSACleanup();
exit(0);
}
etc....
|
|
|
|
|
arishri wrote: _socket = socket(_nadressFam, SOCK_DGRAM, 0); //Gave it a try with (17) - UDP for the 3 rd parameter - not working
How could you tell it wasn't working? I assume IPPROTO_UDP equates to '17'. When your application is running, and you go to DOS prompt and do a "netstat -a" do you see your socket with the proper port listed?
|
|
|
|
|
_socket = socket(_nadressFam, SOCK_DGRAM, 17);
_socket1 = socket(_nadressFam, SOCK_DGRAM, 17);
if ((_socket == INVALID_SOCKET) || (_socket1 == INVALID_SOCKET))
{
fprintf(stderr, "Could not create socket.\n");
WSACleanup();
exit(0);
}
|
|
|
|
|
Stick with one socket for now. If it still fails, call WSAGetLastError() and see what the error is.
|
|
|
|
|
int nSize = recv(_socket, recvbuf,_nPacketSize + 1, 0);
Get no packages here....
|
|
|
|
|
I couldn't be firewall related, could it?
|
|
|
|