|
|
hi all
i had made applicaton that generate the barcode and now i want the to make it as com component and acces through site. i mean online barcode geneator. it works fine as destop application.
i want to know how to use mfc classes in atl. or these allowed or cannot use these classes in atl 7. im using visual studio.net 2003. and atl 7 project.
ddd
|
|
|
|
|
cross posts are never welcomed
|
|
|
|
|
i dont think that is the cross post.is this atl forum and i want to know how to use mfc classes in atl that is simple question no cross question.
well how to read the text file in ATL i had tried to use the MFC class but it gives error when i use this when i add header file of it then it also give error.
ddd
|
|
|
|
|
do you know what cross-posting is ?
you ask on Visual C++ forum, COM forum, and now ATL forum...
i agree that your question concerns all these categories, but you have to choose the best place to ask, and wait for an answer. only then you can try another forum if you didn't get pertinent solutions...
so, i keep my position, you cross-posted the message boards
|
|
|
|
|
The most important factor is time
i m new to ATL amd COM and dont know the which section is good and secondly i dont know ur answering mechanism u visit all sections or particular. though above question was related to COM and ATL but i got my answer from MFC forum if i dont post there then i should wait the whole day perhaps whole week and so on.
Tasleem arif
-- modified at 9:00 Tuesday 28th March, 2006
|
|
|
|
|
|
Hi all,
Recently I began work localizing my apps. My source of reference is the satdll sample found in MSDN (based on MFC however).
I'm using _Module.SetResourceInstance() to point the app to my external resource dll and it seems to work as my built-in resouces are no longer used. However, the trouble is my new resources in the dll is not showing up as well (all my dialogs are skipped and message strings appear empty).
I've made sure that my resource IDs are the same but I've set the language attribute to something other than English (e.g. my french res dll will have all resources specified as French (France)).
Any advise/pointers is much appreciated.
Cheers
Sidney
--------------------------------------------
Need help with your spelling in the forum?
Check out ieSpell, spell checker addon for Internet Explorer.
|
|
|
|
|
What do you mean by "built-in resources"?
ATL 7 lets you have multiple modules that are searched for resources. If you're using VC6, you can only have one (that's what SetResourceInstance() does), so you'll need to use Win32 APIs and pass a HINSTANCE instead of using the resource loading wrappers.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Sorry. My bad. I've managed to find my problem - it has to do with FreeLibrary getting called by a class destructor even before my dialog was displayed
On a related note, anyone have experience using InitMUILanguage to change the language of the common controls? I just tried it with the French Language ID (0x0c0c) on a US English XP but its not working. I'm wondering if its due to :
1) my system not having the French language installed? (not likely as I'm under the impression that the default US English Windows XP includes most European language support)
2) I read in a newsgroup that InitMUILanguage must be called before AtlInitCommonControls? (I can't even find AtlInitCommonControls in my code!)
Any advice is much appreciated!
--------------------------------------------
Need help with your spelling in the forum?
Check out ieSpell, spell checker addon for Internet Explorer.
|
|
|
|
|
From this blog post[^]:The ironic part is that the Windows common controls do have a workaround for this issue, even though there do not seem to be many areas of localized text in them. If you look at the topic entitled Localization Support for the Common Controls, it talks about the InitMUILanguage function (which initializes the UI language for the common controls within a process) and the GetMUILanguage function (which retrieves the UI language for the common controls within a process, or the user UI language if it has not been set). In theory there is no reason why you could not call this function at any point, but in practice it is unclear from the documentation if it will work when set multiple times (hell, I am still having trouble picturing when it works at all, since I cannot think of any localized text!).
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
I export a class in dll examples
typedef vector<string> strvector;
class __declspec(dllexport) myclass()
{
void setvector(strvector &list);
}
void setvector(strvector &list)
{
list.push_back("mystring");//change the data
}
if i use this dll in my program
myclass mydll;
strvector mylist;
mydll.setvector(mylist);
if i use mylist again my program will crash;
how to deal with that?
i need to change the vector in my dll;
thanks thanks a lot.
|
|
|
|
|
You wrote:
typedef vector<string> strvector;
//just to make it clear to the others.
From what I have heard, it is not possible to pass stl data types like string , to dlls. You can use the good old character array etc.
this is this.
|
|
|
|
|
It is possible. Although, you'll have to do some export magic.
(I *think* Microsoft has already provided the magic needed for std::string)
|
|
|
|
|
how to solve this headache problem,thanks
|
|
|
|
|
The post below from Nemanja Trifunovic is very much the perfect solution.
For the debug version:
Go into the program options. In the C/C++ tab, in the Category: Code Generation , Use run-time library: Debug Multithreaded DLL
For the release version:
Use run-time library: Multithreaded DLL
I have tested it with Win32 dll, and MFC exe like you are using.
this is this.
|
|
|
|
|
how to do that in VS2003?there's no c run-time library.
thanks a lot.
|
|
|
|
|
It is located in:
Project->Project Properties->C/C++ -> Code Generation->Runtime Library.
this is this.
|
|
|
|
|
In general, that will work only if both the dll and the executable are linked dynamically against CRT and C++ standard library.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Hmm.. why? I can see the potential problem of mixed up heaps, but that shouldn't happen, should it? Unless if stl objects messes with other objects' dynamically allocated memory.
|
|
|
|
|
In the original posters example, that is happening. The strvector is constructed in the exe. When the setvector method is called, a string that's been constructed in the DLL is added to the vector. Later, when the strvector is destructed in the executable, it'll call the string destructor, also in the executable. This will try to release memory from the DLLs heap, which it doesn't have access to unless you've used the DLL CRT.
|
|
|
|
|
Don't ask what was in my pipe.
|
|
|
|
|
hi all,
As i develop windows application in MFC and i am new to ATL/COM ,
for that which link or book are better to learn ATL/COM developement
send reply
|
|
|
|
|
|
I made a COM object in a DLL (VS 6.0, ATL wizard). And trying to fire event and handle it in browser (IE 6.0), but browser doesn't react.
What haven't I noticed?
========================================================
html page:
========================================================
<html><head>
<object name="loApp"
classid="clsid:B92CBD2B-E660-4164-8810-2F382237EFC9"
codebase="SimpleAtlCom.dll"
style="display:none"></object>
<script language="JScript">
function loApp::TotalMarks(TotalMarks){
alert(TotalMarks);
}
function mess(){
loApp.mess();
}
</script></head><body><form name="testForm">
<input type="button" value="mess()" onclick="mess()">
</form></body></html>
========================================================
Generated ConnectionPoint
========================================================
template <class T>
class CProxy_ISimpleObjEvents : public IConnectionPointImpl<T, &DIID__ISimpleObjEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
VOID Fire_TotalMarks(SHORT TotalMarks)
{
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
MessageBox(NULL,(nConnections==0)?"==0":"!=0", NULL, MB_OK);
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
pvars[0] = TotalMarks;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
}
}
delete[] pvars;
}
};
|
|
|
|