|
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'
|
|
|
|
|
uh... pt_tovector IS &A_vector[0]... and the code works if instead of using a vector container I use an array. The error message is:
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::vector<double,class std::allocator<double=""> >' (or there is no acceptable conversion)
which means that I can't assign &A_vector[0] to pt_tovector if A_vector is a container...
...or I'm more confused than I thought
Thanks!!!
|
|
|
|
|
knapak wrote:
uh... pt_tovector IS &A_vector[0]
No, the code you posted has pt_tovector = A_vector; . For ordinary arrays that would be same as pt_tovector = &A_vector[0]; but not for vectors.
|
|
|
|
|
OHHHHHHHH .... So.... how do I solve the problem? The first comments suggest to return the vector itself instead of a pointer to its first element... EXCUSE MY NAIVETE, but I always thought that returning a pointer to the first element of an array was THE way to return an array... Of course now we are talking about Vectors...
Thank you!
|
|
|
|
|
OK... so I figured that if I make an iterator be A_vector.begin() and then pass the iterator to a pointer... should do the trick... right? WRONG!
That works within the scope of the function that contains the vector, but apparently the container dissapears as the program exits the function call (just as the first folk said). That obviously is different to what happens when using regular arrays... and still have not found the way to do what I need...
Many thanks to all of you.
|
|
|
|
|
As I said in my first reply, return the vector object - otherwise the storage associated with the vector is deallocated when the function exits.
If you did a similar thing with arrays, like below, you'd have the same problem.
double *CreateArray(double such)
{
double pt_tovector[2];
pt_tovector[0] = such;
pt_tovector[1] = such;
return pt_tovector;
}
Of course, if you allocated the array on the heap like the example below, you *CAN* return the array pointer. The thing is, the vector encapsulates and manages a pointer to heap storage - if you think of the vector as a pointer to an array in heap storage with other useful properties (like knowing how big the array is - a pointer won't tell you that), that may help.
double *CreateArray(double such)
{
double* pt_tovector = new double[2];
pt_tovector[0] = such;
pt_tovector[1] = such;
return pt_tovector;
}
BTW - iterators in VC7.1 are not pointers. They were in VC6, but there is no guarantee that iterators are pointers.
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Hello everyone
First and foremost, THANKS TO ALL OF YOU WHO PROVIDED AN ANSWER/OPINION. I'm learning a lot.
Now, as an academic curiosity, I think that if I make a vector container available outside the function (by making it global), then it should be equivalent to using:
double* pt_tovector = new double[2];
without deallocating the memory at the end of the function. Memory will remain caught until the program exits which is something I need to avoid since my code is big. In which case, since for this particular example I only need to retrieve two values, I rather make the whole function void with the two values of interest private and then include a couple of tiny accessor functions, one for each value... is this solution too ugly a programming style???
Many thanks again!!!
|
|
|
|
|
Yes, you should return a pointer to the first element of the vector, but your code doesn't do that! You must actually write pt_tovector = &A_vector[0] in your program to return a pointer to the first element of the STL vector A_vector . Additionally, the vector can't be local to the function.
|
|
|
|
|
|
Can someone show me how to send (save/Write) and receive (load/Read) data contained in a map and/or vector. class CData{ public: string one, two, three; CData() {}; ~CData() {} };
the map is declared as: map<string CData> DATA; How do I read/write it's data to a file ("MyMapFile.dat") ???
vector<CData> vecDATA; how do I read/write it's data to a file("MyVecDATA.dat") ???
I'm new to the STL and would need explicit examples that are known to work properly PLEASE.
C++ is my favorite programming language
|
|
|
|
|
You cannot automatically serialize STL objects to files. You must write your own file format. If you use only MFC then you can use CArray and CMap as containers and serialize with CArchive.
Regards,
Alexandru Savescu
|
|
|
|
|
|
Is it possible to get the title that is enclosed in the html as <title>My webpage</title>?
I have found that IWebBrowser2 have the GetProperty method, what are the properties of the page that we can get?
|
|
|
|
|
IWebBrowser2->GetDocument() will return the the docuement interface of the Loaded page.
wait a min i demonstrate that by code
<br />
IHTMLElementCollection *pColl=NULL;<br />
IHTMLElement *pEle=NULL;<br />
<br />
m_HtmDom->get_all(&pColl);<br />
MessageBox("yeah");<br />
<br />
CComVariant varTitle("title");<br />
CComVariant varIndex(0);<br />
IDispatch *pDisp;<br />
<br />
pColl->item(varTitle,varIndex,&pDisp);<br />
MessageBox("yeah1");<br />
<br />
if(pDisp)<br />
pDisp->QueryInterface(IID_IHTMLElement,(LPVOID*)&pEle);<br />
<br />
MessageBox("yeah3");<br />
if(pEle)<br />
{<br />
BSTR p;<br />
pEle->get_innerText(&p);<br />
MessageBoxW(NULL,p,L"",NULL);<br />
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|