|
The call to RegisterAll() was present but before the server started other servers, inshort before it completely initialized its state. So I moved the RegisterAll() call after the initialization just before its main window is shown. The call to RegisterAll() informs the OLE System Dll's that the coclasses inside this server are ready to handle calls.
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
what is the use/function of manifest file in WTL
|
|
|
|
|
The manifest file is embedded into the executable to support the XP Themes.
|
|
|
|
|
hi i had found a project but this line give me confusion,if any body can help me i will be thankful to him.
std::vector<handle> vThreads;
HANDLE hThread = CreateThread(NULL,0,CMyService::Serve,(void*) pServe,CREATE_SUSPENDED,&dwServe);
vThreads.push_back(hThread);//i m talking about this line,
will that thread will be executed in backgroundor not,what will happen to that thread.
Tasleem Arif
|
|
|
|
|
The CREATE_SUSPENDED flag means the thread will not run until you call ResumeThread() on its handle.
|
|
|
|
|
tasleem143 wrote: vThreads.push_back(hThread);//i m talking about this line,
will that thread will be executed in backgroundor not,what will happen to that thread.
This line stores the handle returned by the CreateThread API.Which is helpful for controlling the thread.
And thread is created in suspended mode.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Thanks both of u for kind help.
Regards.
Tasleem Arif
|
|
|
|
|
i create an ATL project and insert an full control named IMyClient .the class is
CMyClient.Then i add other C++ class CDealEvent .Now i want to use the function 'onidle'
that in CMyClient ,how should i do? the code like this:
///////////////////////////////////
//MyClient.h
///////////////////////////////////
#include DealEvent.h;
class ATL_NO_VTABLE CMyClient:
public ......
{
...........
///////////////////////////////
//here i add a function onIdle
///////////////////////////////
public:
HRESULT onIdle(void);
CDealEvent* pEvent;
HRESULT FinalConstruct()
{
pEvent=new CDealEvent();
}
}
///////////////////////////////////
//MyClient.cpp
///////////////////////////////////
HRESULT CMyClient::onIdle(void)
{
//some code here
}
CMyClient::CMyClient():pEvent(NULL)
{
}
//////////////////////////////////
//add other c++ class DealEvent.h
/////////////////////////////////
class CDealEvent
{
public:
callonIdle();
}
//////////////////////////////////
//add other c++ class DealEvent.cpp
/////////////////////////////////
void CDealEvent::callonIdle()
{
//here i want to call ' onIdle ' that in CMyClient
//how should i do?
}
|
|
|
|
|
china.net wrote: void CDealEvent::callonIdle()
{
//here i want to call ' onIdle ' that in CMyClient
//how should i do?
}
You can use CComObject::CreateInstance , but I doubt, you need same instance, is it?
|
|
|
|
|
Hi,
I'm porting one of the dll from vc6 to vc8. In doing so I have created a complete framework to create a dll and subseqently add atl objects.
By default the framewaork adds the follwoing code in the main app file
class MyClassModule : public CAtlDllModuleT< MyClassModule>
{
public :
DECLARE_LIBID(LIBID_MyClassLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MYCLASS, "{7C00C752-3DA7-4CB9-B721-7F39F9FEDD2E}")
};
In previous versions of ATL CComModule _Module was used which has been replaced by CAtlBaseModule.
Problem:
In the current application there is an
extern CComModule _Module in stdafx.h
and definition in main app file as CComModule _Module .
The global object _Module is being used in other files which include the stdafx.h file.
These files call methods like _Module.GetModuleInstance () and _Module.GetResourceInstance ());
Questions)
1)Is a global object of this class MyClassModule to be created and will the same exact functions as used on _Module be used here too.
2)Also since the above derivation is in in my app file how will the class MyClassModule and the global object of it be visible to other projects in order to call upon the functions.
|
|
|
|
|
|
Hi everybody,
can anybody please direct me to a web site or an article (I could not find anything helpful) about how to make controls to be transparent. I use Visual Studio 2005 to make a Visual C++ dialog based application, and I use ATL only. Even though I specify a static control should be transparent, it is not. The background is static, it does not change, but neither static controls nor the captions of group box controls are rendered transparently.
Thanks for your help.
|
|
|
|
|
Okay, I found it:
I need to handle the message OnCtlColorStatic:
::SetBkMode((HDC)wParam, TRANSPARENT);
return (LRESULT) GetStockObject (HOLLOW_BRUSH);
and my static controls are all transparent.
But I can still not make group box captions to be trtansparent.
Thanks.
|
|
|
|
|
I have a class that I wrote I C# and I want to use it in a VC++ project without turning the C# class into a COM object. These are the steps that I've been given by a colleague:
I don't have code sample but I have steps how to do it. But my problem is how do I do step 9? Does anyone have a code sample of how to access the C# methods in VC++ through a type library??
Much appreciated!
L
1. Create a C# class
2. Generate a key for it - sn -k keyfile.snk
3. Put an assembly directive at top of file
[(Assembly: AssemblyKeyFile("keyfile.snk")]
4. Compile
5. regasm file.dll /tlb to generate the COM Type Library
6. gacutil -i file.dll to place file in GAC
7. Copy the generated typelibraries into the directory of your ATL/C++ project
8. #import file.tlb no_namespaces named_guids (look up the reff for exact syntax)
9. Compile ATL/C++ code and you will have access to the interfaces through the types in the imported tlb
|
|
|
|
|
malayalite wrote: I want to use it in a VC++ project without turning the C# class into a COM object
The steps you posted turn the C# class into a COM object
malayalite wrote: 5. regasm file.dll /tlb to generate the COM Type Library
malayalite wrote: 7. Copy the generated typelibraries into the directory of your ATL/C++ project
8. #import file.tlb no_namespaces named_guids (look up the reff for exact syntax)
9. Compile ATL/C++ code and you will have access to the interfaces through the types in the imported tlb
So first you say you don't want to use COM then you ask:
malayalite wrote: how do I do step 9?
So the two questions contradict each other, therefore, what is your question?
led mike
|
|
|
|
|
I am a beginner of ATL, so help me .
i made a ActivX control by VS2005, which will be used in web pages.This activex Control need
to call some script functions,but i just got DISP_E_UNKNOWNNAME,the error position labeled by //! ,why? help me.
code like this:
I create a ATL project(dll,merging of proxy&stub) insert a atl control,here are my
choices:standard control,apartment,dual,no aggregation,support connection points,
add any interface such as IObjectWithSite etc. appearance i just choice 'invisible'.
add variables:
IWebBrowser2* pBrowser;
IHTMLDocument* pHtmDoc;
CComPtr<IDispatch> pScript;
implement SetClientSite method:
STDMETHODIMP CActiveClient::SetClientSite(IOleClientSite* pClientSite)
{
HRESULT hr = S_OK;
IServiceProvider *isp, *isp2 = NULL;
if (pClientSite==NULL)
{
if(pBrowser)
{
pBrowser->Release();
pBrowser=NULL;
}
return E_FAIL;
}
else
{
try{
hr = pClientSite->QueryInterface(IID_IServiceProvider,
reinterpret_cast<void **>(&isp));
if (FAILED(hr))
{
throw(BSTR("QueryInterface:IID_IServiceProvider
failed!"));
}
hr = isp->QueryService(SID_STopLevelBrowser,
IID_IServiceProvider, reinterpret_cast<void **>(&isp2));
if (FAILED(hr))
{
throw(BSTR("SID_STopLevelBrowser failed!"));
}
hr = isp2->QueryService(SID_SWebBrowserApp, IID_IWebBrowser2,
reinterpret_cast<void **>(&pBrowser));
if (FAILED(hr))
{
throw(BSTR("SID_SWebBrowserApp failed!"));
}
hr=pBrowser->get_Document((IDispatch**)&pHtmDoc);
if(FAILED(hr))
{
throw(BSTR("GetDocument failed!"));
}
hr=pHtmDoc->get_Script(&pScript);
if(FAILED(hr))
{
throw(BSTR("GetScript failed!"));
}
}
catch(BSTR error)
{
MessageBox(error,OLESTR("info"),MB_OK);
return hr;
}
catch(...)
{
MessageBox(OLESTR("Unknown error!"),OLESTR("info"),MB_OK);
return hr;
}
}
if(isp)
{
isp->Release();
isp=NULL;
}
if(isp2)
{
isp2->Release();
isp2=NULL;
}
CComBSTR szName("TestScript");
DISPID dispid;
//! here "GetIDsOfNames" ,i failed to get the dispid of
//! TestScript function
//! The error code is DISP_E_UNKNOWNNAME
hr=pScript->GetIDsOfNames(IID_NULL,&szName,1,LOCALE_SYSTEM_DEFAULT,&dispid);
if(FAILED(hr))
{
switch(hr)
{
case E_OUTOFMEMORY:
MessageBox(OLESTR("E_OUTOFMEMORY"),OLESTR("info"),MB_OK);
break;
case DISP_E_UNKNOWNNAME:
MessageBox(OLESTR("DISP_E_UNKNOWNNAME"),OLESTR("info"),MB_OK);
break;
case DISP_E_UNKNOWNLCID:
MessageBox(OLESTR("DISP_E_UNKNOWNLCID"),OLESTR("info"),MB_OK);
break;
}
}
DISPPARAMS dispparams;
memset(&dispparams, 0, sizeof dispparams);
dispparams.cArgs = 1;
dispparams.rgvarg = new VARIANT[dispparams.cArgs];
for( int i = 0; i < 1; i++)
{
CComBSTR bstr = "using Script";
bstr.CopyTo(&dispparams.rgvarg[i].bstrVal);
dispparams.rgvarg[i].vt = VT_BSTR;
}
dispparams.cNamedArgs = 0;
EXCEPINFO excepInfo;
memset(&excepInfo, 0, sizeof excepInfo);
CComVariant vaResult;
UINT nArgErr = (UINT)-1;
hr = pScript->Invoke
(dispid,IID_NULL,0,DISPATCH_METHOD,&dispparams,&vaResult,&excepInfo,&nArgErr);
if(FAILED(hr))
MessageBox(OLESTR("Invoke Failed!"),OLESTR("info"),MB_OK);
return hr;
}
/////////////////////html doc
<html >
<head>
<title>no title</title>
<!-- my ActiveX control -->
<object id="iCryOne" height="0" width="0" classid="clsid:83145F6D-9130-4CAA-AA7B-
65C2540E1B61" >
</object>
</head>
<script language="javascript">
function TestScript(msg)
{
alert(msg);
}
</script>
<body>
</body>
</html>
-- modified at 7:59 Wednesday 22nd November, 2006
|
|
|
|
|
Where do you get the error? Also, tick the "Ignore HTML tags in this message (good for code snippets)" so we can read the code proberly; it's hard to read code without indentation.
Steve
|
|
|
|
|
Hi,
I'm porting one of the dll from vc6 to vc8. In doing so I have created a complete framework to create a dll and subseqently add atl objects.
By default the framewaork adds the follwoing code in the main app file
class MyClassModule : public CAtlDllModuleT< MyClassModule>
{
public :
DECLARE_LIBID(LIBID_MyClassLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MYCLASS, "{7C00C752-3DA7-4CB9-B721-7F39F9FEDD2E}")
};
In previos versions of ATL CComModule _Module was used which has been replaced by CAtlBaseModule.
Problem:
There was an extern declaration as extern CComModule _Module in stdafx.h and definition in main app file as CComModule _Module .
How do I replicate the above behaviour in the new version. as CComModule is known to stdafx.h all other classes could use _Module. How do I use the global instance of MyClassModule in other modules.
|
|
|
|
|
CComModule was declared in ATLBase.h . So there was not any problem previously.
You may need to move MyClassModule class definition to separate header file.
And declare its object as extern in stdafx.h . Before that you need to include class header.
Or in other words adopt method in c++ to make visbile any global object across applicatin.
|
|
|
|
|
Where do I define my global object and I suppose the global object is to be created out of the class MyClassModule. Is it the application.cpp file?
Also how do I call methods like _Module.GetModuleInstance (), _Module.GetResourceInstance ()) on the new global object.
|
|
|
|
|
i have added a tol bar to the outlook
when i click to create new message tab in outlook a page open with a button i placed on that.by clicking that button a tool bar opens. i want that when i open this on one page and then open a new mail message page then this will not show on that new page anyone know any method reagarding this
|
|
|
|
|
Hi All,
I have some queries regarding font.
Q1. What is exactly a 'Bitmap Type Font', 'TrueType Font'?
Q2. Difference between the two.
Q3. Difference between 16-bit version and 32- version of a Font?
q4. How can we identity whether a font is 16-bit version or 32-bit?
Anwsers to any of the above will be great help for me.
Thanks in advance
Suraj
Suraj Gupta
|
|
|
|
|
I have something like this:
class SomeClass
{
...
template <typename _Iter>
void SomeFunction(_Iter begin, _Iter end)
{
...
}
}
and I want to specialize de template when I use vector::Iterator. I try this:
class SomeClass
{
...
template <typename _Iter>
void SomeFunction(_Iter begin, _Iter end)
{
...
}
template<class T>
void SomeFunction(typename std::vector<T>::iterator begin, typename std::vector<t>::iterator end)
{
...
}
}
The source (under Visual 2005) complies without errors nor warnings. When I try to use that specialization (something like this):
...
vector<midata> data;
myclass.SomeFunction(data.begin(), data.end());
the program calls the first one instead of the second (as I expected).
Is it possible to program that specialization? How?
Thank you in advance
jab
www.virtuamanager.com
|
|
|
|
|
Hello Juan,
The overload you're proposing (it's an overload, not a specialization) is illegal because std::vector<T>::iterator is not what the standard calls a proper deduced context. An example will help clarify why the language cannot accept contexts of the form a<T>::b where T is a template parameter. Consider the following:
template<typename T>
struct foo
{
typedef void * type;
type a;
};
template<typename T>
void f(typename foo<T>::type a){...}
int main()
{
foo<int> x;
f(x.a);
} Do you see why this cannot work? Although it seems like the call f(x.a) should deduce T to be int , in reality it is impossible to make this deduction, as foo<T>::type is void * for every T .
In your particular case, you might want to replace this overload (which can't work for the reasons explained) with some machinery to dispatch SomeFunction based on the category of the iterator (bidirectional, random-access, etc.) If you need help with this feel free to ask.
Hope this helps,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Thank you so much, your example clarify me a lot. I'll try what you sugest.
jab
www.virtuamanager.com
|
|
|
|