|
For 95% of programmers there are no important protocols. You'll just use a programming library to interface with the network. With TCP/IP you'll be using sockets (although older UNIX variants use another API known as TLI - I've not seen it in the wild in years though).
So for the programmer the API is the most important thing. Sometimes it's helpful to know the details of the protocols you're using (i.e. when something goes wrong and you're forced to use a packet sniffer or the like) but it's not a daily occurrence. The most useful protocols to know about are probably TCP and DNS as they're the things you're closest to when you're programming.
Cheers,
Ash
Edited as I messed up the author, confusing him with Doug Comer whose books cover the same ground
|
|
|
|
|
Transparent:It means there is no background pannel.The toolbar just looks like a floating imagelist(picture shaped button).
Enlarge:It means when the mouse hover on ,the hot icon would enlarge,bigger than the others,and would restore to it's original size when the mouse leave.
More:It would be much better if I can use png format pictures as resource.PS: Not use .Net Framework.(USE VC6 or VC2005)
Any suggestions would be fine!
Much thanks
|
|
|
|
|
I'd say, use Layered window(s)[^], handle mouse messages like WM_MOUSEMOVE[^], use GDI+ for loading PNG images from resource[^] or CxImage[^], possibly you could also need TrackMouseEvent[^] to know when the mouse leaves. I hope these pointers can help you start off in the right direction.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
Thank you for so much information. I can swim now.
|
|
|
|
|
Happy dabbling.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
|
Please, don't cross post. You have already posted the same question on Q&A (and you got an answer there).
|
|
|
|
|
Hi All
I am try find out UAC is Enable or Disable through this code
HKEY pHKey;
BYTE pData[64];
DWORD type = REG_DWORD;
DWORD size =64;
LONG uVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System",0,KEY_ALL_ACCESS, &pHKey);
if(uVal != ERROR_SUCCESS)
{
}
RegQueryValueEx(pHKey, _T("EnableLUA"), 0, &type, pData, &size);
if(pData[0] == 1)
{
}
if(pData[0] == 0)
{
}
RegCloseKey(pHKey);
But it always show Enable.If UAC is enable or disable.
Please help me.
|
|
|
|
|
Why didn't you check RegQueryValueEx return value?
Anyway I would do:
...
DWORD dwEnable;
size = sizeof(dwEnable);
...
LONG lRet = RegQueryValueEx(pHKey, _T("EnableLUA"), 0, &type, (BYTE*) &dwEnable, &size);
if ( lRet != ERROR_SUCCESS)
{
}
else
{
if(dwEnable == 1)
{
}
else
{
}
}
[added]Thanks to MsmVc for pointing out the mistake[/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Saturday, November 20, 2010 8:20 AM
|
|
|
|
|
Thanks for reply
modified on Saturday, November 20, 2010 7:03 AM
|
|
|
|
|
One more thing i want to discuss with you.When i follow your step then i am getting UAC Enable or Disabled in Windows 7.
Same code when i am running on Vista then give error.But when i run code Run AS Admin then show UAC Enable or Disable.
Can you explain me why this type of result showing.
Please help me
|
|
|
|
|
Access to the HKEY_LOCAL_MACHINE subtree is protected.
MsmVc wrote: Same code when i am running on Vista then give error.But when i run code Run AS Admin then show UAC Enable or Disable.
It looks like the only way to obtain it (It looks like you cannot programmatically elevate current process privileges, see, for instance here[^]) however, I'm not an expert.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
who can desribe the difference between new and malloc function and
I want to know how they work.Thanks!
|
|
|
|
|
Googling[^] gives many usefull hits, like this[^] for example. Do these answer your question or did you mean a more indept view on these?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
Short answer: new gives a chance for objects initialization (by calling constructors) and cleanup (delete calls destructors) while malloc provides bare allocation functionality.
Short advice: while doing C++ development always use the new/delete approach.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
new creates new objects, malloc just reserves you a lump of memory and gives you a pointer to it. So when you say:
foo *p = new foo;
you're asking the compiler to generate the code for creating an original instance of foo (whatever that is) and to tell you where it is in the program's address space. Generally this means:
- The compiler generates code for reserving a lump of memory to store the object in
- It calls the appropriate constructor for foo and runs it on that lump of memory.
On the other hand when you say (in C):
foo *p = malloc( sizeof( foo ) );
you're saying "give me a lump of bytes that happens to be the size of a foo and I'll treat it as a foo." There can be any old rubbish in there. If you want it initialised into any reasonable state you've got to do it manually. Incidentally this is one of the reasons you'll find C programmers immediately memset ting allocated memory blocks or using calloc instead - it gets the memory into a known state. You'll also find that many decent C programmers bundle allocation and initialisation into functions and call them things like "construct_foo" to keep the operation atomic.
Incidentally there are loads of places you can plug into the object creation sequence process in C++ but very few (i.e. none I know of) of modifying the way malloc works in C. In C++ you can modify how the memory is reserved (by overloading operator new or using placement new), what to do if the allocation fails (set_new_handler ) and how the object is initialised (by writing constructors).
One final point. If new fails it throws an exception and winds back any initialisation or memory reservation that's already been completed. The exception is either bad_alloc if the memory reservation fails, or something from the constructor. If malloc fails it returns a NULL pointer, which is another good reason to use initialisation functions in C - you can handle all the errors in one place.
Cheers,
Ash
|
|
|
|
|
The best thing to do is to put a breakpoint on the line where new is called and then step into the code.
You can see all the things that it does and finally calls into the Windows API.
You could also overload new in one of your classes and then debug into it.
|
|
|
|
|
|
Hi,
I have to add property pages to a property sheet at runtime.
How can I exchange data of this page at runtime?
|
|
|
|
|
DoDataExchange() is not supposed to be called directly. You can use UpdateData().
|
|
|
|
|
You cannot do this.
You will have to do this using the functions instead.
Internally, the DDX_xxx wrappers do exactly this.
So for controls created dynamically you will have to do this yourself.
|
|
|
|
|
Hey,
this is my code:
connect(s, (SOCKADDR*) &addrin, sizeof(addrin));
send(s, stRequest.c_str(), stRequest.length(), 0);
cout << "stRequest sent." << endl;
recv(s, buffer, sizeof(buffer), 0);
cout << "buffer received." << endl;
Now this works perfectly fine if the webserver is working well, but sometimes it just sits there trying to recv() forever..
Iam not exactly sure what causes it but either way, I need a way to set a timeout or something similiar..
I couldn't really find something helpfull on google, so yea I thought maybe you guys could help me out.
|
|
|
|
|
|
ALLERSLIT wrote: Now this works perfectly fine if the webserver is working well, but sometimes it just sits there trying to recv() forever..
Iam not exactly sure what causes it but either way, I need a way to set a timeout or something similiar..
There are multiple choices:
- adjust the send/receive timeouts with setsockopt(), see SO_SNDTIMEO and SO_RCVTIMEO
- use non-blocking/asynchronous sockets, makes event based applications so much easier
- use a C++ networking library/API offering timeouts or search for a HTTP client class, would be my recommendation
Happy coding!
|
|
|
|
|
hello guys...im doing small project in TAPI.
- I show all the available lines in combo box.
- Now when I select a line device from combo box; I get its index and pass it to lineOpen(), but this does't work.
- Finally I hard-coded the line device id (ZERO in this case) which worked absolutely fine.
My question is: why does the combo box method is't working as it should be. What should I do?Any idea? thnx
|
|
|
|