|
Niklas,
Thanks, is any way to know how many characters can I write into the serial port without overwriting bytes?
Thanks again
Al
|
|
|
|
|
hey im pretty new to c++ and need some help.
is there any way to turn off the little blinking white cursor in the c++ console?
i need to turn it off for a game
thx
|
|
|
|
|
SetConsoleCursorInfo
Set the bVisible member of CONSOLE_CURSOR_INFO to false
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
alright thx for the reply, but do u think u can give me a little help on how to use it? i get a buncha errors, im probably putting it all in wrong
|
|
|
|
|
Ryan2845 wrote:
alright thx for the reply, but do u think u can give me a little help on how to use it? i get a buncha errors, im probably putting it all in wrong
Okay. I just put together a small program. The cursor did vanish
char abc[128];
int main(int argc, char* argv[])
{
HANDLE h;
h= CreateConsoleScreenBuffer(GENERIC_WRITE|GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,CONSOLE_TEXTMODE_BUFFER,NULL);
SetConsoleActiveScreenBuffer(h);
CONSOLE_CURSOR_INFO cci;
cci.dwSize = 90;
cci.bVisible=false;
SetConsoleCursorInfo(h,&cci);
cin >> abc;
return 0;
}
Hope this helps you,
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
hmm thats what im goin for but how can i get it to work in this sort of program:
i'm making sort of a space invaders style game, i have a loop that outputs a ship made from text <-0-> in an array, when i put that code u gave me in it doesn't show the ship, is there any way to get the ship to show and still have no cursor?
Is there maybe a way to just make the cursors color be black?
thx agian
|
|
|
|
|
Ryan2845 wrote:
when i put that code u gave me in it doesn't show the ship, is there any way to get the ship to show and still have no cursor?
I really don't think that hiding the cursor will rsult in the hiding of the ship too. I think the problem must be elsewhere.
Ryan2845 wrote:
Is there maybe a way to just make the cursors color be black?
The cursor is usually the same color as the forground text. I am not sure whether it's color can be changed.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
alright, ill keep messin with it, thx a million!
if u have the time/desire, i can email u the code.
|
|
|
|
|
Ryan2845 wrote:
alright, ill keep messin with it, thx a million!
Good luck Ryan
Ryan2845 wrote:
if u have the time/desire, i can email u the code.
Thanks, if you figure out what went wrong, lemme know too
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Hello,
I am using CDatabase from within a service. The CDatabase is used from within multiple worker threads. So far I haven't run into trouble, but I don't want to go ahead and then have to come back and debug my base code. Has anyone else used CDatabase in a multithreaded service program?
Regards
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
I have and you should be ok.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Tom Archer wrote:
I have and you should be ok.
Whew, that is a relief. I was getting a little apprehensive and the tension grew cause I got no replies even after a couple of hours.
Thanks Tom.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Well, isn't the MFC library thread safe altogether? Why CDatabase should be different?
Best regards,
Alexandru Savescu
|
|
|
|
|
Alexandru Savescu wrote:
Well, isn't the MFC library thread safe altogether?
Actually no! A good number of MFC classes are not thread safe
Glaring examples are CSocket and even CWnd. Try calling UpdateData on a CWnd derived class from a thread that didn't create the CWnd and you'll see how MFC is not thread-safe
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Well I do not know if calling UpdateData from another thread means that MFC is not thread-safe. The first thing you are told when writing multi threading apps is that you must not touch the GUI objects created by another thread.
Every thread has its message pump and all controls created by that thread receive notifications in that pump. Calling UpdateData from the second thread will post the messages in a different message pump (the second one) and your app will crash. This does not mean that MFC is not thread safe.
I don't know about CSocket though.
Best regards,
Alexandru Savescu
|
|
|
|
|
Sorry for such a lame question,
but I am creating a Modeless dialog from my CMainFrame class. The window is indeed modeless, but when I change the focus back to the main (parent), the modeless dialog remains on top.
How can I have my modeless dialog move to a lower level on the desktop whenever I change the focus to another window?
Thanks for answering my "common" question.
Humbly,
Johnny
|
|
|
|
|
make the modeless dialog's parent wnd NULL (ie. the desktop). that way, it can float anywhere it wants to.
-c
I don't care, and you can't make me.
|
|
|
|
|
This is because your dialog is a child of the frame window. Make it a child of the desktop.
This might also help:
http://www.codeproject.com/useritems/gettingmodeless.asp
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Or if you want to still make it a child of the Mainframe for some reason, you can in OnActivate check if it is being deactivated and just hide it at that point. This means that if you press the mouse outside the dialog box, it will hide.
|
|
|
|
|
Stan the man wrote:
This means that if you press the mouse outside the dialog box, it will hide.
This will mean that to bring it up again [make it visible], the user might have to be offered some button or menu item.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Very True. I guess I have always had a button to do this.
|
|
|
|
|
Thanks to all answers - see below.
Using the following did exactly what I desired:
m_pSetupDlg->Create(IDD_SETUP, NULL); // NULL associates to desktop.
Thanks again. Keep up the good work.
Johnny
|
|
|
|
|
I have a char array defined as
char cBuffer[200]
and I want to convert this to a double.
Can anyone help with the syntax to do this?
Thanks,
Kyle
|
|
|
|
|
use:
double dblVal;
sscanf(cBuffer, "%lf", &dblVal);
|
|
|
|
|
If you mean you have a double in the first 8 bytes of the array then you can get at it like this:
double dbl = *((double*)cBuffer);
or alternatively if the bytes that contain the double start say 6 bytes into the array then the syntax is nearly the same but you need the address of the first byte of the double:
double dbl = *((double*)&cBuffer[5]);
Just one thing to be careful of is that x86 cpu's allow this casting from anywhere in memory but some cpu's have strict rules about things being aligned on even byte boundaries so if portability is important then you may need to copy the bytes using memcpy() or something first to ensure the proper alignment.
Matt
|
|
|
|