|
This worked. Thanks again.
|
|
|
|
|
Hi,
I need some tutorial on ATL/WTL/STL to deep understanding, so please suggest me.
Thanks & Regards
Pankaj Jain
|
|
|
|
|
How about CodeProject? ATL[^] WTL[^] STL[^]
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
For ATL and WTL, start here[^]
|
|
|
|
|
PK Jain wrote: I need some tutorial on ATL/WTL/STL to deep understanding, so please suggest me.
ATL, WTL and STL are unrelated to each other. They just heavily use templates. I would not invest too much into these outdated libraries.
|
|
|
|
|
er, WTL is a set of classes built on the ATL windowing classes.
STL is not outdated.
|
|
|
|
|
|
i have made the plugin in VC for outlook so when i send mail the micorsoft word page remain open i want to close that page so any1 can help me in this regard.
the code for initilizing the word is as follow
if(EditorType==olEditorWord)
{
HWND hwnd;
hwnd = ::GetForegroundWindow();
HRESULT hr = EnumChildWindows(hwnd, &EnumWindowsProc, NULL);
CComPtr<idispatch>Dispatch;
spInspect->get_WordEditor((IDispatch**)&Dispatch);
DISPID dispp;
OLECHAR FAR* szMemberpName;
EXCEPINFO pexcep;
UINT uArgErr;
DISPPARAMS disparams={NULL,NULL,0,0};
szMemberpName = L"Close";
VARIANTARG ApResult;
Dispatch->GetIDsOfNames (IID_NULL, &szMemberpName, 1, LOCALE_SYSTEM_DEFAULT, &dispp);
hr = Dispatch->Invoke(dispp, IID_NULL, LOCALE_SYSTEM_DEFAULT,DISPATCH_METHOD, &disparams, &ApResult, &pexcep, &uArgErr);
if(FAILED(hr))
{
_bstr_t des;
char * ii;
des = pexcep.bstrDescription;
ii = (char*) des;
}
else
{}
|
|
|
|
|
Hi,
I have to post a message froma thread that I have created and I cant seem to find the DefWindowProc that is usually in a MFC program, so how does one actually perform an action when a message is triggered.
I am completely new at ATL, any help would be greatly appreciated.
Thanks
|
|
|
|
|
This[^] article should help you.
|
|
|
|
|
|
IMO, it can be done differently. No need to create a server B. Just call your COM object like in the snippet below.
try
{
long lResult = DoIt();
}
catch(...)
{
// Just in case
LogError(_T("Unhandled exception occured.");
}
long DoIt()
{
long lResult = 0;
try
{
ComLibrary::IComLibraryPtr ipExt("Prog_ID");
lResult = ipExt->Main("SomeParam");
if (lResult < 0)
{
LogError("ComLibrary has requested a stop by returning a negative value %d.", lResult);
}
}
catch( _com_error& Err)
{
if (0x800401f3 == Err.Error())
{
LogError("Error creating ComLibrary. Invalid ProgID.");
}
else if(0x8007000e == Err.Error())
{
LogError("Error invoking Main. It is likely that the ComLibrary crashed.");
}
else
{
LogError("Error invoking ComLibrary.");
}
}
catch(...)
{
LogError("Error invoking ComLibrary. Received an unhandled & unknown exception.");
}
return lResult;
}
|
|
|
|
|
Thanks for the reply. Sorry for not responding sooner.
Normally, I would make the calls as you've described. In this particular instance, exception handling has no effect. If the COM object in in-proc, it WILL crash process. It is a third-party library so I don't have access to the code. Also, there is no alternative to this library. If I thought I could write an alternative library for this, I would (well, actually, I think I can, but it would take more time than management wants to take for this feature).
My only recourse is to segregate the library; put it into its own out-of-proc server. That way, if it crashes (and the crashes are now less frequent than when they were part of the main program) it won't crash the main program.
Unfortunately, if it crashes my main program won't get dereferenced and close gracefully.
m.bergman
-- For Bruce Schneier, quanta only have one state : afraid.
|
|
|
|
|
In my ATL application I get a huge number of errors when trying to compile it.
This is my stdafx.h:
#pragma once
#ifndef STRICT
#define STRICT
#endif
#define WIN32_LEAN_AND_MEAN
#define WINVER 0x0500
#define _WIN32_WINNT 0x0500
#define _WIN32_IE 0x0501
#define _RICHEDIT_VER 0x0100
#define _ATL_ALL_WARNINGS
#include <atlbase.h>
#include <atlapp.h>
extern CAppModule _Module;
#include <atlwin.h>
#include <atlstr.h>
#include <atlcontrols.h>
#include "../FileEnc/resource.h"
using namespace ATL;
Any ideas? I tried changing the WTL 8.0 to WTL 7.1, but it is the same. I also updated the header files and moved the include WTL to the bottom of the list in the include options dialog, but to no avail.
This is the error list I get:
Error 2 error C2061: syntax error : identifier 'CHARRANGE' e:\wtl80\include\atlctrls.h 7269
Error 3 error C2061: syntax error : identifier 'CHARRANGE' e:\wtl80\include\atlctrls.h 7282
Error 4 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7298
Error 5 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7305
Error 6 error C2061: syntax error : identifier 'PARAFORMAT' e:\wtl80\include\atlctrls.h 7324
Error 7 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7425
Error 8 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7432
Error 9 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7439
Error 10 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7446
Error 11 error C2061: syntax error : identifier 'PARAFORMAT' e:\wtl80\include\atlctrls.h 7459
Error 12 error C2146: syntax error : missing ';' before identifier 'GetWordBreakProcEx' e:\wtl80\include\atlctrls.h 7490
Error 13 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7490
Error 14 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7491
Error 16 error C2146: syntax error : missing ';' before identifier 'SetWordBreakProcEx' e:\wtl80\include\atlctrls.h 7496
Error 17 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7496
Error 18 error C2061: syntax error : identifier 'EDITWORDBREAKPROCEX' e:\wtl80\include\atlctrls.h 7496
Error 19 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7497
Error 21 error C2061: syntax error : identifier 'TEXTRANGEA' e:\wtl80\include\atlctrls.h 7502
Error 22 error C2061: syntax error : identifier 'FINDTEXTA' e:\wtl80\include\atlctrls.h 7821
Error 23 error C2061: syntax error : identifier 'FINDTEXTEXA' e:\wtl80\include\atlctrls.h 7831
Error 24 error C2535: 'LONG WTL::CRichEditCtrlT<TBase>::FindText(DWORD) const' : member function already defined or declared e:\wtl80\include\atlctrls.h 7832
Error 25 error C2061: syntax error : identifier 'FORMATRANGE' e:\wtl80\include\atlctrls.h 7841
Error 26 error C2061: syntax error : identifier 'FORMATRANGE' e:\wtl80\include\atlctrls.h 7847
Error 27 error C2535: 'LONG WTL::CRichEditCtrlT<TBase>::FormatRange(void)' : member function already defined or declared e:\wtl80\include\atlctrls.h 7848
Error 28 error C2061: syntax error : identifier 'EDITSTREAM' e:\wtl80\include\atlctrls.h 7872
Error 29 error C2061: syntax error : identifier 'EDITSTREAM' e:\wtl80\include\atlctrls.h 7878
Error 30 error C2143: syntax error : missing ';' before '*' e:\wtl80\include\atlctrls.h 7941
Error 31 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7941
Error 32 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7942
Error 34 error C2061: syntax error : identifier 'IRichEditOleCallback' e:\wtl80\include\atlctrls.h 7949
Error 35 error C2059: syntax error : '<cv-qualifer>' e:\wtl80\include\atldlgs.h 1318
Error 36 error C2334: unexpected token(s) preceding ':'; skipping apparent function body e:\wtl80\include\atldlgs.h 1318
Error 37 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atldlgs.h 1332
Error 38 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atldlgs.h 1384
Error 39 error C2143: syntax error : missing ',' before '&' e:\wtl80\include\atldlgs.h 1384
Error 40 error C2059: syntax error : '<cv-qualifer>' e:\wtl80\include\atldlgs.h 1318
Error 41 error C2334: unexpected token(s) preceding ':'; skipping apparent function body e:\wtl80\include\atldlgs.h 1318
Error 42 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atldlgs.h 1332
Error 43 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atldlgs.h 1384
Error 44 error C2143: syntax error : missing ',' before '&' e:\wtl80\include\atldlgs.h 1384
Error 45 error C2059: syntax error : '<cv-qualifer>' e:\wtl80\include\atldlgs.h 1461
Error 46 error C2334: unexpected token(s) preceding ':'; skipping apparent function body e:\wtl80\include\atldlgs.h 1461
Error 49 error C2061: syntax error : identifier 'CHARRANGE' e:\wtl80\include\atlctrls.h 7269
Error 50 error C2061: syntax error : identifier 'CHARRANGE' e:\wtl80\include\atlctrls.h 7282
Error 51 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7298
Error 52 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7305
Error 53 error C2061: syntax error : identifier 'PARAFORMAT' e:\wtl80\include\atlctrls.h 7324
Error 54 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7425
Error 55 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7432
Error 56 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7439
Error 57 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atlctrls.h 7446
Error 58 error C2061: syntax error : identifier 'PARAFORMAT' e:\wtl80\include\atlctrls.h 7459
Error 59 error C2146: syntax error : missing ';' before identifier 'GetWordBreakProcEx' e:\wtl80\include\atlctrls.h 7490
Error 60 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7490
Error 61 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7491
Error 63 error C2146: syntax error : missing ';' before identifier 'SetWordBreakProcEx' e:\wtl80\include\atlctrls.h 7496
Error 64 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7496
Error 65 error C2061: syntax error : identifier 'EDITWORDBREAKPROCEX' e:\wtl80\include\atlctrls.h 7496
Error 66 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7497
Error 68 error C2061: syntax error : identifier 'TEXTRANGEA' e:\wtl80\include\atlctrls.h 7502
Error 69 error C2061: syntax error : identifier 'FINDTEXTA' e:\wtl80\include\atlctrls.h 7821
Error 70 error C2061: syntax error : identifier 'FINDTEXTEXA' e:\wtl80\include\atlctrls.h 7831
Error 71 error C2535: 'LONG WTL::CRichEditCtrlT<TBase>::FindText(DWORD) const' : member function already defined or declared e:\wtl80\include\atlctrls.h 7832
Error 72 error C2061: syntax error : identifier 'FORMATRANGE' e:\wtl80\include\atlctrls.h 7841
Error 73 error C2061: syntax error : identifier 'FORMATRANGE' e:\wtl80\include\atlctrls.h 7847
Error 74 error C2535: 'LONG WTL::CRichEditCtrlT<TBase>::FormatRange(void)' : member function already defined or declared e:\wtl80\include\atlctrls.h 7848
Error 75 error C2061: syntax error : identifier 'EDITSTREAM' e:\wtl80\include\atlctrls.h 7872
Error 76 error C2061: syntax error : identifier 'EDITSTREAM' e:\wtl80\include\atlctrls.h 7878
Error 77 error C2143: syntax error : missing ';' before '*' e:\wtl80\include\atlctrls.h 7941
Error 78 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7941
Error 79 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atlctrls.h 7942
Error 81 error C2061: syntax error : identifier 'IRichEditOleCallback' e:\wtl80\include\atlctrls.h 7949
Error 82 error C2059: syntax error : '<cv-qualifer>' e:\wtl80\include\atldlgs.h 1318
Error 83 error C2334: unexpected token(s) preceding ':'; skipping apparent function body e:\wtl80\include\atldlgs.h 1318
Error 84 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atldlgs.h 1332
Error 85 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atldlgs.h 1384
Error 86 error C2143: syntax error : missing ',' before '&' e:\wtl80\include\atldlgs.h 1384
Error 87 error C2059: syntax error : '<cv-qualifer>' e:\wtl80\include\atldlgs.h 1318
Error 88 error C2334: unexpected token(s) preceding ':'; skipping apparent function body e:\wtl80\include\atldlgs.h 1318
Error 89 error C2061: syntax error : identifier 'CHARFORMATA' e:\wtl80\include\atldlgs.h 1332
Error 90 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int e:\wtl80\include\atldlgs.h 1384
Error 91 error C2143: syntax error : missing ',' before '&' e:\wtl80\include\atldlgs.h 1384
Error 92 error C2059: syntax error : '<cv-qualifer>' e:\wtl80\include\atldlgs.h 1461
Error 93 error C2334: unexpected token(s) preceding ':'; skipping apparent function body e:\wtl80\include\atldlgs.h 1461
Thank you.
|
|
|
|
|
I doubt, if its due to incorrect include sequnce.
Try including Richedit.h before any wtl header.
|
|
|
|
|
Tried it, does not work.
Thanks.
|
|
|
|
|
Hi,
Most of your problem seems to come from the confusing WTL CString support.
Try this:
// stdafx.h
// your global #define ...
#include <atlbase.h>
#include <atlstr.h>
#define _WTL_NO_CSTRING
#include <atlapp.h>
extern CAppModule _Module;
#include <atlwin.h>
// your other 'namespace ATL{' #include ...
// your 'namespace WTL{' #include ...
// your other aplication #include ...
cheers,
AR
|
|
|
|
|
I need to use std::map with std::basic_string<TCHAR> as key and long as value.
std::map<std::basic_string<TCHAR> , long> myMap;
How to achieve/implement case in-sensitive string lookup ?
My Environment is -> VC++6, MFC, Win98/2000/NT/2003/XP
I truly appreciate any help/hint.
Thanks
Anand_Arv
-- modified at 6:48 Friday 9th February, 2007
|
|
|
|
|
Anand_Arv wrote: I need to use std::map with std::basic_string(TCHAR) as key and long as value.
std::basic_string<tchar>
How to achieve/implement case in-sensitive string lookup ?
You need to add a Compare argument:
map <basic_string<TCHAR>, long, ltstr> mymap;
Where lstr could be defined as:
struct ltstr
{
bool operator()(const basic_string<TCHAR>& s1, const basic_string<TCHAR>& s2) const
{
return stricmp (s1.c_str(), s2.c_str()) < 0;
}
};
See also: http://www.sgi.com/tech/stl/Map.html[^]
|
|
|
|
|
Thanks a lot for helping.
If I use that compare argument as you suggested,
Will I get the same result for all of the following ?
// assume that "ABC" (string key) and 101 (long value) is added to mymap
mymap.find("Abc")
mymap.find("ABC")
mymap.find("abc")
mymap.find("aBC")
Anand_Arv
|
|
|
|
|
|
|
hi,
i want to know how to read and write from text from an Edit-box in an dialog box.
shashank
|
|
|
|
|
hi,
i want to know how to read and write from text from an Edit-box in an dialog box.
|
|
|
|
|
wrote: hi,
i want to know how to read and write from text from an Edit-box in an dialog box.
dude you will in trouble for posting same message in different forum..
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|