Click here to Skip to main content
15,901,283 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: please Its Urgent Pin
Paul Conrad14-Jul-07 11:11
professionalPaul Conrad14-Jul-07 11:11 
QuestionWhy can not define _ATL_MIN_CRT in Service Project? Pin
samfromcn6-Jun-07 23:05
samfromcn6-Jun-07 23:05 
AnswerRe: Why can not define _ATL_MIN_CRT in Service Project? Pin
Stuart Dootson7-Jun-07 0:27
professionalStuart Dootson7-Jun-07 0:27 
Questionhow can an ATL get its own name in the container? Pin
Rex.xie6-Jun-07 3:14
Rex.xie6-Jun-07 3:14 
AnswerRe: how to get the instance name of an ATL shown in the container. Pin
Steve S7-Jun-07 2:36
Steve S7-Jun-07 2:36 
GeneralRe: how to get the instance name of an ATL shown in the container. Pin
Rex.xie7-Jun-07 16:47
Rex.xie7-Jun-07 16:47 
GeneralRe: how to get the instance name of an ATL shown in the container. Pin
Steve S11-Jun-07 21:22
Steve S11-Jun-07 21:22 
GeneralRe: how to get the instance name of an ATL shown in the container. Pin
Rex.xie11-Jun-07 21:30
Rex.xie11-Jun-07 21:30 
I have solve the problem.
LPOLECLIENTSITE lpSite;
GetClientSite(&lpSite);
EnumAllControlNames(lpsite);

void CRadioButton::EnumAllControlNames(LPOLECLIENTSITE lpSite)
{
LPOLECONTAINER lpContainer;
LPENUMUNKNOWN lpEnumUnk;

// Note that the IOleContainer interface is currently defined as
// mandatory. It must be implemented by control containers,
// in the OLE Control Containers Guidelines.
HRESULT hr = lpSite->GetContainer(&lpContainer);
if(FAILED(hr)) {
OutputDebugString(_T("Unable to get to the container.\n"));
return;
}

// OLECONTF_EMBEDDINGS is used to retrieve OLE Controls.
// OLECONTF_OTHERS is used to retrieve other objects such as
// Visual Basic internal controls
hr = lpContainer->EnumObjects(
OLECONTF_EMBEDDINGS | OLECONTF_OTHERS,
&lpEnumUnk);
if(FAILED(hr)) {
lpContainer->Release();
return;
}

LPUNKNOWN lpUnk;
while (lpEnumUnk->Next(1, &lpUnk, NULL) == S_OK) {
LPOLEOBJECT lpObject = NULL;
LPOLECONTROLSITE lpTargetSite = NULL;
LPOLECLIENTSITE lpClientSite = NULL;
LPDISPATCH lpDisp;

hr = lpUnk->QueryInterface(
IID_IOleObject, (LPVOID*)&lpObject);
if(SUCCEEDED(hr)) {
// This is an OLE control.
// Navigate to the Extended Control because Visual Basic 4.0 uses
// Extended controls.
hr = lpObject->GetClientSite(&lpClientSite);
if(SUCCEEDED(hr)) {
// You have the IOleClientSite interface
hr = lpClientSite->QueryInterface(
IID_IOleControlSite, (LPVOID*)&lpTargetSite);
if(SUCCEEDED(hr)) {
// You have the IOleControlSite interface
// Get the IDispatch for the extended control.
// Note that Extended controls are optional in the OLE
// specifications for OLE Control Containers.
hr = lpTargetSite->GetExtendedControl(&lpDisp);
}
}
}
else {
// This is either an internal VB control or the
// VB form itself.
hr = lpUnk->QueryInterface(
IID_IDispatch, (LPVOID*)&lpDisp);
}

if(SUCCEEDED(hr)) {
VARIANT va;
VariantInit(&va);
DISPID dispid;
DISPPARAMS dispParams = { NULL, NULL, 0, 0 };

// Get the names of all the controls present in a VB form.
LPWSTR lpName[1] = { (WCHAR *)L"Name" };
hr = lpDisp->GetIDsOfNames(IID_NULL, lpName, 1,
LOCALE_SYSTEM_DEFAULT, &dispid);

if(SUCCEEDED(hr)) {
hr = lpDisp->Invoke(dispid/*0x80010000*/, IID_NULL,
LOCALE_SYSTEM_DEFAULT,
DISPATCH_PROPERTYGET |
DISPATCH_METHOD,
&dispParams, &va, NULL, NULL);
if(SUCCEEDED(hr)) {
CString szTmp((LPCWSTR)va.bstrVal);
// szTmp now has the name.
OutputDebugString(_T("And the name is ... ") + szTmp +
_T("\n"));


}
}
lpDisp->Release();
}

// Release interface pointers.
if(lpObject) lpObject->Release();
if(lpTargetSite) lpTargetSite->Release();
if(lpClientSite) lpClientSite->Release();

lpUnk->Release();
} // End of While statement

// Final clean up
lpEnumUnk->Release();
lpContainer->Release();

}
Questionhow to block print screen with C++ Pin
satish_abiram5-Jun-07 3:17
satish_abiram5-Jun-07 3:17 
AnswerRe: how to block print screen with C++ Pin
Fatbuddha 113-Jun-07 2:21
Fatbuddha 113-Jun-07 2:21 
AnswerRe: how to block print screen with C++ Pin
Paul Conrad14-Jul-07 11:11
professionalPaul Conrad14-Jul-07 11:11 
QuestionATL ActiveX and WM_DEVICECHANGE Pin
jhinze4-Jun-07 6:19
jhinze4-Jun-07 6:19 
QuestionMultiple Inheritance by IDispatch Pin
ajitatif angajetor4-Jun-07 3:36
ajitatif angajetor4-Jun-07 3:36 
AnswerRe: Multiple Inheritance by IDispatch Pin
Stuart Dootson4-Jun-07 21:02
professionalStuart Dootson4-Jun-07 21:02 
GeneralRe: Multiple Inheritance by IDispatch Pin
ajitatif angajetor4-Jun-07 22:06
ajitatif angajetor4-Jun-07 22:06 
GeneralRe: Multiple Inheritance by IDispatch Pin
Stuart Dootson4-Jun-07 23:11
professionalStuart Dootson4-Jun-07 23:11 
QuestionCan't stop the ATL Service in windows 2003 Pin
sumathi pandarinathan3-Jun-07 17:08
sumathi pandarinathan3-Jun-07 17:08 
QuestionTwo Custom Context Menu Extensions are Now Mutually Exclusive (Vista) Pin
Jeffrey Walton3-Jun-07 16:58
Jeffrey Walton3-Jun-07 16:58 
AnswerRe: Two Custom Context Menu Extensions are Now Mutually Exclusive (Vista) Pin
Jeffrey Walton4-Jun-07 14:32
Jeffrey Walton4-Jun-07 14:32 
Questionproblem with adding toolbar using shared addin? Pin
Banks K31-May-07 1:37
Banks K31-May-07 1:37 
QuestionOLE DB Pin
User 1278230-May-07 18:59
User 1278230-May-07 18:59 
QuestionCreate an ActiveX control through code Pin
arjunmarwaha29-May-07 18:35
arjunmarwaha29-May-07 18:35 
AnswerRe: Create an ActiveX control through code Pin
Clebson Derivan31-May-07 4:17
Clebson Derivan31-May-07 4:17 
QuestionHow to represent correctly UTF8 strings in WTL controls? Pin
Vlad029-May-07 7:01
Vlad029-May-07 7:01 
AnswerRe: How to represent correctly UTF8 strings in WTL controls? Pin
Michael Dunn29-May-07 9:04
sitebuilderMichael Dunn29-May-07 9:04 

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.