|
[EDIT] Gah! Never mind... I had a little brain cramp; it is working correcly now. Thanks again for helping me find the problem! [/EDIT] Yes... "I have tried various means of qualifying the function call, including using the expanded form of one version of the IDispEventImpl-derived class, but I cannot get any of them to work."
At least I thought I did... Now it works? I must have been copying over the template dec incorrectly...!
Well, now that code works, but other stuff is failing to compile:
...\atl\include\atlcom.h(3698) : error C2243: 'static_cast' : conversion from
'class ATL::IDispEventSimpleImpl<1,class CxxxxMWare,&struct _GUID const DIID_EAxxxxxxxx> *const ' to
'class CxxxxMWare *' exists, but is inaccessible Oh, well... I will just put the second event handler into its own little class and use it. Thanks for the post, anyway.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Whoops - should have read your message properly
However - that error message looks like you're calling DispEventAdvise from a const method.
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Nah; I changed the template decl to a typedef for clarity/readability but forgot to specify it as public when I used it in the class decl.
Besides, without your post I would never have gone bac and tried again.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I have successfully created an addin for Word using the article provided by Amit Dey on Outlook 2000. There is one problem that i am facing.
How do I make my addin work with multiple instances of Word?? Currently the addin only works with one instance of Word.
Any help would be greatly appreciated.
|
|
|
|
|
hi!
I want to increase or decrease the width of my activex control written in
VC7.1 using ATL. I have done following in the InitNew method but no effect.
SIZEL sz = {129,211};
AtlPixelToHiMetric(&sz,&m_sizeExtent);
m_sizeNatural = m_sizeExtent;
Any ideas?
what if i dont want user to increase the height and width of my control?
Thanks in advance.
Ahmad Jalil Qarshi
|
|
|
|
|
I think that may be i have posted this question to a wrong forum. If someone knows the right place to post this question. Please help me.
Thanks.
Ahmad Jalil Qarshi
|
|
|
|
|
Hi,
does someone have a stdafx.h file for an MFC project with WTL support? I have followed the information in the articles here and elsewhere in the web I can find, but am having problems including atlctrlx.h, atlctrlw.h - there seems to be some confusion on the part of the compile with common names such as CClientDC, CWindowDC, even though I am using #define _WTL_NO_AUTOMATIC_NAMESPACE
as suggested.
|
|
|
|
|
|
Thanks Mike. I understand this.
I will make changes in the WTL source files for my projects correct?
|
|
|
|
|
|
to conditional Compilation in the .idl file, if yes how ?, I am facing tough time doing this!
Thanks
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
You can use any C++ preprocessor directives.
With best wishes,
Vita
|
|
|
|
|
Vi2 wrote:
You can use any C++ preprocessor directives.
Hi Mr. Vita,
Thanks For Reply, actually condtional compilation cannot be possible without preprocessor, actually i fail to explain my problem. when ever I use preprocessor to hide a Interface and corresponding .h and .cpp file , it's still compile that .cpp files and give me compiler errror. though i resolve that error by removing corresonding file from the project.
Is there any way to stop compilation of particular cpp file through Visual Studio 6.0!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
ThatsAlok wrote:
Is there any way to stop compilation of particular cpp file through Visual Studio 6.0!
You can use the different Active Configuration (Build -> Configurations...) to make the different targets. As well as we use the Debug and Release configurations.
With best wishes,
Vita
|
|
|
|
|
Hi
I have a graph control built using ATL3.0 and used this control in VC++ client application.This control is working fine in my windows XP sys,but siezed to work properly on win 98.The problems are
1) we are displaying 5 grid lines along both X and Y axes.but on win 98 only 2 grids are being displayed along Y axis.
2) when I try to load a saved file(graph) on win 98 the graph is exceeding the plot area.
Every thing seems to be working fine on win XP.Has there any thing to do with ATL.dll. Infact we have used the correct ANSI version of ATL.dll for both 98 and XP..
Can any one plzzzzzzz help me??????
ThnX in Advance.
Naveen.V
|
|
|
|
|
I am complete newbie in this field. I need to install DLL in MTS via VC++ 6.0 program. Any help is appreciable.
Thanks in advance.
|
|
|
|
|
Any idea how to embed an exectuable inside another executable, and then from with in your program, call the embeded exectuable with out creating another process or wrting the embed exectuable to disk?
I have a C++ program (straight C++, not managed). It has some logic and then depending on a number of conditions, ShellExecute()s another exectble file (client.exe), which happens to be a .net file. Is there anyway that I can add this client.exe file as a resource of my C++ program, and then call the beginning of the code from within the C++ program, so I wouldn't have to extract the resource or create a new process
Please help
Thanks,
Jason A. Donenfeld
PS: This is what I have now:
<br />
#define WIN32_LEAN_AND_MEAN<br />
#include<br />
#include<br />
#include<br />
<br />
#define INSTANCEMESSAGE "ShowZIM"<br />
#define WINDOW_TITLE "ZX2C4InstantMessenger"<br />
#define MUTEX_STRING "Local\\ZX2C4IM"<br />
#define FILE "client.exe"<br />
<br />
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)<br />
{<br />
if(_tcscmp(lpCmdLine,"clone"))<br />
{<br />
CreateMutex(NULL,TRUE,MUTEX_STRING);<br />
if(GetLastError()==ERROR_ALREADY_EXISTS)<br />
{<br />
SendMessage(FindWindow(NULL, WINDOW_TITLE), RegisterWindowMessage(INSTANCEMESSAGE), NULL, NULL);<br />
return 0;<br />
}<br />
}<br />
ShellExecute(NULL,NULL,FILE,lpCmdLine,NULL,SW_SHOW);<br />
return 0;<br />
}<br />
|
|
|
|
|
I programmed my Function like one in the book from Duffie: Financial Instrument Pricing using c++
. The Problem is That the output is a row vektor.
Does anyone have an Idea How to make the Output a Column Range and not a row Vektor under Excel ?
Here s the code:
STDMETHODIMP CMyExcelFunctions::MyArrayFunction(VARIANT* range1, VARIANT* range2, VARIANT* result)
{
// Convert input to vector
Vector<double> v1=COMUtils::ExcelRangeToVector(range1);
Vector<double> v2=COMUtils::ExcelRangeToVector(range2);
// Determine the minimum size of both input arrays
size_t size;
if (v1.Size()<v2.size()) size="v1.Size();
size=v2.Size();
//" add="" both="" arrays="" (v1+v2="" does="" not="" take="" different="" vector="" sizes="" in="" account)
vector<double=""> vr(size);
for (int i=vr.MinIndex(); i<=vr.MaxIndex(); i++)
{
vr=v1+v2;
}
// Put result in safe array
CComSafeArray<double> res;
res.Create(size);
LONG j;
for (i=vr.MinIndex(), j=0; i<=vr.MaxIndex(); i++, j++)
{
res.SetAt(j, vr);
}
// Put safe array in variant
CComVariant v(res);
// Put resulting variant in result
v.Detach(result);
return S_OK;
}
Vector<double> COMUtils::ExcelRangeToVector(VARIANT* range)
{
// Check if a range object was passed
if (range->vt!=VT_DISPATCH)
{
// No range passed so just return the double value in a vector
Vector<double> v(1);
v[v.MinIndex()]=range->dblVal;
return v;
}
// Retrieve the Excel range object from the variant and convert it to a Vector<double>
Excel::RangePtr pRange=range->pdispVal;
return COMUtils::ExcelRangeToVector(pRange);
}
// Convert an Excel range to our vector template class
Vector<double> COMUtils::ExcelRangeToVector(Excel::RangePtr pRange)
{
// Get the number of rows and columns in the range
int columns=pRange->Columns->Count;
int rows=pRange->Rows->Count;
// Create the vector with the correct size
Vector<double> v(columns*rows);
// Iterate the rows and columns
int index=v.MinIndex();
for (int r=1; r<=rows; r++)
{
for (int c=1; c<=columns; c++)
{
// Add each element in the range to our vector
v[index++]=(((Excel::RangePtr)pRange->Item[r][c])->Value).dblVal;
}
}
// Return the vector
return v;
}
Thanks
|
|
|
|
|
Hi,
I was wondering if anyone had implemented a WTL application as a static library. I've tried this with a simple dialogue and can't get it working.
In the function AtlModuleAddCreateWndData, the line
::EnterCriticalSection(&pM->m_csWindowCreate);
produces an assertion (where pM is of the type _ATL_MODULE*).
It appears that the module has not been created and so I was wondering how I would go about doing this.
Thanks in advance.
Marcpolo
|
|
|
|
|
in my SDI app a call to UpdateAllViews from a user thread fails .
I was wondering if this is disallowed .
UpdateAllViews call from within the main thread works fine .
Is there a workaround for this ?
|
|
|
|
|
In general, passing MFC objects between threads will not work because MFC keeps thread-specific data structures. Use a custom window message instead - the worker thread can post this message to the main thread, which would then call UpdateAllViews() .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
errata
says
Recover = TTV.CreateVector(Lat, Lon);
should say
double something;
Recover = TTV.CreateVector(something);
|
|
|
|
|
|
Hi guys
Before my question I remind you I'm an amateur... so be kind in your response
Why is it that the following code works fine if I use a regular array and not a vector container... How do I make the function return a pointer to the beginning of the vector and use it on the call from another function...???
Thanks a lot for all your help, you guys are great!
double *TakeThisVector::CreateVector(double such)
{
vector<double> A_vector;
double *pt_tovector = 0;
int max=2;
for(int i=0; i<= max; i++)
{
A_vector.push_back(such);
such++;
}
pt_tovector = A_vector;
return pt_tovector;
}
void GimmeTheVector::ShowVector()
{
TakeThisVector TTV;
double A0, A1;
double *Recover = 0;
Recover = TTV.CreateVector(Lat, Lon);
A0 = *Recover++;
A1 = *Recover;
}
|
|
|
|
|
You would return &A_vector[0]...except that A_vector doesn't exist after CreateVector exits.
You probably want to return the vector rather than a pointer to its first element.
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|