|
If I do some C++ programming and I get to the point where I wish to make some graphical programs, I'm kind of leaning in the direction of using wxWidgets. Was wondering though if there are some books out there that explain things.
I hate to look at code and not know what this word means or this symbol.
For example if I see that something reads:
wxFrame* window = new wxFrame(NULL, -1)
I can't stand not knowing what each part of that means.
So my question is are there any books that do a good job of explaining things like that which I will undoubtedly run into?
I do recognize some of that since I've done some Java which always uses classes so.
|
|
|
|
|
This will help you to get started,
wxWidgets tutorial[^]
and for the quick help on things you may post the question here
wxWidgets Discussion Forum - Index page[^]
This is an active forum like CodeProject but especially for wxwidgets and if you have any doubts regarding wxWidgets you can post your question there and you may get a response quickly. I tried.
|
|
|
|
|
Hi
I have CAsyncScoket Class In CwinThread (UI)
I know all the notification are done in the Context Of the MainThread
When I do get notification from lets say a OnSend I have the Threadid in the CAsynSocket
class and Do A PostThreadMessage to the thread to do the send
However I am trying to Close the Scoket in the same thread I created it
All the while whether in the main thread or CwinThread the m_hSocket value is the same
|
|
|
|
|
Without seeing your code this can't be answered.
But some possible reasons are:
- The socket has been closed already
- The function is called from another thread
- The socket has been detached
- You have a statically linked MFC application, created the socket in a secondary thread, and did not call
AfxSocketInit in that thread
|
|
|
|
|
If you just got done writing some C++ code and naturally you want to save the file, you tell Windows where you want to save it and then you will see in the bottom field the Save as Type question. If you choose .cpp, and just do that alone the file will not be saved as a C++ source file.
I don't get it.
Seems to me if you tell it that you want to save it as a .cpp source file then all you should have to do is just figure out what you want to name your file and that's all.
But you actually have to give the file the .cpp extension yourself.
You can't just do this: My Program
You have to do this: My Program.cpp
Why?
|
|
|
|
|
Member 12974235 wrote: ...the file will not be saved as a C++ source file. What will it be saved as?
Member 12974235 wrote: You can't just do this: My Program What happens if you do?
What editor are you using?
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 13-Feb-17 8:32am.
|
|
|
|
|
That is correct, Windows cannot guess what type your file is.
|
|
|
|
|
Well if the drop down box says Save as .cpp file, Windows does not have to guess. It should be saved as a .cpp file. Otherwise we have a wasted box with useless info in it.
|
|
|
|
|
I guess you think there is something special about a .cpp file. It is just a text file that (may) happen to contain C++ source code. But that means nothing to Windows, it is just a convenience for us humans.
|
|
|
|
|
The file type recognition is controlled by windows and windows by default doesn't know what a .CPP is or many other types for that matter. More distinctly it doesn't know what program to associate to the file type. That is all done via the File Type Association widget in control panel in windows. The save file dialog is a common control dialog from windows and it is it that is directing the prompt.
Usually any good installer for a C++ program makes the changes for association to the file type for you. So either you have a lazy installer for a C++ program or it made the association and you have since broken it.
Whatever the case stop complaining about it and go fix it in the File Type Association widget in the windows control panel. If you need assistance an internet search on "File type association on Windows" should give you a multitude of links to work with. It's a bit like complaining when you click on a .BMP file it doesn't open it in the right editor, yeah so go fix it.
As an extra helpful tip I can tell you that on the file type association it is useful to select plain text filter onto the .CPP file type. That allows windows searches to go inside your .CPP files on a text search. It is sometimes useful if you have a lot of code directories (like I do) to find a specific block of code if you know something unique about it. You can do a computer wide search for the text string in a .CPP file and it has saved me hours of searching.
In vino veritas
modified 15-Feb-17 23:41pm.
|
|
|
|
|
Please direct me to an article that discusses the difference between a UDP Server application and the Client application.
So far I surmise that the server starts with no knowledge of where a client might be. It can either begin broadcasting data (this is my current need) or listen for a client to connect.
On the other hand, the client must know the address of the server and it either begins listening for broadcasts from the server or it sends a message to the server to accomplish something, such as to solicit some information from the server.
Thank you for your time
|
|
|
|
|
Google for "sockets udp" and you will find plenty. Be aware that if you use UDP then you need to implement your own protocol for checking that all messages get processed, and in the correct order.
|
|
|
|
|
I have done that. Here is the first page of results from my good search for “udp sockets”
Before providing the list, I do suspect that if I already knew the differences I may well find that information in these sites. As I do not, that information can be rather difficult to pick out.
https://www.cs.rutgers.edu/~pxk/417/notes/sockets/udp.html
goes right to code, does not discuss the difference
http://www.cs.dartmouth.edu/~campbell/cs60/socketprogramming.html
does not discuss why there is client and server with UDP
https://en.wikipedia.org/wiki/Network_socket
does not discuss
https://www.w3.org/TR/tcp-udp-sockets/
Section 9 begins UDP, jumps right into code with no explanation
Just for the record, this is the most thorough discussion I have found
http://www.binarytides.com/programming-udp-sockets-c-linux/
does not discuss the differences
https://www.abc.se/~m6695/udp.html
does not discuss
https://developer.chrome.com/apps/sockets_udp
does not discuss
https://cs.nyu.edu/~bacon/phd-thesis/diss/node32.html
does not discuss the differences
https://wiki.python.org/moin/UdpCommunication
“server” is in the article in only one place discussing a Windows bug
http://www.microhowto.info/howto/listen_for_and_receive_udp_datagrams_in_c.html
Starts off with:
Suppose that you wish to write a server that implements the …
But does not address the differences.
References RFC 867 which does not discuss the differences
Do I need to continue?
I am looking for a discussion on the differences between server and client in UDP operations. Not in the code difference but in the difference in concept between the two. Looks to me like two servers or two clients can well carry on a conversation via UDP packets.
Thank you for your time
|
|
|
|
|
There is no big difference, apart from the fact that the server is (usually) passive and the clients active. I'm not really sure what your real issue is, since this is not anything specific to UDP.
|
|
|
|
|
There is no requirement for handshaking on UDP so who is server and who is client is purely notional.
In human perspectives it's like two people talking on a CB band and one claiming they are the server and the other the client. The answer is purely in the eyes of the beholder and it is completely meaningless to the operation.
It is the EXACTLY the same situation you have two parties chatting using UDP and no-one is in control. Either party can choose a) not to send or b) not to listen and so the idea of who is server and who is client is pointless. Generally the thing that makes that decision is where the data is coming from and going to which has nothing to do with the protocol. However for any situation you gave me I could always argue the server is the other end to the one you choose (you just have to pick the right criteria).
To give you an example consider SNMP packets sent from a router back to be logged to a central site (your ISP usually has a display log of your data usage using this). Is the SNMP server the central site or is it the router sending the SNMP packets? Well if you goto the router settings they will generally call themselves the SNMP server. Most likely your SNMP monitor software will also call itself a server because it has the database and is running on an actual server. So which is server and which is client .. well non-one cares it changes nothing
In vino veritas
modified 12-Feb-17 13:12pm.
|
|
|
|
|
Hi there,
I have an application which requires to read the credentials and login to the DB.
Since my application runs on schedule, someone has to fed in the credentials.
Storing the credentials in flat file with any encryption (including DPAPI) is not helping as the entropy will be stored in the same file and it can be easily retrieved.
Thought of having the Salt for the entropy in-memory which will be key-ed in by the user through an application that will be written on a secured shared memory and the same will only be able to access by my own process (with validating the Digital signature thump print).
The provision of creating the shared segment is done by a DLL and the Client process which sets the password and my process which reads the password is digitally signed and I can validate the same in the DLLMain - PROCESS_ATTACH. If the digital signature is invalid, I'm unloading the DLL by terminating the same.
All worked well with LoadLibrary API and when we tried testing with LoadLibraryEx with the option: DONT_RESOLVE_DLL_REFERENCES, it was not hitting the DLLMain and was able to call all the exported functions.
My query is that is there a way to securely share a data between two trusted application alone?
The application is developed using C++.
thanks in advance,
Rajesh Iyer
|
|
|
|
|
You can use a memory-mapped file with an obscure name. This won't prevent a hacker from being able to see the file but it will be far from obvious. You can obscure the data you place in the MMF by negating it or something simple like that.
Another way is to use an interprocess communication mechanism. Some examples are pipes, sockets, the WM_COPYDATA message, and there are others. It is possible for a socket message to be intercepted but the other two are much more difficult to spoof.
|
|
|
|
|
Hi
I re-wrote my IPC methodology in the following manner
Since I am creating the child process GUI I have the option of inheritable handles. One of those is a event which I signal
From the console app to the MFC application
The event lives in a worker thread which basically has 2 api's WaitForSingleMessage and once signaled a PostMessage. The m_hWnd is the CMainFrame main window I create in the main thread CWinApp
Thing is like the SendMessage which I was doing from process to process I now have intermittent errors with this too
I tried AfxGetMainWnd()->PostMessage seeing if maybe there was something wrong with the HWND
First off is there any problem using a m_hWnd created in the main thread in worker thread to send a message
I have read about thread maps of handles I am not sure if it relates to my scenario
Thanks
|
|
|
|
|
ForNow wrote: I tried AfxGetMainWnd()->PostMessage seeing if maybe there was something wrong with the HWND First off is there any problem using a m_hWnd created in the main thread in worker thread to send a message
It is not correct according to AfxGetMainWnd: "If AfxGetMainWnd is called from the application's primary thread, it returns the application's main window according to the above rules. If the function is called from a secondary thread in the application, the function returns the main window associated with the thread that made the call."
And "yes", you can pass "a m_hWnd created in the main thread in worker thread to send a message" from a worker thread.
|
|
|
|
|
Thanks for your help my code as seems to be posting messages i added the ChaneWindowMessageFilterEx per jochen don't know if It's needed if posting in the same process and it seems that my messages to delivered
|
|
|
|
|
Hi,
I am working in vc++ mfc and i have been stuck some where I want to overwrite a selected Image in a particular path. Please help out me
|
|
|
|
|
raajpatel wrote: I want to overwrite a selected Image in a particular path That is rather unclear. Please edit your question and be more specific.
Are you referring to an image file stored on the disk with known path and file name?
What is the image source that you want to store (another file, a bitmap in memory)?
What image format should be used (BMP, JPG, TIFF, PNG)?
|
|
|
|
|
Hi,
I want to replace same image and over same path with resized on a disk and format is "gif" file
|
|
|
|
|
You can use the CImage Class[^]. Use the Save() function with ImageFormatGIF to save the image as GIF.
How to create the CImage depends on the source. It can be loaded from file or passed an existing in memory bitmap.
|
|
|
|
|
'An image on a particular path' sounds like a file, to me. To overwrite the file, open it for writing and do write the new image data to it.
|
|
|
|