|
you're right (and I'm left
but I meant "the sum of all memberss' size" when I said "the size of a structure". by the way do u know how I can make the compiler ignore that PADDING stuff? I mean a STANDARD way not an implementation-specific one.
thnx
modified on Wednesday, August 18, 2010 11:24 PM
|
|
|
|
|
Joseph Marzbany wrote: but I meant "the sum of all memberss' size" when I said "the size of a structure".
Sure, but why worry about a few extra bytes, which will not have any significant effect on either your program or your files? If you want to pack your structure tightly then use the #pragma pack()[^] compiler directive.
It's time for a new signature.
|
|
|
|
|
thank you for your attention!
1. is that a STANDARD method or Implementation-Specific? (Yes I know I've already asked it. Just for sure)
2. What's that padding stfuff useful for? Why do compilers take such a strategy?
|
|
|
|
|
1. I think the compiler writers are allowed to decide what their default option will be.
2. Padding of short items allows the compiler to take advantage of processor hardware. In some cases the system is more efficient if words, double words etc are aligned on even boundaries.
It's time for a new signature.
|
|
|
|
|
I create a item as CMFCToolBarComboBoxButton and add it to CMFCToolBar. Now, I can handle the message such as CBN_SELCHANGE. But how to handle the edit message of CMFCToolBarComboBoxButton.
I tried with EN_CHANGE and CBN_EDITCHANGE, but the breakpoint in these handler did not work.
Please tell me how I should do?
Thanks!
|
|
|
|
|
Hi,
How to check whether the dll can be loaded in c++?
Thanks,
|
|
|
|
|
|
Yeah,I have loaded the dll and its returning 0x11000000 value in HINSTANCE But while getting the address of that function,its returning value 0x00000000. Whats the reason? If we open a dll in notepad, it should contain the function names right? but this is dll is not showing any fn names in notepad. Please tell me why GetProcAdress is returning NULL value?
Thanks,
|
|
|
|
|
Maybe a function name mangling issue. Why don't you use the Dependecy Walker tool [^] to see function names?
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]
|
|
|
|
|
Yes.I have used Dependency walker. But its showing only 4 functions DllCanUnLoadNow,DllGetClassObject,DllRegisterServer,DllUnregisterServer.
But I can use the functions in .net. In c++ only, its not working.
|
|
|
|
|
Karthika85 wrote: only 4 functions DllCanUnLoadNow,DllGetClassObject,DllRegisterServer,DllUnregisterServer.
That's because it is a COM server and you have to use the COM way (e.g. via CoCreateInstance [^] function) to access it's functionality.
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]
|
|
|
|
|
Have you correctly exported your function names with __declspec(dllexport) ?
It's time for a new signature.
|
|
|
|
|
No.This dll is given by a vendor.This is not our dll.
|
|
|
|
|
Karthika85 wrote: This dll is given by a vendor.
Then they are the people you need to talk to, as they should have both the source code and the instructions on how to use the functions.
It's time for a new signature.
|
|
|
|
|
|
Put this before class and function names that you want to export from the dll.
extern "C"
This will prevent the C++ way of mangling the names. Theres nothing wrong in mangling but if you export a function like
int Sum(int, int) C++ will NOT reduce that to _Sum, like C and like you might expect. That means when you import that into your program, you can't simply search for "Sum" but have to follow C++ name mangling rules and search for THAT name.
...byte till it megahertz...
|
|
|
|
|
For example, a game only supports connecting in one lan. How to make it connectable via Internet?
VPN?
|
|
|
|
|
Your question isn't really a C/C++/MFC related question, you should try a more suitable message board. However, VPN could work, but as far as i know some games use broadcast packets to find their servers on the lan but broadcast packets aren't submitted through internet via VPN (i might be wrong of course). In this case, you might try somesort of tunneling, like an SSH tunnel or somesuch, maybe that could work. Come to think of it, trying the tunneling might even be a better choice at the first place.
By the way, just so you know, it might be illegal to do what you wish if the makers of the game charge players extra for internet gameplay and you are trying to avoid paying by making a LAN game go thorough the net.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
I am highly used to C than C++, but now I'm trying to understand C++ as well. I have fstream object which I used to create a file for output.
What I want is that if there is any file write error, the file that was created should be removed from the disk. What is the name of the method that I should invoke with the fstream object to remove the file from the disk, as it is done in C using remove() to accomplish such a goal? Please help.
|
|
|
|
|
|
I think DeleteFile is Windows specific, so I wouldn't want that one. I will use remove() rather. But does it mean there is no method in C++ to be used for such a goal?
|
|
|
|
|
Dan_K wrote: But does it mean there is no method in C++ to be used for such a goal?
Not that I am aware of, as these functions are beyond the scope of the C++ language. If you include <cstdio> [^] you can then use it in the form std::remove() .
It's time for a new signature.
|
|
|
|
|
as you know, C++ is a super set of C, and you are always free to use C functions wherever in C++ code
|
|
|
|
|
I want to capture ip packet sent by an application, and modify the packet then resent it.
The destination host should receive only the modified packet.
I found a solution that using hooking, but I don't know whether it will work with packet that is sent asynchronously.
A filter driver will work, but I'm not very familiar with that now.
Any other solution?
Thanks.
|
|
|
|
|