Click here to Skip to main content
15,929,439 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Memory leaks Pin
19-Jun-02 10:27
suss19-Jun-02 10:27 
GeneralRe: Memory leaks Pin
Nish Nishant19-Jun-02 10:54
sitebuilderNish Nishant19-Jun-02 10:54 
GeneralRe: Memory leaks Pin
Gary Kirkham19-Jun-02 15:20
Gary Kirkham19-Jun-02 15:20 
Generalmake files Pin
Kuniva19-Jun-02 7:44
Kuniva19-Jun-02 7:44 
GeneralRe: make files Pin
Michael P Butler19-Jun-02 9:21
Michael P Butler19-Jun-02 9:21 
GeneralAfxGetApp() Error Pin
lbishop19-Jun-02 6:59
lbishop19-Jun-02 6:59 
GeneralRe: AfxGetApp() Error Pin
Chris Losinger19-Jun-02 7:06
professionalChris Losinger19-Jun-02 7:06 
GeneralRe: AfxGetApp() Error Pin
lbishop19-Jun-02 8:45
lbishop19-Jun-02 8:45 
I'm building this as an add-in for visual studio. I'm calling it from CDSAddIn::OnConnection. Here is a description of the thinking behind how it all works and some more code.

So, once in the CDSAddIn::OnConnection() method we store off the current CWinApp's hinstance and threadID. Then the AFX_MANAGE_STATE macro is used to switch the state so that our add-ins access to it's resource's will function correctly. Note that the manage state macro is done after the storing of the hinstance and threadID - if we had switched state before, then the values would be different - what we want is to have the hinstance and threadID for the Developer Studio app.

// This is called when the user first loads the add-in, and on start-up
// of each subsequent Developer Studio session
STDMETHODIMP CDSAddIn::OnConnection(IApplication* pApp, VARIANT_BOOL bFirstTime,
long dwCookie, VARIANT_BOOL* OnConnection)
{
HINSTANCE hInst = AfxGetApp()->m_hInstance;
DWORD threadID = AfxGetApp()->m_nThreadID;

AFX_MANAGE_STATE(AfxGetStaticModuleState());
GeneralBorder Width of a Control Pin
19-Jun-02 6:16
suss19-Jun-02 6:16 
GeneralRe: Border Width of a Control Pin
Joaquín M López Muñoz19-Jun-02 6:35
Joaquín M López Muñoz19-Jun-02 6:35 
GeneralRe: Border Width of a Control Pin
Chad Koehler19-Jun-02 7:12
Chad Koehler19-Jun-02 7:12 
GeneralTaskbar Question Pin
19-Jun-02 6:06
suss19-Jun-02 6:06 
GeneralRe: Taskbar Question Pin
Joaquín M López Muñoz19-Jun-02 6:38
Joaquín M López Muñoz19-Jun-02 6:38 
GeneralRe: Taskbar Question Pin
19-Jun-02 7:29
suss19-Jun-02 7:29 
GeneralRe: Taskbar Question Pin
19-Jun-02 8:16
suss19-Jun-02 8:16 
GeneralMFC in VS.NET and _CrtIsValidHeapPointer Pin
mstephens19-Jun-02 5:59
mstephens19-Jun-02 5:59 
GeneralActiveX component can't create object: 'Scripting.FileSystemObject' :( Pin
Vitaly Belman19-Jun-02 5:55
Vitaly Belman19-Jun-02 5:55 
QuestionTerminating app smoothly? Pin
User 665819-Jun-02 5:45
User 665819-Jun-02 5:45 
AnswerRe: Terminating app smoothly? Pin
Hans Ruck19-Jun-02 5:56
Hans Ruck19-Jun-02 5:56 
GeneralRe: Terminating app smoothly? Pin
User 665819-Jun-02 6:02
User 665819-Jun-02 6:02 
GeneralRe: Terminating app smoothly? Pin
Marc Richarme19-Jun-02 7:05
Marc Richarme19-Jun-02 7:05 
GeneralRe: Terminating app smoothly? Pin
User 665819-Jun-02 7:07
User 665819-Jun-02 7:07 
GeneralRe: Terminating app smoothly? Pin
19-Jun-02 8:02
suss19-Jun-02 8:02 
GeneralRe: Terminating app smoothly? Pin
User 665819-Jun-02 8:15
User 665819-Jun-02 8:15 
GeneralRe: Terminating app smoothly? Pin
19-Jun-02 8:54
suss19-Jun-02 8:54 

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.