|
scgadgets wrote:
Ahhh, that makes sense. Just to be sure, I would pass the object as follows, correct?
AfxBeginThread(Mythread, this);
Yes. That's correct.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
From
char* cMyVar = "megabonus";
I want to copy the 3 first chars to
char myother[2];
But how?
I tried strncpy(...) but it's not the right function... or..
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
You need a 4-character array.
char myother[4] = {0}; // init to all zeros
strncpy ( myother, cMyVar, 3 );
It's important to init myother to all 0 because strncpy does not append a terminating null when the source string's length is equal to or greater than the # of chars you want copied (3 in this case).
--Mike--
#include <witty-sig.h>
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Hi,
I have following problem:
UINT CMyWorkerThreadsCoolFunction(whatever)
{
SerialFlowOfDataSusceptibleToHung();
}
<\pre>
I wanna let the user define the time interval between moment 0 and moment x he is ready to wait. Depending upon this he gets more or less data.
Question: how to achieve this?
Thanks
Pepe
|
|
|
|
|
Sleep (time_in_ms);
????
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Thanks for your answer, I must have not been clear enough, sorry for it.
This is all about communication over the serial port.
SerialFlowOfDataSusceptibleToHung() is a data stream from the external device, and it is itself completely blocking the worker thread from which the given read operation was issued, as a result of which another blocking command like Sleep(ms) is no solution to this problem.
In the majority of cases all the data can be read from the device in less than a second, but unfortunately in case the read operation hungs or slowly executes, the worker thread does not return for a long time.
My prog uses time sharing of the serial port between several worker threads (a command from one thread can only be issued after the previous from another thread has been completely executed, and thus the port has been freed)
If one of my threads blocks the port, all the communication of my other threads with the device is impossible.
That's why I wanna limit the maximum time of one thread blocking the one and only communication channel.
Limiting the time of a read operation does not affect the average thread, because it usually terminates quickly. But in case of a trouble (slowed down read) the user receives a little less data, but does not have to wait too long for it.
Thats why I wanna find a solution to limit the time of execution of blocked threads.
Thanks in advance.
Pepe
|
|
|
|
|
I want to define 'Font' and it's style with GDI+
Can anybody give me an example?
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
I am developing Messenger in VC++ as my Final year Project. This messenger will applicable on LAN. I need help in a sense that how I should start work. Is there any body who will help me in this project. remember that I m developing it in VC++.
|
|
|
|
|
Hi all!
I'm at the choosing stage.
Next I'll learn one of them thoroughly.
Which should I choose, wanting long term investment, some game programming fun, and also general graphics programming excellence.
So, my esteemed collegues, what is the choice
that Experience whispers to your ears ?
Thanks!
Antoine
"The world is not enough" -Ian Flemming
"What becomes of whiteness, when the snow has melted?" -William Shakespeare
|
|
|
|
|
My opinion: DirectX
Because I feel OpenGL is somehow fading out, and DirectX has become _much_ better (than it was before). Most gamers are using Windows anyway...
Sprudling
|
|
|
|
|
Easy to learn and get started:
OpenGL (I hear the DX is getting better)
Portable:
OpenGL
Most advanced and will stay that way:
DirectX
However, OpenGL implements extensions that provide most if not all the same functionallity. However, these extensions are vendor specific and many times are VERY hard to locate documentation.
Programming for the X-Box:
DirectX
Driver quality:
???? (Someone else can answer this)
What are game programmers using:
DirectX mostly. Some are still doing OpenGL, but the non-Windows market is pathetic so I really don't see the advantages.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Thanks for the reply!
I got the impression that I'd be better with OpenGL since
it's platform independant.... ¿
Regards,
Antoine
Coming home from Vancouver. I look like a hobo! lol
|
|
|
|
|
If you are going to be porting to Mac, Linux, etc, then yes. Otherwise, if you are only going to developing for Windows, then portability really isn't a concern.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Hi,
I am going to use SHBrowseForFolder in my application. Is there any dependency issues with this? Will it automatically work on Windows 95 onwards?
Thanks Again
Rich
|
|
|
|
|
The API works on all OSes, however not all of the flags do. MSDN lists which flags are suppoted on which OSes.
--Mike--
"Everyone has figured out what 'service pack' really means, so they had to go and change the language. Perhaps this is what Bill was talking about in the 'security is top priority' letter."
-- Daniel Ferguson, 1/31/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I have two buttons in my toolbar,that have the same identifier with two menu,
I've overriden ON_COMMAND and UPDATE_COMMAND_UI for both of them,
in UPDATE_COMMAND_UI I used SetCheck(),
when I run my application menus update correctly
buttons don't,any suggestion?
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Have you used the TBSTYLE_CHECK style for your toolbar buttons?
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
you mean this:(or something like this)
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT|TBSTYLE_CHECK, WS_CHILD | WS_VISIBLE | CBRS_TOP| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
It doesn't work
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Hi All,
Can anybody help me out find some way in an application in which a vector can be pass thru commandline
The vector which i wanna send is STL(Standard Template Library) based vector
|
|
|
|
|
A vector itself cannot be passed via the command line. You can pass the data as arguments to a program. There are many classes on CodeProject for reading command line arguments.
Michael
|
|
|
|
|
Im not sure if I understand the question correct, but I suppose you could
put all arguments in a string and feed it to system() if the data consists of standard types. Otherwise you might want to serialize the data to a file and pass the file as input to the commandline..
/moliate
|
|
|
|
|
Hi.
I got some help a while back to deleting directories directly using SHFileOperation.
All works fine when I set the file name directly as "d:\...\..." in the WIN32_... variable. If I use char chFile[] = "d:\\..." it is OK too.
However, because I need to search through the directories and eliminate what I need, I tried to use sprintf and also CString to set the directory path and using this to delete the directory. It doesn't work. I think it has to do with needing a LPCTSTR which is a constant and what I am doing is not constant.
How do I get around this or how would I proceed? I am really stuck on this.
Thanks.
|
|
|
|
|
You're probably not getting the pFrom buffer right, it needs to be terminated with two zero bytes, which sprintf() does not do. Check out my SHFileOperation wrapper class in the Shell section which handles creating all the buffers for you.
--Mike--
"Everyone has figured out what 'service pack' really means, so they had to go and change the language. Perhaps this is what Bill was talking about in the 'security is top priority' letter."
-- Daniel Ferguson, 1/31/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I have a regular combobox, and I want the selected item (the item shown in the editbox area of the combobox) to be automatically updated when I write something in another editbox. I also want this string to be "stored", so that next time I pull down the combobox this string is still there. So just manipulating the editbox itself isn't good enough. I also want the index to not change. I'm not using MFC, just plain Win32 API stuff.
I hope you understand what I mean :]
Sprudling
|
|
|
|
|
1. Get the index of the item that is in the edit area of your combo box with the CB_GETCURSEL message.
2. Remove this index from the combo box. That will remove this string completely. Use the CB_DELETESTRING message.
3. Get the text from your external edit box, probably with the WM_GETTEXT message.
4. Insert the new text string at the same index of the original string with the CB_INSERTSTRING message.
One more good tip it to send a WM_SETREDRAW message with false in the WPARAM field, before you even start removing and inserting the strings in the combo box, because this will make it so that the combo box does not redraw itself while you are manipulating the data.
When you are done, send a WM_SETREDRAW message with TRUE in the WPARAM field, and this will force the combo box to repaint with all of the new data.
|
|
|
|