|
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
|
|
|
|
|
See SetWindowText/GetWindowText
|
|
|
|
|
Ok,
I'm trying to figure this whole WTL thing out and it's going rough. So far I've done ok on my own scavenging code and figuring it out, but I've hit a little snag.
On my main form I have a set of 3 radio buttons. Although I'm at a loss as to how the program reads these buttons.
In my YarrView.h header I have
-------------YarrView.h--------------------
class CYarrView : public CDialogImpl<CYarrView>,
public CWinDataExchange<CYarrView>
{
public:
enum { IDD = IDD_YARR_FORM };
BOOL PreTranslateMessage(MSG* pMsg);
BEGIN_MSG_MAP(CYarrView)
END_MSG_MAP()
BEGIN_DDX_MAP(CYarrView)
DDX_RADIO(IDC_BILGE, puzzle)
END_DDX_MAP()
BOOL OnInitDialog ( HWND hwndFocus, LPARAM lParam );
int OnApply();
// For radio selection
int puzzle;
};
--------------------------------------
Now my three buttons are IDC_OPT1 IDC_OPT2 and IDC_OPT3
Looking at other peoples code, this is what they have done. And my int puzzle will hold which radio button was chosen? Now how exactly does int hold it? 0 for the first button, 1 for the second, etc? Thats what I assume and it does by what order they're listed in my resource script but a confirmation would be nice.
From my understanding I have this part right so far. The dialog IDC_YARR_FORM contains the buttons so the DDX code goes in that header file correct?
Now in my YarrView.cpp code
---------------YarrView.cpp---------------
#include "stdafx.h"
#include "resource.h"
#include "YarrView.h"
BOOL CYarrView::OnInitDialog ( HWND hwndFocus, LPARAM lParam )
{
DoDataExchange();
return TRUE;
}
int CYarrView::OnApply()
{
return DoDataExchange(true) ? PSNRET_NOERROR : PSNRET_INVALID;
}
BOOL CYarrView::PreTranslateMessage(MSG* pMsg)
{
return CWindow::IsDialogMessage(pMsg);
}
-----------------------------------
This is all the stuff needed to make sure the buttons get read correct?
From my understanding in my MainFrm.h the line
CYarrView m_view;
declared an instance of CYarrView as m_view;
so m_view.puzzle = the button I chose... Unfortunatly, I'm not getting any result from this whatsoever.
Is my code wrong and I just don't know how to read the m_view.puzzle variable properly? (Doubtful)
Could it be something in my resources?
My eyes are hurting from trying to figure this out for so long, no pounding away at others code is giving me anything
Please anyone, some advice here.
Also once this is figured out, I plan on having a running process going but with the ability to just hit cancel and stop it... I thought I could just create child dialog and put the code in the OnIdle(){ //code here}; section but it turns out that it just doesnt get executed no matter how much I Idle .
So any direction on doing something like that would also be much appreciated.
Hopefully theres enough information here for someone to help me. If not just tell me what you need.
Now my eyes need some
|
|
|
|
|
A group of radio buttons is defined by three things:
1. The first button of the group has the WS_GROUP style
2. The first control after the last button of the group has the WS_GROUP style
3. The buttons in the group are placed consecutively in the tab order. The tab order is how you know one button is first, then the next one is second, and so on.
You can see the logic in DDX_Radio() in atlddx.h. If the first button in the group is checked, it returns 0 in the nValue parameter. If the second button is checked, it returns 1, and so on. Or if no button is checked, it returns -1.
|
|
|
|
|
I am writing a program that will create multiple shapes. Currently I am building each shape as an ALT project. Like, rectangle, circle, even image. Then the application will just call each activeX when it need the shape. My question is. Will is slow down the application? Since each ATL had to be register and get the CLSID and create an instance for each object. Will I be better off doing from with the application? The ATL object is windowless by the way.
Thanks.
|
|
|
|
|
One ActiveX project for each shape will definitelly create a mess.
I'd do it this way: create a single component - ShapeFactory - that will create a shape you need. Create all your shapes as noncreatable interfaces within that single ActiveX project. Much easier and managable.
Best regards,
Dmitry.
-------------------------
Don't worry, be happy )
|
|
|
|
|
I'm a beginner in COM, but i have a problem, When i writed a Aggregation component by ATL, and i want to know how can i use the :component in vb?
thanks for any help! ^--^
|
|
|
|
|
sir,
i am facing one problem in create ATL server application .my client application are using IIstrument interface . i want to make one ATL server application which export IInstrument inteface . i have instrumentIfc.tlb,instrumentIfc.h,instrumentIfc.idl files which have definition for IIstrument interface. can i use these files in my ATL server application . but i dont know how. so i can able to export IInstrument interface for client purpose. plz give me suggestion.
|
|
|
|