|
The errors happen because I use .NET version of VS, and you apparently have version 6.0/5.0 installed. You must search your own registry for the correct ProgID (Name) of the Microsoft Development Environment Object (DTE Object).
The IDispatch interface pointer that is provided to you points to the IDispatch interface of the DTE object. According to my MSDN Library copy, the DTE object has a method called Solution (wrapped as get_Solution) that provides you with a pointer to the IDispatch interface of the Solution object. The Solution object, again, has a method called FullName (wrapped as get_FullName) that gives you the full path name of the solution file.
You can then use any path parser class or function to parse the actual solution name from this string.
Note that this applies only to Visual Studio .NET. I will attempt to create a Visual Studio 6.0 compatible version today, when I have access to a 6.0 environment. Will post more information later.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
ok , now i am starting to understand....
but as you have mentioned, the solution is a .Net only, i need the coresponding VC++6 ......
so if you have the time maybe you can reply with the correct object and methods?
thanks again for all your help
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
The VC++ 6.0 implements an IApplication interface. This interface allows access to a VC++ 6.0 object and it's sub-objects. These objects and how to automate tasks in VC6 are discussed in detail at an MSDN Link here[^].
Note, that I could not get the IApplication.ActiveProject method to work. It always caused a violation when ran. Instead, I built an example application that gets the project collection, queries for a project in the first slot, then gets this project's name.
You can download this example from here[^]. It is made completely with Visual Studio 6.0, so it should compile and run properly straight through. Remember, though that if you run the provided example application, you must have Visual Studio 6.0 running, and it must have a workspace and a project open. Otherwise the example app will crash !
You can add more wrappers for different objects in Visual Studio by using the ClassWizard. Just search your computer for a file named DEVSHL.DLL, then use the ClassWizard's 'Add -> From type library ' and specify the DEVSHL.DLL file. You will then be presented with a dialog showing the available interfaces.
Remember, that the ClassWizard automatically builds wrappers for the IDispatch interfaces of the available ones. Thus, if you want to access the IDispatch of IApplication, you choose 'IApplication' from the list, and code will be generated.
For the add-ins, the OnConnect method automatically receives a pointer to the IApplication interface. If you have an IDispatch wrapper for IApplication, you can use QueryInterface to ask for the interface IID_IDispatch from this interface. The returned LPDISPATCH can be used again in the AttachDispatch call of the wrapper class.
For further info, see the provided MSDN link and the comments in the source files.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
hi,
Now i see where you're getting.....indeed when i open a new project in VC++6 called 'dev-studio' i get a wrapper for all the methods....
i can retrieve the project name easily... the touble is (actually that was the trouble to begin with) i don't need the project path, i need the workspace path......
can you help me here?
thanks so much for other replies
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
That is the oddity in the documentation. There doesn't seem to be a function available for getting the actual workspace object or it's name. I honestly do not know how to get the workspace name, but you can extract the path from the project path, as they are usually the same.
The .Net version has the _Solution interface, and this interface is applied everywhere else in Visual Studio environment. It allows easy access to the solution name. However, I don't know why the Visual C++ 6.0 doesn't implement this. Perhaps you could get the IApplication object (In VC6) and query it for the _Solution interface manually. I am not sure if it will work, though, and I seriously doubt it, but you can always try..
Perhaps it is completely impossible to the workspace name in VC6. For this, blame Microsoft
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
this what leads me to the first code i've shown you:
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;
}
}
this code does not work when i create a dev-studio add in using the wizard of VC++6....but this code does work! when i tried the windows tabs (d/l it from code project), it uses the WWhizIntefaceHelper the has the above method, and if i am placing a break point, at the above code, the line:
POSITION posdt = pApp->GetFirstDocTemplatePosition();
doesn't return NULL....my guess is that this project was not created using the dev-studio wizard.....
can you tell me how it was created then??? it must be COM- ATL - Object right???
if i will solve this, then i will solve my problem...
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Ah, so..
You should've told me earlier about the article: reading it completely through offered a good set of knowledge on how the Visual C++ 6 works. For other possible readers, a link to the article is available here[^].
Like this article states, an MFC extension DLL can share the CWinApp object provided by a loading application. This theorem is used as a base on the concept that Visual C++ is a BIG MFC program that loads a few extension DLLs when it starts up. Nothing prevents us from writing Add-ins as extension DLLs instead of regular add-ins, which are generated by the Dev-Studio Add-In wizard.
In order to utilize the code piece placed there, you must generate your Add-in module by using the alternative code wizard mentioned in the article: "CoDeveloper's Extension Add-in Wizard", instead of using the built-in DevStudio Add-in Wizard. Modules created with the prior wizard have access to the CWinApp object of Visual C++, and can thus enumerate through it's document templates and so on.
Basically, to solve your problem and answer your question in a single sentence: use the CoDeveloper's wizard to generate your add-in instead of the built-in one, and then write the necessary code again. By using the alternative wizard, you have access to the CWinApp object of Visual C++. For more information on how it works, you should read the original article with careful thought. You can find the wizard accompanied in the ZIP file that is with the article. Just read the Readme file and install the wizard accordingly.
Unfortunately, you cannot write a seperate module that does the same. This means that the code examples I have posted cannot be altered to access the workspace name on a VC6 platform. The .Net version works, because VC .NET's Automation interface is much more sophisticated.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
you are the best!!!!
thanks a lot, i think that should solve my problem
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Can anybody tell me..How to insert table in richtextbox control as in MS word..I'll be helpful to u...PLease help me sir..
I'll be very thankful to u.
OK! Good Bye...Have a Nice Life..Bye. Sumit Kapoor
Never consider anything Impossible before trying to solve that..---Sumit Kapoor---
|
|
|
|
|
Do you want to create a table by programming or do you want to be able to copy and paste a table from other RTF applications?
Copy/Paste should work.
Since the Windows WordPad application can not create tables and this is a demo application which has been build using CRichEditView (a CRichEditCtrl wrapper) it seems to be not very easy to create tables by programming.
You may have to write the RTF code yourself to do this, but I don't know how to do it.
|
|
|
|
|
Hello
Ihave a programe store about 40,000 record in database,and make report from them .
but the programe work so slowly when I want to find last ID number.
I use ODBC to connect to database. to get the last ID I use m_strFileter and m_strSort properties & Requery MethodRequery .
wat can I do to get better performense ?
(please show me a way to use database )
tnX
Iman Ghasrfakhri
|
|
|
|
|
If your database is MS ACCESS you should use DAO instead of ODBC, that means CDaoDatabase and CDaoRecordset and not CDatabase and CRecordset. To my experience this is much more faster.
Hope this helps.
MS
|
|
|
|
|
The "last ID number" field must be indexed. The speed difference between ODBC and DAO, if any, is negligible.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
hi, i need help in recording and playback the sound. i want to learn how to use C/C++ to do this application.
the sound should come in from a microphone and playback to the speaker.
thx
|
|
|
|
|
Try using DirectX - DirectSound/DirectShow.
|
|
|
|
|
Where can i find the details for this directX-directsound/directshow?
is there any sample that i can refer to in learning or as an example?
any suggestion?
can u pls explain in brief what this directX can do? as i know this is for gaming purpose. but i dun know how true it was.
thx for the help!!!
|
|
|
|
|
Why My Programm is getting out when i try to place Rich Edit2.0 on my Dialog Panel??? Just when i get Rich Edit 2.0 out of my Dialog panel my programm works properly.
|
|
|
|
|
You need to call
AfxInitRichEdit();
I usually add it into the InitInstance function.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
Can I control the Volume and Microphone of a USB Device from my application? Presently using MIXERCONTROL I am able to control both Volume and Microphone of the system from an application.
Is it possible to use this MIXERCONTROL it self or any other method?
|
|
|
|
|
Is there a simple way to hide the mouse on entering a window and show it on exiting it. I'm assuming there is a windows message that i need to handle, but I'm not sure which one.
[edit]ShowCursor does some of what I want, but I want the cursor to show in the menu-bar so I can click the minimize/maximize button[/edit]
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
You probably call ShowCursor in the main frame. Try to call it in the child window (or, generally, in the window, which occupy the client area of main window)
Robert-Antonio
"CRAY is the only computer, which runs an endless loop in just 4 hours"
|
|
|
|
|
CFile::GetLength() and CFile::Seek() return a UINT in VC6 and a ULONGLONG in VC7. Is there a predefined macro that can be used to declare a variable in my source that will differentiate between the two. Right now I am using the following macro, but my code would be more portable if I used a predefined one.
#if _MFC_VER < 0x0700
# define SIZE_TYPE UINT
#else
# define SIZE_TYPE ULONGLONG
#endif
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
|
Michael Dunn wrote:
You could also just use ULONGLONG everywhere. Assigning UINT to ULONGLONG is fine by the language rules, because it's a widening conversion.
Thanks Mike
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Im trying to run in debug mode an app that was converted by VS 2003
but in debug mode not compile, it say this error:
APP fatal error LNK1181: cannot open input file 'shlwapi.h'
i add the include path where this file exist, but i get the same error
In release build works fine.
|
|
|
|