|
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
|
|
|
|
|
Juan Antonio Bermejo wrote: template<class t="">
void SomeFunction(typename std::vector<t>::iterator begin, typename std::vector::iterator end)
{
...
}
You are trying to specialize a templated fuction with another template. If you changed it to specify explicitly which case you wanted:
void SomeFunction(typename std::vector<int>::iterator begin, typename std::vector::iterator end)
{
...
}
It might behave a bit better (using whatever type you actually want instead of int there).
Also, you may have to specify the type on the call:
myclass.SomeFunction<vector<int>::iterator>(data.begin(), data.end());
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I have a project which I'm moving to VC2005 by moving the old code from VC6 into the new framework that is provided.
In doing so, at one point where I found the usage of _Module(CComModule _Module) I came to conclusion that the functionality has been distributed under various classes.
Please let me know the substitute for CComModule _Module that i can use in the code that is to be used in VS2005 or else I can still use CComModule on which my old fucntions rely upon.
I read the documentation on the link
http://msdn2.microsoft.com/en-us/library/79kd7a00%28VS.80%29.aspx
, and
|
|
|
|
|
i am on a project with windows and unix machines need to networked.
when parellel threads are running the unix machine doent informed the sockets of finished threads are closed. only after all the threads are finished then only the machine treats the sockets as closed .is socket is blocking one or a non blocking one.
vineesh
|
|
|
|
|
Please don't cross post.
led mike
|
|
|
|
|
I wonder if there's a way to block cross posting?
Chris Meech
I am Canadian. [heard in a local bar]
I agree with you that my argument is useless. [Red Stateler]
Hey, I am part of a special bread, we are called smart people [Captain See Sharp]
The zen of the soapbox is hard to attain...[Jörgen Sigvardsson]
I wish I could remember what it was like to only have a short term memory.[David Kentley]
|
|
|
|
|
You can do that by going to the offenders house, and break his or her keyboard over your knee. To be absolutely sure, stomp on his or her mouse as well (if they're smart enough to activate the on screen keyboard and/or copy/paste messages).
--
From the network that brought you "The Simpsons"
|
|
|
|
|
i need a help pls tell me how can i handle the pss_thru in hyper threding
vineesh
|
|
|
|
|
tom groezer wrote: I wanted to know whether _AtlModule is the substitute of _Module.
They hide that information in the documentation[^]
led mike
|
|
|
|
|
Hi,
I have developed an ATL component in VS2005. When I try to register that dll in another system where VS2005 is not installed its not getting registered
but if try to register it in a system where VS2005 is installed its getting registered.I build the application choosing "Use MFC in Static Library".
What could be the problem?Any suggestion would be helpful.
thanks
Today is a gift, that's why it is called the present.
|
|
|
|