In the first case, the pointers are pointing to memory maintained by the CStringArray class.
It is likely that CStringArray relocated, resized or moved the memory around.
So you need to allocate memory for each pointer and copy the contents to the allocated memory.
In the second case you have pointers to fixed locations that do not change.
«_Superman_» I love work. It gives me something to do between weekends.
Hi,I want to change the string of a menu item,the string contains a '\t',like
"hello\tworld",I use CMenu::ModifyMenu function,I tried many times,the string always "hello",not"hello world",It will lost the string after '\t',Why,How to change it.
I use the VC++ 2008 to check this question. I define one function named "max2" using keyword "static" and one function named "min2" using keyword "inline". I think that the compiler will use the code inside the min2 function to replace the function called. And the max2 with static keyword will be compiled to be a function.
But after the Deassembled in Debug model. I found that the exe both use the "call " assemble code to call these two functions. why does the inline not succeed?
You have the idea right, but there are several issues with inline. Here is a list off the top of my head:
1. You can change the setting in the Project Properties -> C/C++ -> Optimizations -> Inline Function Expansion.
2. You say you de-assembled the Debug build of your exe, but for Debug builds the default setting is Disabled.
3. The inline keyword does not order the compiler to expand the function inline, it is merely a request. The compiler will determine if it is worth making it inline or if it is better left as a function call.
4. If a function is marked as inline and called from multiple other function, it might be inlined in some of the calling functions and not in others. Again the compiler determines whether it is worth it.
5. If you discover that the compiler is not inlining a function you have marked as inline and you really, really, really want it inlined because you think you know better or you want to run profiling with it inlined and not inlined, try using the __forceinline keyword.
A static method can be inlined if the compiler decides to do so, and an inline function might be instantiated as a callable function. Its all up to the compiler. In general it can easily happen that a compiler creates both an inlined and instantiated version of the very same function (no matter if its static or inlined).
Question #1: I have a Dialog based app using sample code taken above. App runs fine. I want to avoid having the popup printer selection window appear once the print job is started (i.e. when PrintDocument() is called). I just want to print to the default printer. How can I do this?
This dialog app itself creates numerous other new dialog windows depending on user's selection.
There is a need to have many of the features provided by this dialog application implemented as command line features.
What did I do? ...
Upon app started, I created a modeless dialog object with the intent not to display the dialog (unless absolutely necessary).
Some of the dialog methods do function. The method that handles the printing does not work.
The code fragment that causes a problem is CBatchResultsDlg::WaitForComplete() - because of AfxPumpMessage(). The owner of the CHtmlEditCtrl object is the Desktop window because setting the dialog window creating the object as owner fails.
How can I fix this such that my printing will work.
Hello all. I'd like to set up, correctly, an UNIX (Ubuntu) environment so I can compile and test the network programs from the Unix Network Programming 3rd edition book by Richard Stevens. Please, I'm really lost. I don't know what to do.
I get lots of problems. In particular, I don't have the machine directory but I have installed gcc and build-essential:
Infile included from /usr/include/x86_64-linux-gnu/machine/_types.h:34:0,
/usr/include/x86_64-linux-gnu/i386/_types.h:79:3: note: previous definition of ‘__mbstate_t’ was here
Infile included from /usr/include/netinet/in.h:25:0,
/usr/include/x86_64-linux-gnu/sys/socket.h:39:28: fatal error: machine/_align.h: Arquivo ou diretório não encontrado
any way, after i have finished writing my program i have recived an error it is like that :
LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup'
1>stdafx.obj : error LNK2019: unresolved external symbol "public: __thiscall list::~list(void)" (??1list@@QAE@XZ) referenced in function _main
fatal error LNK1120: 1 unresolved externals
this is the error from compiler, by the way i am using a visual studio 2010 ,