|
Ok, i didn't realise about that !!!
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
|
#include <vector>
using namespace std
{
vector<int> vec;
vec.push_back(1);
vec.push_back(2);
vec.push_back(3);
vec.push_back(4);
for(int i=1;i<vec.size;i++)
cout << vec[i];
}
Thanx
V
|
|
|
|
|
sh*t, this is silly . sorry guys...
Thanks a lot
V
|
|
|
|
|
Stupid STL trick:
std::copy(vec.begin(), vec.end(), std::ostream_iterator<int,char>(std::cout," "));
|
|
|
|
|
|
I first came across that in Josuttis's book.
Kevin
|
|
|
|
|
i got errors.. with
std::copy(vec.begin(), vec.end(), std::ostream_iterator(std::cout," "));
i also tried declaring
vector<int>::iterator ostream_iterator;
but still,
D:\v\CLEAR\Console\Main.cpp(45) : error C2039: 'ostream_iterator' : is not a member of 'std'
D:\v\CLEAR\Console\Main.cpp(45) : error C2039: 'cout' : is not a member of 'std'
D:\v\CLEAR\Console\Main.cpp(45) : error C2064: term does not evaluate to a function
Plz complete the trick
Thanx
V
|
|
|
|
|
i got errors.. with
std::copy(vec.begin(), vec.end(), std::ostream_iterator(std::cout," "));
i also tried declaring
vector<int>::iterator ostream_iterator;
but still,
D:\v\CLEAR\Console\Main.cpp(45) : error C2039: 'ostream_iterator' : is not a member of 'std'
D:\v\CLEAR\Console\Main.cpp(45) : error C2039: 'cout' : is not a member of 'std'
D:\v\CLEAR\Console\Main.cpp(45) : error C2064: term does not evaluate to a function
Plz complete the trick
Regards,
V
|
|
|
|
|
//try this
#include <vector>
#include <iostream>
using namespace std;
main ()
{
vector<int> vec;
vec.push_back(1);
vec.push_back(2);
vec.push_back(3);
vec.push_back(4);
//U should do i=0, or like this u loose the "1"
for(int i=1;i<vec.size();i++)
cout << vec[i];
}
//regerds, gecool
|
|
|
|
|
Hi,
After using ShellExecuteEx and getting HANDLE hProcess of the SHELLEXECUTEINFO Structure, I need to get the CWnd pointer of the program window I opened. I want to use it in SetWindowPos to move and set its size. How can I get CWnd *?
Thanks,
caykahve
|
|
|
|
|
You don't actually need a CWnd* . CWnd will just wrap the handle and convert the calls you make to CWnd methods in calls to the corresponding API function using the handle stored in its m_hWnd member. For example, here is the implementation for CWnd::MoveWindow()
void CWnd::MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint)
{
ASSERT(::IsWindow(m_hWnd));
::MoveWindow(m_hWnd, x, y, nWidth, nHeight, bRepaint);
}
So, you can always make the call to the API function yourself.
That being said, you can obtain a CWnd* for a given handle, using CWnd::FromHandle() but take note that in your case it will be a pointer to a temporary object, so you can't store it for later use.
Again, if all you want to do is to use some CWnd methods, you can use the corresponding API function directly on the window handle. For CWnd::SetWindowPos , the corresponding API is just ::SetWindowPos . Look in the documentation to see what parameters it expects.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Holy handles, Batman!
After reading Alok's response I now realize that you were talking about a process handle and I took it as a window handle. It's embarrasing considering how clear it is in the thread title itself
No cookies but more coffe for me.
Sorry,
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Jose Lamas Rios wrote:
No cookies but more coffe for me.
Sir, Then please pass that Cookie to me, I am Hungry at this moment .
"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
|
|
|
|
|
caykahve wrote:
, I need to get the CWnd pointer of the program window I opened.
There is no direct Method for getting Window Handle from the process ID, but this link may help:-
Is it possible to get info between HWND and Process handle?[^]
"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
|
|
|
|
|
.. this is another way to say Hi!! to u . but this is the only way now ..he he
V
|
|
|
|
|
Hi,
I want to create a custom control (which looks like a AND or OR gate) and place it ina docable window. These controls can be dragged and dropped in the client area, and used (Like MFC controls).I know how to create a docable window. I would like to know how to crearte a custom ActiveX control and add dragging and dropping feature in it. If anybody help, I wil be highly oblized.
Thanks
Lalit...
|
|
|
|
|
Dear All,
I bought a D-Link DFM-562E External Modem to develop IVR applications; unfortunately, I can not get the Device ID for wave in to play a wave file on it.
The TAPI function "LineGetId()" always fails with "LINEERR_NODEVICE" returned error.
Please give me a solution to this problem.
Note: the modem driver came with the modem is not a Microsoft digitally signature.
Thanks
|
|
|
|
|
( I'm having a bad week ..., so this might simply be a rant instead of a question )
I know that I cannot be certain that a value stored in a double will ever be internally represented like it is on paper, or as I type it in a text box and convert the string to a double.
for example for the value 2.5
I can either have ( not sure about the "real" decimal precision, so YMMV )
d = 2.50000000001;
or
d = 2.49999999999;
wich is acceptable if the desired precision is small.
now, the question is, and it's what is bugging me.
Is there a way to ensure better precision, or to round up to a precisison ?
also, can there be an issue when using the same DLL with debug or release version ? I have two different results with the same input when I build in debug or in release; I don't have access to the dll source code.
Thanks.
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I don't think there is a way to ensure precision on the way the value is stored, unless the desired precision is small enough to convert it to an integer (so you would store 2.5 as 250 and know that you have to divide by 100 to get the actaul value), but you can implement the desired precision in your code checking, assuming the variance in the way the value is stored is less than the desired precision.
For example, if you are testing monetary values and you only need to be precise to 0.01 then equality is checked by something like fabs(a-b)<0.01 which is roughly equivalent to a==b. When checking for limits and you would ideally want, for example a<=100, just use a<100.01, etc.
|
|
|
|
|
Hi,
if you want to round up to a precision, try this one:
// Rounds a double to the nearest multiple of the passed seed.
double round(double Num, double Seed)
{
// get rational factor
double fac = Num / Seed;
// get natural factor
fac = (fac < 0) ? (static_cast<int>(fac - 0.5)) : (static_cast<int>(fac + 0.5));
// return multiple
return fac * Seed;
}
|
|
|
|
|
reason:
the FPU internally uses a higher precision. The "last digits" depend on how long the optimizer keeps a value in the FPU before writing it back to memory.
Builds are not even guaranteed to be "stable", i.e. the code generated may differ from build to build.
Always use an eps comparison ( fabs(a-b) < eps, where eps must be sufficiently small compared to the OOM of a and b)
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
I'm trying to debug a problem where multiple applications (exe's) are loading a common dll. I have some debug output in the InitInstance() and ExitInstance() of the dll's CWinApp class. I'd really like to know which app is loading/unloading for each line of debug output (I'm writing lines to a file) but have not found a way to do this. The m_pszExeName and m_pszAppName variables are always the name of the dll - so that's no help. The m_lpCmdLine is always blank so that's no help either.
Is there a way to do this?
|
|
|
|
|
I don't know if that is feasible, it depends on the complexity of your project, but you could add the executable's name as an extra variable to some key calls to the dll and have the executables just provide their name to the dll for logging/debugging purposes.
|
|
|
|
|
This is not possible to found from the dll itself.
Dll's are loaded (mapped in process address space) by the loader,
so there could be a place to found which process load the dll.
But I can't provide more help for you, my knowledge is limited
to what I said.
|
|
|
|