Message pumping? - winforms

In Winforms, there is a concept called "Message pumping". Is there an explanation of what all of this is, and why it's important?
Thanks

I would suggest you start here:
http://msdn.microsoft.com/en-us/library/ff381409%28v=VS.85%29.aspx
This explains how the basics of how Windows works, and is directly from Microsoft.
I would suggest following through the hierarchy of links provided on that particular MSDN tutorial (follow the links marked "Next" at the bottom of the content on each page).
This link may be a more direct answer to your question:
http://msdn.microsoft.com/en-us/library/ff381405%28v=VS.85%29.aspx
If you really want to understand the inner workings of Windows, I would suggest obtaining a copy of this book:
Windows programming with C++ - ISBN-10: 0201758814

Have you tried wikipedia?
Microsoft Windows programs are event-based. They act upon messages that the operating system posts to the main thread of the application. These messages are received from the message queue by the application by repeatedly calling the GetMessage (or PeekMessage) function in a section of code called the "event loop."

Related

C GTK2 frustrated with gnome documentation

I have been attempting to create an app using C in Code::Blocks on Win7.
Can anyone please point me to a better documentation then the gnome site? Or failing that, can someone point me to a place I can see which signals are allowed for which widgets?
I recently wrote an app using Python and found TKinter to be very good, and every time I searched Google for help on TKinter the documentation was easy to read and understandable.
The gnome GTK documentation, however, is really bad. Yes, it does describe each function, but doesn't lead you to the other parts needed to get a full understanding of the function.
They go into great detail in some cases, actually including an entire program as an example (without comments in the code I might add,) totally obscuring the forest trying to describe the tree.
I don't want to get too bogged down in a detail of my problem now, but this is an example of my frustration.
Specifically, I am attaching a signal to an entry widget, and I can find the g_signal_connect declaration that gives the parameters needed, like the instance, the_signal, the handler and such, but nowhere does it say WHICH signals can be used.
I guess it is because each widget may use a different subset of signals for the signal, but, to date. I have not found even a list of signals available let alone which ones can be used on which widgets.
I can find the gtk_entry_new() definition, but again, that description doesn't give a list of allowable signals. Just how to call it.
I saw an example that uses the "insert_text" signal, but that isn't really right, another site says there is an "activate" signal, but that only works if the user presses enter, not if the user clicks elsewhere in the window.
Any help is appreciated.
Mark.
I've already seen that doc issue. The way the doc is generated has changed and it seems this broke some parts of GTK+ 2 generated doc. Now, you shouldn't be using GTK+ 2 in the first place. GTK+ 3 has been the stable release for years now, and GTK+ 2 should only be used in legacy projects. GTK+ 4 in on its way to be released this year.
To know which signals can be used on which widget, you just have to go to the "signals" section of the documentation page of that widget. For example, here are the signals specific to GtkEntry. Each widget doc page has a top bar with several section shortcuts, with links to the sections you want:
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Style Properties | Signals
You see the last one is about signals.
Now this is only for signals specific to the class. This is object-oriented programming, so you can also use the signals from the parent classes as well. Just click on the "Object Hierarchy" link and you'll be sent on the inheritance diagram of the class. From there you may explore the parent classes, and then their signals.
You may also want to install the Devhelp program, which give you a search-as-you-type entry and gathers the docs of lots of other libraries on which GTK+ and the GNOME platform depend (cairo, pango, etc.). Install it with your package manager, and you'll have access to offline help for all the development packages you installed, and at the versions you're really using.

How does a Client (Written in C) listens to a request on Linux OS?

I am a beginner and I want to understand some basics of Client-Server applications written in C (I understand web based server-client applications written in Java, PHP ,etc).
To be more specific, I am talking about ZABBIX which is a client-server tool (Zabbix_server is a server and zabbix_agentd is a client, both written in C).
Zabbix_server asks zabbix_agentd for data and zabbix_agents responds accordingly.
I have imported zabbix codes on Eclipse and have tried to debug to understand codes. A complete execution of zabbix_agentd on Eclipse just launched the daemon successfully and created a child process. But when I check the log, I find that different functions are being called which had not come in the way while debugging. It means, these functions are called by some process, may be inetd, etc. (correct me if i am wrong). I tried to find inetd on RHEL 6.4 OS, but it was no where found (using "service inetd status", "find").
So, how those functions are being called? Can anyone please give me ideas about that?
Please suggest me how to use those calling requests to further debug my client application.
One thing I have noticed while debugging Eclipse is that, I get below error after calling fork():
No source available for "fork() at 0x36ca0acbc0"
I couldn't understand the impact of the above error as the daemon keeps on working after this error also.
I browsed through similar error different people getting and found that their binaries were not linked to sources. However, my binaries are linked to sources also. I mean, expanding the binary of zabbix_agentd shows several *.h and *.c files.
As this error terminates the debugger immediately but the line of code at this occurrence is the last line of the source file also. So, I cannot say if I need to take care for this error.
Is this error the reason why I am not able to view other functions being called?
Please let me know if more information is required.
Thanks in advance.
Regards,
Rohit

How to attach c console application to running process

I want to attach a C program to working process so i can hook it and work on it's memory
Note: I'm not talking about DLL i want my console application to attach and edit on memory and work it self out.
Thanks in advance..
It sounds like you're looking for the Windows Debugging API, specifically the functions DebugActiveProcess(), WriteProcessMemory() etc.
There are some complete examples available at debuginfo.com (I haven't looked at them in detail).

What does explorer use to open a file?

I am attempting to hook into whatever explorer calls when a file is opened (double-click, context menu open, etc.), however I can't figure out which function that is.
Originally, I thought it was ShellExecute, as that does the same thing as far as I can tell, but after hooking into it I learned that it's only used when a new explorer window is opened.
Any ideas which function I should be hooking?
It sounds like the AppInit_DLLs registry key should be good enough.
Make a simple DLL and call the GetCommandLine() in your DllMain function to get the full command line to the application being executed.
There are the ShellExecute hooks, but now (after XP) are deprecated because everybody used them for the strangest purposes. Have a look at this for some more detail, and at this for some documentation.
If you want to intercept these things, just register yourself as the default verb for shell items. Here are some samples.
If you just want to know if someone has change some files you are interested in, you should register for change notifications via FindFirstChangeNotification() and related APIs.
Much simpler than writing a device driver ( but much less amusing ) is the MS research tool detours. Have fun!

How to programmatically edit the routing table

I am writing a daemon running on an embedded platform that needs to change the default route of the device according to which interface it is connecting on at a given time. How can I do this programatically? I know I can use system("route del default && route add default gateway blah"); etc but is there a more direct way?
UPDATE: I solved my particular problem by discovering a patch to pppd that allows a replacedefaultroute option. The patch also includes code for programmatically modifying the routing table. It is included in this gentoo bug report http://bugs.gentoo.org/227321
Check out SIOCADDRT/SIOCDELRT ioctls (Stevens' "Unix Network Programming" would be a good reference.)
I typed
man route
cause I know sometimes I can get a hint in the "see also" section for how to do the same thing programatically. I saw there was a man page on page 4 for "route" (route(4) was in the see also section). So tried
man 4 route
and it looked promising for doing what the route command can do programmitically.
Note I just noticed this is only for BSD systems. Here is a URL with the manpage
http://www.manpagez.com/man/4/route/. This may or may not be helpful. Maybe you can google some of the stuff in here and add the word "linux".
I would recommend just using that route command. Thats what it's there for, and anything else will just be a hack.

Resources