 |

|
Change from
Dasttann777 wrote: cin >> Input; to
getline(cin, Input);
Veni, vidi, vici.
|
|
|
|

|
Really sorry for the nagging, but the loop now no longer works.
#include <iostream>
#include <string>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
#include <tchar.h>
using namespace std;
int Australia();
int main()
{
cout << "Welcome to Virtual Chat, ask any question you want.\n";
int Keep = 1;
string Input;
while (Keep == 1)
{
getline(cin, Input);
if (Input.compare("What is your name?")==0 || Input.compare("what is your name?")==0 || Input.compare("What is your name")==0)
{
cout << "I am a computer, I do not have a Name";
break;
}
continue;
}
char f;
cin >> f;
return 0;
}
|
|
|
|

|
Do you mean the break statement is working (remove it if exiting the loop after the cout << "I am .."; is not the intended behaviour)?
Veni, vidi, vici.
|
|
|
|

|
I feel like such an idiot, thankyou for pointing that out.
|
|
|
|

|
You are just learning.
Veni, vidi, vici.
|
|
|
|

|
One more time – capAVI question for a real capAVI gurus. I have two, so far – I'll need more, MFC views with capPreview enabled. Using lResult = ::SendMessage (hWndC, WM_CAP_SET_PREVIEW,true,0L); if(!lResult) { TRACE("\nFailed "); } The views are working – displaying the camera capture – but only when only one of them is activated. When I try switching between two MFC windows only the one activated first actually displays the preview. I am using Wnd class to initialize the preview and have no failures doing that for both views. I do not quite get how the preview is actually putting the data into the capture window, been unable to debug / trace it thru. Any reasonable help will be as always appreciated. Thanks Vaclav
|
|
|
|

|
Here is an update. I have implemented callback on error and received this error when the second view is activated ...no frames detected... check and make sure vertical synch is enabled... So, why do I get this error on the second view only? I am not sure where to fix it , some sources say to lower the capture dimensions and or fix it in the video hardware. I''ll try different driver next.
|
|
|
|

|
The problem was / is that two implementations of the capDriverConnect happily connect, even when the driver is in use elsewhere. Each view must diconnect the driver first, however, things are little more complicated since the view is in the tab and tabs only move the tabs up / down, I guess in z axis, and the preview stops, but that is all.
|
|
|
|

|
Hello everybody,
is it possible to determine the orientation of the selection into a CEdit?
If I select a part of the text with the mouse from left to right, the cursor blinks at the end.
But if I select the text from right to left, the cursor blinks at the beginning of the selection.
A GetSel(...); returns always the start and end index in the left-to-right order.
Or is there a function to retrieve the blinking cursor in a selection?
Big thanks in advance
|
|
|
|

|
Don't know if there's an "official" way of doing that, but you could try experimenting with GetCaretPos[^] and CharFromPos[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|

|
Exactly what I'm looking for.
Big thanks
|
|
|
|

|
Yourwelcome.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|

|
Hi, I have a Window app from which I am doing communication to a DOS app via named pipes My method of doing this is to signal a event after I have queued the messages to the DOS app The method from which I am signaling the event is inoked via SendWindow and has and thus has a prototype LRESULT (WPARAM, LPARAM) The problem is as soon as I SIGNAL the event control is transfered When control is returned to the method which signaled the event it executes the next statement which causes an access violation listed below is the code in question <pre lang='cpp'> LRESULT CprogDebug::receive_tcpip(WPARAM mywparam,LPARAM mylparam) . . . . . myeventptr->send_window = this; myeventptr->SetEvent(); // queue message return TRUE; // <==== access violation </pre> Thanks in Advance
|
|
|
|

|
Any time I see this on return, I think stack corruption.
Charlie Gilley
You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|

|
Does that mean I should increase the stack size
|
|
|
|

|
Not necessarily, although that could be a reason.
Does it declare the access violation when you reach the return statement or when you step through the return?
Charlie Gilley
You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|

|
Try to strip down your function to an absolute minimum and see if it still happens.
|
|
|
|

|
in my experience it often indicates a calling convention mismatch, e.g. a stdcall/cdecl mixup.
|
|
|
|

|
Only if you need to, otherwise you'd just be masking the problem.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|

|
Okay I think Luc Patyn is right I use LPARAM myparam as char * the string points to string returned by TCP/IP from the server machine Thanks
|
|
|
|

|
thank you for all those who pointed me to the stack that is indeed were the problem was I had declared a CString as local/stack variable and and it was a long string I moved it outside of the function global and okay
two question come to mind 1) how would I increase the stack if I needed it 2) using the new operator on the CString would seem to also alivate the problem as that would allocate the string on the heap
thanks again
|
|
|
|

|
I have this program that I wrote in vb, and I want to rewrite it in c++. I would like to retain the click once deployment feature, but I don't know which ones support click once.
|
|
|
|

|
None that I know, but rewriting it in C++ will beat it in complexity by a mile.
If you are interested in one-click deployment solutions, opt for a rewrite in C# instead
P.S. There is, of course, such thing as Install-Shield, something I would not recommend anyone, after using it for couple years, and then moved to NSIS, no looking back.
|
|
|
|

|
Vitaly Tomilov wrote: but rewriting it in C++ will beat it in complexity by a mile.
I must concur with that.
I did some digging around, and there is talk that I can do a manual mage.exe to alter the project for click once.
Thanks
|
|
|
|

|
Does NSIS support 64bit systems? It doesn't seem like it in the project webpage...
|
|
|
|

|
That looks interesting. I never did like the click once deployment, but you can launch it from a web page.
Thanks Albert
|
|
|
|

|
Yes it does, I have been deploying 64-bit software with NSIS for the last 4 years. It is perfect for any kind of installation, worthwhile learning also.
I would suggest a special unicode branch of NSIS: http://www.scratchpaper.com/[^]
|
|
|
|

|
I'm using an outdated version of InstallShield which I absolutely hate... so I may have to try something else soon.
|
|
|
|

|
Hi everybody,
As you could read in my other question. I want to get rid of the CRL both external (/MT) or internal (/MD).
I am almost done and I eventually also want to remove the input of the msvcrt.lib. As soon as I do that I get an error on having _ftol2 etc not defined.
So I looked up my program in IDA and I noticed that they automatically generate _ftol2 and use it to convert from float to long.
Anybody knows how to get rid of these automatically generated functions.
Regards,
SystemFiles
|
|
|
|
|

|
yeah that will probably work. I will give it a shot.
EDIT: That worked flawless thanks!
modified 20 May '12 - 5:20.
|
|
|
|

|
Hi everybody,
I want to get rid of all the imports from the CLR. So I decided to make some functions on my own for example cos() sin() tan() asin() acos().
I already have cos and sin and tan done:
FLOAT Sin( FLOAT A )
{
_asm FLD A;
_asm FSIN;
}
FLOAT Cos( FLOAT A )
{
_asm FLD A;
_asm FCOS;
}
FLOAT Tan( FLOAT A )
{
_asm FLD A;
_asm FPTAN;
}
As you can see I am using inline floating point assembly. But then I thought I could probably use FACOS or FASIN, but those instructions don't exist.
Anybody know how I could constructe asin() and acos(), without using the CLR ofcourse.
Regards,
SystemFiles
|
|
|
|

|
when sine or cosine are known, so is the other (remember sin^2 + cos^2 = 1), hence also the tangent. Therefore use FPATAN.
|
|
|
|

|
takes a while before I understand what you mean hehe math actually isn't my best point of programming.
I will get to this later!
|
|
|
|

|
Sorry still dont exactly understand what your saying.
|
|
|
|

|
when you know cos, you know sin (except for its sign); and vice versa.
when you know cos and sin, you know tan. So use FPATAN.
|
|
|
|

|
Here's some old code that may help:
double Vk05Pi = 1.5707963267948966192313216916398;
#define MTH_ASM_IS0(LABEL_IS0) __asm \
{ \
__asm ftst \
__asm fnstsw ax \
__asm test ah, 40h \
__asm jne LABEL_IS0 \
}
#define MTH_ASM_IS1(LABEL_IS1) __asm \
{ \
__asm fld1 \
__asm fcomp \
__asm fnstsw ax \
__asm test ah, 40h \
__asm jne LABEL_IS1 \
}
double FkASinR( double A )
{
if( A > 1 ) return(0);
#ifndef MTH_ASM_USE
A *= A;
if( FkIs1(A, DBL_MIN) ) return(Vk05Pi);
return( atan( sqrt(A/(1-A)) ) );
#else
__asm {
fld A
fmul A
MTH_ASM_IS1(isone)
fld st(0)
fld1
fsubr fdiv fsqrt
fld1
fpatan
jmp end
isone:
fstp A
fld Vk05Pi
end:
fstp A
}
return(A);
#endif
}
double FkACosR( double A )
{
#ifndef MTH_ASM_USE
A *= A;
if( FkIs0(A, DBL_MIN) ) return(Vk05Pi);
return( atan( sqrt((1-A)/A) ) );
#else
__asm {
fld A
fmul A
MTH_ASM_IS0(iszero)
fld st(0)
fld1
fsubr fdivr fsqrt
fld1
fpatan
jmp end
iszero:
fstp A
fld Vk05Pi
end:
fstp A
}
return(A);
#endif
}
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|

|
Hello people,
I was wondering of any good driver development/tutorial websites, books and source code I could "scan," (including source code of your own) cause I'm completely new to this and heard that driver are extremely powerful (especially in kernel-mode) and can do some neat things (firewalls)
Simple Thanks and Regards,
Brandon T. H.
Been programming in Visual Basic for 4 years this point forward, and is very good at it (I can even create programs completely on code, without dragging those items from the toolbox). Programming C++ for 1 year so far and the same with C#.
Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison
|
|
|
|

|
Brandon T. H. wrote: I'm completely new to this and heard that driver are extremely powerful (especially in kernel-mode) and can do some neat things (firewalls)
I think that's an over simplification, but if you are serious then start here[^] and be prepared for a lot of hard work.
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|

|
thank you, very appreciated
Simple Thanks and Regards,
Brandon T. H.
Been programming in Visual Basic for 4 years this point forward, and is very good at it (I can even create programs completely on code, without dragging those items from the toolbox). Programming C++ for 1 year so far and the same with C#.
Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison
|
|
|
|

|
You may also find that any driver specific questions will have a better chance of being seen by the specialists in this forum[^].
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|

|
OSR[^] - These guys are the experts.
Check out their NT Insider articles.
|
|
|
|

|
as superman says, OSR, they do a free mag every two months, its very very good. Their website, osronline, is a must.
http://dumpanalysis.org/ is usefull for analysing dumps, something you are going to be doing a lot of.
Ndis.com is good for network stuff, like firewalls.
Most importantly you want to buy Walter Oneys book, programming the wdm, it is essential.
==============================
Nothing to say.
|
|
|
|

|
Erudite_Eric wrote: you want to buy Walter Oneys book
Bunch of thanks, downloaded it
Erudite_Eric wrote: OSR, they do a free mag every two months, its very very good.
Already signed up
Erudite_Eric wrote: http://dumpanalysis.org/
I'll learn that aswell.
Erudite_Eric wrote: Ndis.com is good for network stuff, like firewalls.
Thank you, this could be very helpful in the future (including everything).
Do you suggest me working for a security company like Faronics (ever heard of Deep Freeze)?
Simple Thanks and Regards,
Brandon T. H.
Been programming in Visual Basic for 4 years this point forward, and is very good at it (I can even create programs completely on code, without dragging those items from the toolbox). Programming C++ for 1 year so far and the same with C#.
Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison
|
|
|
|

|
Yes, it will give you a lot of experience. I have worked on similar products, and file system drivers, such as those used by Faronics to control applicaiton execution and so on are some of the most complex to write.
==============================
Nothing to say.
|
|
|
|

|
I am currently writing a game in C++ using OpenGL and I wonder which is the best way to deal with errors, once they occur (especially in games).
Note: I am currently using possibility 2, but I'm not really happy with it.
1. Exceptions - At first glance they seem to be the perfect for all kinds of errors, but I found out that exceptions can produce heck of a lot of overhead and extra time cost and IMO they're making the code ugly.
2. Return values - It's said that checking success using return values is deprecated since C++'s built-in exception handling. I can't share that opinion, but retrieving a return value and checking it doesn't seem to be an 'elegant' way of doing this and isn't beautiful as well (due to thousands of if and/or switch statements.
3. Return value + global error indicator - This one's really deprecated, even though I somehow liked the errno thingy in C
So, what do you use/what would you use and what would you recommend for my needs?
Thanks in advance.
PS: Do I have some kind of natural aversion to exceptions or are they really not the greatest invention since sliced bread?
|
|
|
|

|
I think in error handling, performance should not be of concern. So, the "I'm writing a game, everything must be fast!" argument doesn't work here. Errors should always be the exception!
Exceptions really help you to write smaller code. When using return values, you have to check them every time. If you forget to do so, you might miss an error. So they are really prone to bugs!
Exceptions on the other hand can't be simply ignored, and I think that's good.
|
|
|
|

|
TomasRiker2 wrote: Errors should always be the exception!
Well said! Can I quote you on this?
|
|
|
|

|
forkbomber wrote: ...but I found out that exceptions can produce heck of a lot of overhead and extra time cost...
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
 |