need urgent help!
-
i am using a visual studio add in. in one of the methods i am using
CWinApp* pApp = AfxGetApp();
i need to get a pointer the visual studio app, not the add in app, in both cases, even if i use or don't use
AFX_MANAGE_STATE(AfxGetStaticModuleState())
i get a pointer to the add in app and not the pointer to the visual studio (exe) how can i retrieve the pointer to the visual studio exe??? thanks Yaron Ask not what your application can do for you, Ask what you can do for your application
-
i am using a visual studio add in. in one of the methods i am using
CWinApp* pApp = AfxGetApp();
i need to get a pointer the visual studio app, not the add in app, in both cases, even if i use or don't use
AFX_MANAGE_STATE(AfxGetStaticModuleState())
i get a pointer to the add in app and not the pointer to the visual studio (exe) how can i retrieve the pointer to the visual studio exe??? thanks Yaron Ask not what your application can do for you, Ask what you can do for your application
im not very experienced in add in´s - would FindWindow() or FindWindowEx() help?
-
im not very experienced in add in´s - would FindWindow() or FindWindowEx() help?
-
nop, not in this matter.... (thanks anyway) any other suggestions? Ask not what your application can do for you, Ask what you can do for your application
Is this a VS.NET or a VC 6 add-in?
-
Is this a VS.NET or a VC 6 add-in?
-
VC 6 Ask not what your application can do for you, Ask what you can do for your application
Wouldn't you just use the IApplication pointer that gets passed to IDSAddIn::OnConnection?
-
Wouldn't you just use the IApplication pointer that gets passed to IDSAddIn::OnConnection?
my original problem was how to get the *.dsw file. i saw a code that does that :
CString CCommands::GetWorkspacePath()
{
CWinApp* pApp = AfxGetApp();
ASSERT(NULL != pApp);CString szWorkspace(\_T("")); POSITION posdt = pApp->GetFirstDocTemplatePosition(); while (NULL != posdt) { CDocTemplate\* pdt = pApp->GetNextDocTemplate(posdt); if (0 == strcmp("CProjectWorkspaceDocTemplate", pdt->GetRuntimeClass()->m\_lpszClassName)) { POSITION posdoc = pdt->GetFirstDocPosition(); if (NULL == posdoc) break; CDocument\* pdoc = pdt->GetNextDoc(posdoc); if (NULL == pdoc) break; szWorkspace = pdoc->GetPathName(); if (!szWorkspace.IsEmpty()) break; } } return szWorkspace;
}
trouble was that when i run this code i got NULL for this line:
POSITION posdt = pApp->GetFirstDocTemplatePosition();
that's what led me to think that the pApp is the dlls therefor it can not get the doc template (cause it doesn't have one) what it should be is the dev studio exe and have a doc template..... can you help me here? i am really desperate no one could help me here... thanks again Yaron Ask not what your application can do for you, Ask what you can do for your application
-
my original problem was how to get the *.dsw file. i saw a code that does that :
CString CCommands::GetWorkspacePath()
{
CWinApp* pApp = AfxGetApp();
ASSERT(NULL != pApp);CString szWorkspace(\_T("")); POSITION posdt = pApp->GetFirstDocTemplatePosition(); while (NULL != posdt) { CDocTemplate\* pdt = pApp->GetNextDocTemplate(posdt); if (0 == strcmp("CProjectWorkspaceDocTemplate", pdt->GetRuntimeClass()->m\_lpszClassName)) { POSITION posdoc = pdt->GetFirstDocPosition(); if (NULL == posdoc) break; CDocument\* pdoc = pdt->GetNextDoc(posdoc); if (NULL == pdoc) break; szWorkspace = pdoc->GetPathName(); if (!szWorkspace.IsEmpty()) break; } } return szWorkspace;
}
trouble was that when i run this code i got NULL for this line:
POSITION posdt = pApp->GetFirstDocTemplatePosition();
that's what led me to think that the pApp is the dlls therefor it can not get the doc template (cause it doesn't have one) what it should be is the dev studio exe and have a doc template..... can you help me here? i am really desperate no one could help me here... thanks again Yaron Ask not what your application can do for you, Ask what you can do for your application
Yaron, While I'm not sure exactly what you're trying to accomplish, it seems to me that using the DocView hierarchy exposed by DevStudio rather than its automation interface is way more work than its worth. The IApplication pointer that gets passed to OnConnection is a pointer to the DevStudio instance in which your add-in is running. It includes an entire COM object hierarchy that allows you navigate windows, projects, files, etc. Look for IApplication in the DevStudio version of MSDN (not the newer MSDN that comes with VS.NET). It's got an easily navigable hierarchy that should get you where you need to be. don
-
Yaron, While I'm not sure exactly what you're trying to accomplish, it seems to me that using the DocView hierarchy exposed by DevStudio rather than its automation interface is way more work than its worth. The IApplication pointer that gets passed to OnConnection is a pointer to the DevStudio instance in which your add-in is running. It includes an entire COM object hierarchy that allows you navigate windows, projects, files, etc. Look for IApplication in the DevStudio version of MSDN (not the newer MSDN that comes with VS.NET). It's got an easily navigable hierarchy that should get you where you need to be. don
I know the this heirarchy, already read the MSDN, the thing i try to accomplish is when i open a project in the dev studio then usign my add-in i want to get the entire path of the *.dsw file.... i could not find any code for doing that (getting the *.dsw file) can you help? thanks again Yaron Ask not what your application can do for you, Ask what you can do for your application
-
I know the this heirarchy, already read the MSDN, the thing i try to accomplish is when i open a project in the dev studio then usign my add-in i want to get the entire path of the *.dsw file.... i could not find any code for doing that (getting the *.dsw file) can you help? thanks again Yaron Ask not what your application can do for you, Ask what you can do for your application
What does Application::ActiveProject::FullName return?
-
What does Application::ActiveProject::FullName return?
it returns the *.dsp name of the active project.... i can not just do concatonation like this ProjectName.dsp --> ProjectName. --> ProjectName.dsw because it is not insured that the name of the dsw is the name of the active project..... "help i need sombody , help is there anybody, help you know i need some HHHEEEELLLPPP" thanks again Yaron Ask not what your application can do for you, Ask what you can do for your application
-
it returns the *.dsp name of the active project.... i can not just do concatonation like this ProjectName.dsp --> ProjectName. --> ProjectName.dsw because it is not insured that the name of the dsw is the name of the active project..... "help i need sombody , help is there anybody, help you know i need some HHHEEEELLLPPP" thanks again Yaron Ask not what your application can do for you, Ask what you can do for your application
OK, one last idea and then I'm out of suggestions: Have you tried looping through the Application::Documents collection looking for a file with the dsw extension?
-
OK, one last idea and then I'm out of suggestions: Have you tried looping through the Application::Documents collection looking for a file with the dsw extension?
this i haven't tried yet, so i will try it now, but my guess is that the documents collection is empty at this stage.....but i will sure try it now and let you know thanks for all the trouble cheers, Yaron Ask not what your application can do for you, Ask what you can do for your application
-
i am using a visual studio add in. in one of the methods i am using
CWinApp* pApp = AfxGetApp();
i need to get a pointer the visual studio app, not the add in app, in both cases, even if i use or don't use
AFX_MANAGE_STATE(AfxGetStaticModuleState())
i get a pointer to the add in app and not the pointer to the visual studio (exe) how can i retrieve the pointer to the visual studio exe??? thanks Yaron Ask not what your application can do for you, Ask what you can do for your application
YaronNir wrote: i need to get a pointer the visual studio app, not the add in app, What you describe is the difference between a MFC regular DLL and an MFC extension DLL. An extension DLL uses the
CWinApp
of the EXE, so that's the type of DLL you need to use. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true. -
YaronNir wrote: i need to get a pointer the visual studio app, not the add in app, What you describe is the difference between a MFC regular DLL and an MFC extension DLL. An extension DLL uses the
CWinApp
of the EXE, so that's the type of DLL you need to use. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.thanks for the reply, but when i start a visual studio add in project (using the wizard) , what options do i have???? it determines for me the type of dll it produces.... how can i bypass it? thanks again Yaron Ask not what your application can do for you, Ask what you can do for your application