|
Hello,
I have recently come across IServiceProvider::QueryService...
and although can use this function, do not know how the
services are created and what creates the SID_ constants.
I have used COM and come across CLSID_, IID_, but not SID_
Would you know the procedure for creating a service, using c++.
I use COM, visual c++ 6.0, c++ .NET 7.1.
Thankyou
|
|
|
|
|
Hi all,
In my code I have an IShellFolder object and a relative pidl to one of its subfolders, and I need to get the full pidl to the subfolder. If I use subfolder->GetDisplayNameOf() with SHGNO_FORPARSING and then calls desktopFolder->ParseDisplayName() with the display name I get the full pidl for pure file system and pure virtual objects. But for virtual objects with file system storage (for example “My Music”) it does not work, I get the pidl to the storage (that is “My Computer/Drive c:/Documents and Settinings/…”) and that is not what I want, I want the pidl to the virtual folder, that is “My Documents/My Music”. So, does anyone have any ideas how to get the full pidl to the virtual part of a folder that has both a virtual and a file system folder given its parent and a relative pidl?
-- modified at 7:44 Sunday 1st April, 2007
|
|
|
|
|
Please help me with this one, I cannot get around it.
|
|
|
|
|
I have written a class for operating the SQLCE database with OLE DB, it work perfect on INSERT ,UPTDATE and so on, but when I use 'select' statement to get values from database it doesn’t return values properly even though the GetNextRows method succeeds.
HRESULT hr = NOERROR;
m_pIRowset = NULL;
m_prghRows = &m_rghRows[0];
hr = pICmdText->SetCommandText(DBGUID_SQL, pwszQuery);
if(!FAILED(hr))
{
hr = pICmdText->Execute(NULL, IID_IRowset, NULL, NULL, (IUnknown **)&m_pIRowset);
if (FAILED(hr)){
AfxMessageBox(_T("failed"));
m_pIRowset = NULL;
}
// Get IColumnsInfo interface
hr = m_pIRowset->QueryInterface(IID_IColumnsInfo, (void**)&m_pIColumnsInfo);
if(FAILED(hr)){
AfxMessageBox(_T("failed"));
}
// Get the column metadata m_ulNumCols//m_pDBColumnInfo
hr = m_pIColumnsInfo->GetColumnInfo(&m_ulNumCols, &m_pDBColumnInfo,&m_pStringsBuffer);
if(FAILED(hr) || 0 == m_ulNumCols){
AfxMessageBox(_T("failed"));
}
// Create a DBBINDING array.
m_dwBindingSize = m_ulNumCols;
m_prgBinding = (DBBINDING*)CoTaskMemAlloc(sizeof(DBBINDING)*m_dwBindingSize);
if (NULL == m_prgBinding){
hr = E_OUTOFMEMORY;
AfxMessageBox(_T("Memory allocation failure"));
}
// Set initial offset for binding position
m_dwOffset = 0;
// Prepare structures to create the accessor
UINT lCount;
ULONG dwOrdinal;
for (lCount = 0; lCount< m_ulNumCols; lCount++)
{
dwOrdinal = m_pDBColumnInfo[lCount].iOrdinal;
m_prgBinding[lCount].iOrdinal = dwOrdinal;
m_prgBinding[lCount].dwPart = DBPART_VALUE | DBPART_STATUS | DBPART_LENGTH;
m_prgBinding[lCount].obLength = m_dwOffset;
m_prgBinding[lCount].obStatus = m_prgBinding[lCount].obLength + sizeof(ULONG);
m_prgBinding[lCount].obValue = m_prgBinding[lCount].obStatus + sizeof(DBSTATUS);
m_prgBinding[lCount].wType = m_pDBColumnInfo[lCount].wType;
m_prgBinding[lCount].pTypeInfo = NULL;
m_prgBinding[lCount].pObject = NULL;
m_prgBinding[lCount].pBindExt = NULL;
m_prgBinding[lCount].dwMemOwner = DBMEMOWNER_CLIENTOWNED;
m_prgBinding[lCount].dwFlags = 0;
m_prgBinding[lCount].bPrecision = m_pDBColumnInfo[lCount].bPrecision;
m_prgBinding[lCount].bScale = m_pDBColumnInfo[lCount].bScale;
switch(m_prgBinding[lCount].wType){
case DBTYPE_WSTR:
m_prgBinding[lCount].cbMaxLen = sizeof(WCHAR)*(m_pDBColumnInfo[lCount].ulColumnSize + 1); // Extra buffer for null terminator
break;
default:
m_prgBinding[lCount].cbMaxLen = m_pDBColumnInfo[lCount].ulColumnSize;
break;
}
// Calculate the offset, and properly align it
m_dwOffset = m_prgBinding[lCount].obValue + m_prgBinding[lCount].cbMaxLen;
m_dwOffset = ROUND_UP(m_dwOffset, 8);
}
// Get IAccessor interface
hr = m_pIRowset->QueryInterface(IID_IAccessor, (void**)&m_pIAccessor);
if(FAILED(hr))
{
AfxMessageBox(_T("failed"));
}
// Create the accessor
//
hr = m_pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA, m_dwBindingSize,
m_prgBinding, 0, &m_hAccessor,NULL);
if(FAILED(hr))
{
AfxMessageBox(_T("failed"));
}
// Allocate data buffer.
//
m_pData = (BYTE*)CoTaskMemAlloc(m_dwOffset);
if (NULL == m_pData)
{
hr = E_OUTOFMEMORY;
CString errors;
errors.Format(_T("%d"),m_pDBColumnInfo[2].ulColumnSize);
MessageBox(NULL,errors,NULL,MB_OK);
AfxMessageBox(_T("failed"));
}
// Retrive a row
//
hr = m_pIRowset->GetNextRows(DB_NULL_HCHAPTER, 0, 1, &m_cRowsObtained,&m_prghRows);
if (SUCCEEDED(hr) && hr != DB_S_ENDOFROWSET)
{
// Set data buffer to zero
//
memset(m_pData, 0, m_dwOffset);
// Fetch actual data
hr = m_pIRowset->GetData(m_prghRows[0], m_hAccessor, m_pData);
if (FAILED(hr))
{
m_pIRowset->ReleaseRows(1, m_prghRows, NULL, NULL, NULL);
AfxMessageBox(_T("failed"));
}
}
if (hr == DB_S_ENDOFROWSET)
{
m_bIsEOF = TRUE;
}
}
venkat
|
|
|
|
|
I'm working on an excel application with data validation in it. The boss insists we use form controls such as checkbox or radio button. Is there any way to integrate these into an excel spreadsheet through COM Interop? If so, please provide an example or post a link. Also, we need to read the excel spreadsheet back through COM, so the controls need to be accessible later.
-- Steven Hunt
|
|
|
|
|
Have you ever heard of Microsoft Visual Studio Tools for Office (VSTO)? It allows one to automate Excel documents using .NET (in C# or VB). It supports dragging-and-dropping WinForms controls onto the worksheet. In addition, you can cache arbitrary data (e.g. the state of the controls) within the document and retrieve them outside of the Excel host environment.
For more information: Visual Studio Tools for Office
-Phil
Disclaimer: I work for Microsoft as a developer on the VSTO product team.
|
|
|
|
|
|
Hello friends,
i don't know anything about COM like how to create or use...Can anybody help me to find the right way to do it.
For example in my project i have a class that deals with all db operations i want to make it as com and use this in some other project please anybody help me ..
Regards
Alex.
|
|
|
|
|
|
Hello,
'COM+ Programming: A Practical Guide Using Visual C++ and ATL (With CD-ROM) by Pradeep Tapadiya' is much better. (See amazon.com)
Regards
|
|
|
|
|
I have a problem that I have not been able to resolve. I have a C# exe where I have exposed some interfaces. My problem is that every call to createobject creates a new instance of the application. What I need is one running application from which a client can connect to.
Scenario 1:
Application is launched from command line.
User connects to existing running application using createobject (this does not work...it creates another instance)
Scenario 2:
Application is not running
User run createobject to connect to launch application. App launches (however if another program does a createobject it creates yet another instance).
I have not found anything in my searches that have helped.
Someone please shed some light on this!
Thanks,
Loren
|
|
|
|
|
Hello,
Just check 'DECLARE_CLASSFACTORY_SINGLETON(...)' macro on MSDN.
Regards
|
|
|
|
|
Thanks...is there an equivalent C# implementation? My EXE is a C# program.
Loren
|
|
|
|
|
Hi, folks.
A VC++ project I'm working on was doing fine in VS 2003. However, under VS 2005 IInputObject is behaving erratically. Specifically, UIActivateIO gets called only when fActivate is false (toolbar losing focus), never when it's true (gaining focus).
More importantly, however, is that TranslateAcceleratorIO now never gets called at all. This makes it impossible to get user input from edit or combo controls on the toolbar.
Anyone else experiencing IInputObject adventures in VS 2005?
|
|
|
|
|
Hi All,
I need to write some Composite control in my ATL using com technology project.
My question is how i control the GUI ?
What I mean is - in MFC i define some control variable that i can control the GUI control in easy why - can i do it also in Composite control ?
Until now i use "ListView_SetColumn" or those command to change/add/find something in my list Control - but this way is not the simple way - does there is some simple way to use the control ?
I also could not do casting from the control the list view type.
Thanks for any help.
|
|
|
|
|
I have spent much time to do this but i can NOT complete.
I can Not take the control of Standard Toolbar of Microsoft Outlook ( Not Outlook Express ).
I hope to receive Comments from from other plz
(Sorry for my bad english :P)
|
|
|
|
|
I have an unmanged MFC project, in which we plan to add a MS Visio control.
Now, I can bring Visio out, set its properties. But I cannot find a way to add events?
Can anyone help me?
By investigation of Visio SDK, we found something like:
vaoGetObjectWrap(app)
app.EventList(eList)
eList.AddAdvise(....)
Seems there is a way to do it. But I cannot find any code samples that actually work.
Can anyone help, please.
|
|
|
|
|
hi all,
I have a series of JPEG file coming from a source. I have to create a MPEG file from the series of JPEG file, which can be played in Media Player. How can I do this. What algorith i have to use or else i have to use COM and ActiveX control for the same. Can u give any idea regarding this.
Thanks and Regards
Yudhisthira Attry
|
|
|
|
|
Hello!
How I can create COM+ application in Component Services->Computers->My omputer->COM+ Application->[My COM+ App] from my own program?
How I can run commands 'Shutdown', 'Start' and 'Disable' for my COM + Application?
Is it possible?
Please, help me if somebody know..
Thanks..
-- modified at 5:49 Tuesday 27th March, 2007
|
|
|
|
|
Is there a way to access a COM component without knowing it's ClassID?
----------------------------
286? WOWW!
|
|
|
|
|
This is not the case: a CLSID is just one object discovery/creation mechanism. As another poster pointed out, another mechanism is the ProgID. Another is monikers (see the IMoniker interface). There are more, not counting ones you invent yourself.
-- modified at 1:28 Tuesday 27th March, 2007
It seems the post this was a reply to has been deleted; this was not a response to _8086’s post as looks like is the case. I must say it’s a little weak to delete a post just because someone replies and corrects you, especially when it destroys the flow of the thread.
Steve
|
|
|
|
|
Depends on what you mean with "access a COM component without knowing its ClassID".
You have to know something about it, if you want to create an instance of it...
If you know the ProgID you can get the ClassID with ::CLSIDFromProgID() .
It could be a component that is registered as a member of a component category, which means that it expose interfaces that components of that category have to expose. Enumerating the members of a category will get you the ClassID for each component in that category.
But if don't want to create an instance of the component, you would only need to know one of the interfaces it exposes and get an interface pointer from another client of that instance.
Probably a confusing answer to a somewhat confusing question... :->
Post again and describe what you mean more clearly if the above doesn't help.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi,
I am using the MS Word 9 object library and I would like to convert a Word document into html format using the code below. However, my .Net application does not recognise the wdFormatHTML file format.
I just don't know what to do about this and would really really appreciate any help on this.
Please help.
Kind regards,
Polly Anna
Dim strFileName As String
Dim objWordApplication As New Word.Application
Dim objDocument As New Word.Document
strFileName = pstrPathName & "\" & pstrDocumentName
objDocument = objWordApplication.Documents.Open(strFileName)
objDocument.Activate()
objDocument.Bookmarks.Add("TestBookmark2")
objDocument.SaveAs (FileName:="DOCUMENTNAMEHERE.htm",FileFormat:=wdFormatHTML, EmbedTrueTypeFonts:=False)
|
|
|
|
|
is word k.document
k.html inverted to html
////////////////////////
string filePath = "D:\\k.doc";
Word.ApplicationClass wordApplication = new Word.ApplicationClass();
// Opening a Word doc requires many parameters, but we leave most of them blank...
object o_nullobject = System.Reflection.Missing.Value;
object o_filePath = filePath;
Word.Document doc = wordApplication.Documents.Open(ref o_filePath,
ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject,
ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject,
ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject);
// Here we save it in html format...
// This assumes it was called "something.doc"
string newfilename = "k.html";
object o_newfilename = newfilename;
object o_format = Word.WdSaveFormat.wdFormatHTML;
object o_encoding = Microsoft.Office.Core.MsoEncoding.msoEncodingUTF8;
object o_endings = Word.WdLineEndingType.wdCRLF;
// Once again, we leave many of the parameters blank.
// See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbawd11/html/womthSaveAs1_HV05213080.asp
// for full list of parameters.
wordApplication.ActiveDocument.SaveAs(ref o_newfilename, ref o_format, ref o_nullobject,
ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject,
ref o_nullobject, ref o_nullobject, ref o_encoding, ref o_nullobject,
ref o_nullobject, ref o_endings, ref o_nullobject);
// Report success...
// Finally, close original...
doc.Close(ref o_nullobject, ref o_nullobject, ref o_nullobject);
tkml
|
|
|
|
|
Hi Tklem,
yes, that worked a treat.
Thank you very much indeed.
Kind regards,
Polly Anna
|
|
|
|
|