Click here to Skip to main content
15,906,628 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Cannot Interact with service using SERVICE_USER_DEFINED_CONTROL[SOLVED] Pin
vishalgpt13-Aug-11 16:04
vishalgpt13-Aug-11 16:04 
QuestionBitmap on Picture Control Pin
manju 312-Aug-11 21:18
manju 312-Aug-11 21:18 
AnswerRe: Bitmap on Picture Control Pin
Richard MacCutchan13-Aug-11 0:43
mveRichard MacCutchan13-Aug-11 0:43 
QuestionRe-intilize stack pointer Pin
ForNow12-Aug-11 9:41
ForNow12-Aug-11 9:41 
AnswerRe: Re-intilize stack pointer Pin
MicroVirus12-Aug-11 10:42
MicroVirus12-Aug-11 10:42 
AnswerRe: Re-intilize stack pointer Pin
Richard MacCutchan12-Aug-11 23:00
mveRichard MacCutchan12-Aug-11 23:00 
QuestionAbout wWinMainCRTStartup. Can anybody tell me what it exactly is? How does it work? Pin
frankgt4012-Aug-11 7:31
frankgt4012-Aug-11 7:31 
AnswerRe: About wWinMainCRTStartup. Can anybody tell me what it exactly is? How does it work? Pin
Maximilien12-Aug-11 8:01
Maximilien12-Aug-11 8:01 
GeneralRe: About wWinMainCRTStartup. Can anybody tell me what it exactly is? How does it work? Pin
frankgt4012-Aug-11 16:56
frankgt4012-Aug-11 16:56 
AnswerRe: About wWinMainCRTStartup. Can anybody tell me what it exactly is? How does it work? Pin
MicroVirus12-Aug-11 8:25
MicroVirus12-Aug-11 8:25 
GeneralRe: About wWinMainCRTStartup. Can anybody tell me what it exactly is? How does it work? Pin
frankgt4013-Aug-11 5:17
frankgt4013-Aug-11 5:17 
AnswerRe: About wWinMainCRTStartup. Can anybody tell me what it exactly is? How does it work? Pin
Emilio Garavaglia13-Aug-11 5:07
Emilio Garavaglia13-Aug-11 5:07 
GeneralRe: About wWinMainCRTStartup. Can anybody tell me what it exactly is? How does it work? Pin
frankgt4013-Aug-11 5:26
frankgt4013-Aug-11 5:26 
GeneralRe: About wWinMainCRTStartup. Can anybody tell me what it exactly is? How does it work? [modified] Pin
Emilio Garavaglia13-Aug-11 9:46
Emilio Garavaglia13-Aug-11 9:46 
The reason is not because of the OS (it simply adjust the relocation table after copying the executable image in memory BEFORE jumping in it, so the exe itself has no role in that) but because of how C++ works.

Objects has constructors and destructors.
Try this
C++
#include <iostream>

class A
{
public:
    A() { std::cout << "A created" << std::endl; }
    ~A() { std::cout << "A destroyed" << std::endl; }
};

A global_a;

int main()
{
    std::cout << "this is main" << std::endl;
    return 0;
}


The output will be
txt
A created
this is main
A destroyed


Global objects must be created/destroyed outside the scope of main.
This is not an OS requirement, but a requirement for the C++ specification.
mainCRTSturtup is the "bridge" between the OS (that has no clue about the app language specifications: it just want an address to be called) and a language like C++ that requires some code (constructors and destructors of global objects) to be executed independently of the main() function.

2 bugs found.
> recompile ...
65534 bugs found.
D'Oh! | :doh:


modified on Sunday, August 14, 2011 4:33 AM

QuestionInsert new row in Excel using MFC VC++ Pin
spalanivel11-Aug-11 23:58
spalanivel11-Aug-11 23:58 
QuestionRe: Insert new row in Excel using MFC VC++ Pin
David Crow12-Aug-11 4:14
David Crow12-Aug-11 4:14 
AnswerRe: Insert new row in Excel using MFC VC++ Pin
spalanivel15-Aug-11 2:09
spalanivel15-Aug-11 2:09 
GeneralRe: Insert new row in Excel using MFC VC++ Pin
David Crow15-Aug-11 3:31
David Crow15-Aug-11 3:31 
GeneralRe: Insert new row in Excel using MFC VC++ Pin
spalanivel15-Aug-11 19:47
spalanivel15-Aug-11 19:47 
QuestionRe: Insert new row in Excel using MFC VC++ Pin
David Crow16-Aug-11 3:40
David Crow16-Aug-11 3:40 
QuestionHiding DialogBar of Mainframe [Solved] Pin
Anu_Bala11-Aug-11 20:43
Anu_Bala11-Aug-11 20:43 
AnswerRe: Hiding DialogBar of Mainframe Pin
వేంకటనారాయణ(venkatmakam)11-Aug-11 21:23
వేంకటనారాయణ(venkatmakam)11-Aug-11 21:23 
GeneralRe: Hiding DialogBar of Mainframe Pin
Anu_Bala11-Aug-11 23:29
Anu_Bala11-Aug-11 23:29 
QuestionThread safe in VC++ Pin
pix_programmer11-Aug-11 18:12
pix_programmer11-Aug-11 18:12 
AnswerRe: Thread safe in VC++ Pin
Peter_in_278011-Aug-11 19:03
professionalPeter_in_278011-Aug-11 19:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.