|
ashishbhatt wrote: Application failed to start becoz VNCHooks.dll was not found.Reinstalling the application may fix this problem.
I guess this is your own DLL, so in that case select project settings for your first project, which needs the dll
Goto: Configuration->Debugging->WorkingDirectory
Set the value to the directory where this dll is located. Well if this is not your dll then install this dll in the default search path for your application which is the "PATH" variable.
In release this dll should in the same directory or somewhere as described above.
Nibu thomas
MVP For VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|
|
Thanks Nibu,
I got solution. Now I can run my application without any error.
Now I want some information from you. As you I have included new project as to set the hooks in my window.So, How can i do that??
Should i have to make new window for that and with that handle i have to set the Hooks??
Plz guide me i am new in Hooks.
Thank you thank u very much.
Ashish
|
|
|
|
|
ashishbhatt wrote: I have tried to add it into the solution then I compiple it and it does not give errors.But when I use the method of that new added project it gives error like this(function name) identifier not found.
Are the code fragments you included in a namespace?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
I have included one project which is DLL project.In that its .h file and .cpp file.
In .h file function is declared which is defined in .cpp. And that function i am using in my MFC application.And also i have included added project's header file in my MFC app.
Thanks.
Plz reply if u have solution.
|
|
|
|
|
I have a very simple owner drawn CListBox. I just wrote some code in the DrawItem function for some basic drawing.
By clicking a button in a dialog box, this owner drawn list box will be created and will display.
It works fine when I set the dialog window as its parent window. It shows perfectly within dialog box. When I change the parent window to the desktop, it does not display. sometime I saw the window frame appears in the upper left desktop corner very briefly and dissappear and also I saw a new icon apprear in my task (as a sign of new window created.)
<br />
void COwnerdrawDlg::OnButton2() <br />
{<br />
testlistbox = new CListPopUp;<br />
CRect rect(0,0,0,0);<br />
testlistbox = new CListPopUp;<br />
<br />
testlistbox->Create(LBS_OWNERDRAWFIXED |WS_CHILD | WS_VISIBLE |WS_CLIPCHILDREN |WS_OVERLAPPED | WS_BORDER ,rect,GetDesktopWindow(),1);<br />
<br />
testlistbox->AddString("This is test item 1");<br />
testlistbox->AddString("This is test item 2");<br />
testlistbox->AddString("This is test item 3");<br />
testlistbox->AddString("This is test item 4");<br />
<br />
testlistbox->MoveWindow(10,10,200,200);<br />
<br />
<br />
}<br />
Is there anything problem with style setting. I tried with different combination but no luck.
Can anybody find any problem here?
Thank you
msc
|
|
|
|
|
I wanna lay some Edit Controls in a View which can be scrolled by a Vertical Scroll Bar to handle inputted data.Who can do that please help me!
I wanna enter Microsoft Corporation for my fortune
|
|
|
|
|
Hey,
When ever you create your edit box create using ES_MULTILINE as the edit box's one of the style.
for eg.
CEdit* pEdit = new CEdit;
pEdit->Create(ES_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,CRect(10, 10, 100, 100), this, 1);
this will make a edit box vertical scroll enable
Regards,
Pankaj Sachdeva
There is no future lies in any job but future lies in the person who holds the job
|
|
|
|
|
Hi everyone,
This is my code below, the first time I run through this code it's fine but when it hits the for loop a second time my Iter = -768 (or something like that) and it gives me an assertion error. The first time it runs through this loop it always uses the else statement (if that's a clue) not the if.
for (Iter = PrimeNumber.begin(); Iter != PrimeNumber.end(); Iter++)
{
size++;
if (size < PrimeNumber.size() -1)
*(Iter + 1) += 1;
else
PrimeNumber.push_back(1);
}
Does anyone have any ideas? Thanks for the attention and help in advance, I appreciate it.
Cheers,
Michael
|
|
|
|
|
Michael101 wrote: size++;
Is this initialised to zero somewhere? This line should be at the end of the loop. The first time through size is probably one and Im guessing PrimeNumber.size() is one?. Therefore the condition is
if(1 < 0)
which would both be false.
What exatcly do you want this code to do?
|
|
|
|
|
My code is calculating numbers together in the vector and based on certain conditions it must build another element in the vector to keep the equation going. If not, eventually the number will be too big for longs, int, short e.t.c....
When it creates a new element it always returns to that for loop code and it the iterator is always equal to -274 which is just wrong. It should be one more to what it left off as.
The code is posted below, it's a complex equation but it might help.
for (Iter = PrimeNumber.begin(); Iter != PrimeNumber.end(); Iter++)
{
//*Iter = PrimeNumber[y];
*(Iter) += *Iter;
if (*Iter > 9)
{
PrimeNumber[0] -= 10;
for (Iter1 = PrimeNumber.begin(); Iter1 != PrimeNumber.end(); Iter1++)
{
Counter++;
if (Counter = PrimeNumber.size() - 1)
*(Iter + 1) += (*(Iter + 1)) + 1;
else
PrimeNumber.push_back(1);
if (PrimeNumber[Counter] > 9)
{
if (Counter < PrimeNumber.size())
{
PrimeNumber[Counter] -= 10;
PrimeNumber[Counter + 1] += 1;
}
else
PrimeNumber.push_back(1);
}
break;
}
Counter = 0;
}
Ultimately, this code increaments numbers into the vector and if the number is 16 in the vector is displays as [6][1] (Computers write backwards of course). It's when it makes the new element for the 1 it goes nuts on the Iterator.
Thanks for your interest, I appreciate the help!
Michael
|
|
|
|
|
What you're actually trying to achieve is beyond me but
Michael101 wrote: Counter++;
Where is this initialised? It appears to me it should be set to 0 before the second for loop and incremented at the end of the second for loop not at the start.
When you say the iter is equal to -274 is that the actual value of iter or (*iter)? Ie is it the value of the iterator or the value of the underlying variable at that position?
When writing loops with stl containers I often take a reference to the value behind the iter and use that in the loop as it makes the code clearer.
Here is an example assuming your vector contains ints
for (Iter = PrimeNumber.begin(); Iter != PrimeNumber.end(); Iter++)
{
int& currentValue = (*iter); // now use currentValue rather than (*iter)
}
|
|
|
|
|
Iter is initialised at the beginning of the program like this ->
register vector<short>::iterator Iter;
The -274 is the actual value of the Iterator but now that I've debugged it further I don't think that matters because on other occasions it's equal to something silly before the loop runs through again but the program doesn't fall over.
Have you ever had problems with Iterators after adding in a container to your vector? I will try your sample code above because I understand it clearly and does seem to be much safer.
Since this algorithm runs for long periods of time speed is important but for now I'll ignore that.
Cheers for the reply, thanks for the help,
Michael
|
|
|
|
|
Ahh I found the problem... The Iterator equals the actual element in the Vector not the element number! Well I think that's the error
|
|
|
|
|
Michael101 wrote: Iter is initialised at the beginning of the program like this ->
register vector::iterator Iter;
Why are you using register? I would definatly get rid of that at least for the time being.
I was asking about the initialisation of Counter. Where is it initialised?
Michael101 wrote: Have you ever had problems with Iterators after adding in a container to your vector?
I'm pretty sure adding a value to the end of your vector shuold not invalidate your iterators but you might want to see if you can verify that. Google should help. If you supect thats an issue add new values to a temp vector and then copy them to your real vector after you've finished iterating throught it.
The STL is birilliant but its not an easy beast to master. I sugest a couple of good books like Effective STL by Meyers
|
|
|
|
|
Effective STL by Meyers, yeah ok I'll buy it! Thanks for all your help, I have to leave this error for later but I'm sure I'll crack it soon. It's just finiky that's all.
Thanks for all your help, I appreciate it!
Michael
|
|
|
|
|
I have read your talk with Josh Gray, and I have only a few points to add.
a) Adding to a vector *will* invalidate all iterator in it. Not every time, but sometimes, and you cant control it. A vector is guaranteed to be in a continuous part of memory, and when it gets bigger, it is reallocated.
All Iterators are invalidated.
There are things you might try (reserve() ), but it will not work most of the time.
b) The register you put before the iterator-declaration is silly. An iterator is a class and will certainly not fit into a register.
c) in the for -loop, increment the iterator using the postfix-increment-operator: ++Iter .
Also,try to dereference the iterator as few as possible. You are getting a large overhead.
Your program will be much faster in release, and stop being unusable slow in debug mode (All with VS.NET 2005).
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Michael101 wrote: ...it gives me an assertion error.
What line of what file is asserting?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
could any one please tell me how to convert double to unsigned short
|
|
|
|
|
sure as you soon as you explain how you want to convert 8 bytes into 2
cout << "double: " << sizeof(double) << endl;
cout << "ushort: " << sizeof( unsigned short) << endl;
Resulting output
Console Research
double: 8
ushort: 2
|
|
|
|
|
Use the IBitSquisher interface!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How do you want the conversion to work? Do you want the result rounded? What should happen if the double is negative?
Steve
|
|
|
|
|
You can not convert. The only thing that you can do is to separate the four Bytes of the double into unsigned chars, and afterwards mount them another time.
This is what I have to do to get the "real" variables of a PLC. But its a shi...
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
|
This is what I have to do to get the real value of an analog input on a PLC.
The communication and reading function is BYTEwise, but reals in Step7 are 4 bytes. So I have to read indepentant bytes, separate some bits, and make the conversion to real using the formule of the IEEE.
BTW, thanks you a lot for the link. There is much better explained as in the help files of siemens
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hey Friends
Do we have a way to fill in values in the active window?
eg i have a html page & i want that an exe should fill values in edit boxes sort of
text then tab & then fill data ?
Regards
|
|
|
|