Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. need urgent help!

need urgent help!

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharpvisual-studiohelp
15 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M mightyCoCo

    im not very experienced in add in´s - would FindWindow() or FindWindowEx() help?

    Y Offline
    Y Offline
    YaronNir
    wrote on last edited by
    #3

    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

    D 1 Reply Last reply
    0
    • Y YaronNir

      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

      D Offline
      D Offline
      Don Kackman
      wrote on last edited by
      #4

      Is this a VS.NET or a VC 6 add-in?

      Y 1 Reply Last reply
      0
      • D Don Kackman

        Is this a VS.NET or a VC 6 add-in?

        Y Offline
        Y Offline
        YaronNir
        wrote on last edited by
        #5

        VC 6 Ask not what your application can do for you, Ask what you can do for your application

        D 1 Reply Last reply
        0
        • Y YaronNir

          VC 6 Ask not what your application can do for you, Ask what you can do for your application

          D Offline
          D Offline
          Don Kackman
          wrote on last edited by
          #6

          Wouldn't you just use the IApplication pointer that gets passed to IDSAddIn::OnConnection?

          Y 1 Reply Last reply
          0
          • D Don Kackman

            Wouldn't you just use the IApplication pointer that gets passed to IDSAddIn::OnConnection?

            Y Offline
            Y Offline
            YaronNir
            wrote on last edited by
            #7

            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

            D 1 Reply Last reply
            0
            • Y YaronNir

              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

              D Offline
              D Offline
              Don Kackman
              wrote on last edited by
              #8

              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

              Y 1 Reply Last reply
              0
              • D Don Kackman

                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

                Y Offline
                Y Offline
                YaronNir
                wrote on last edited by
                #9

                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

                D 1 Reply Last reply
                0
                • Y YaronNir

                  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

                  D Offline
                  D Offline
                  Don Kackman
                  wrote on last edited by
                  #10

                  What does Application::ActiveProject::FullName return?

                  Y 1 Reply Last reply
                  0
                  • D Don Kackman

                    What does Application::ActiveProject::FullName return?

                    Y Offline
                    Y Offline
                    YaronNir
                    wrote on last edited by
                    #11

                    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

                    D 1 Reply Last reply
                    0
                    • Y YaronNir

                      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

                      D Offline
                      D Offline
                      Don Kackman
                      wrote on last edited by
                      #12

                      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?

                      Y 1 Reply Last reply
                      0
                      • D Don Kackman

                        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?

                        Y Offline
                        Y Offline
                        YaronNir
                        wrote on last edited by
                        #13

                        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

                        1 Reply Last reply
                        0
                        • Y YaronNir

                          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

                          M Offline
                          M Offline
                          Michael Dunn
                          wrote on last edited by
                          #14

                          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.

                          Y 1 Reply Last reply
                          0
                          • M Michael Dunn

                            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.

                            Y Offline
                            Y Offline
                            YaronNir
                            wrote on last edited by
                            #15

                            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

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups