|
Yanshof wrote: The CREATE_SUSPEND flag is just for using ResumeThread(...)
Wrong. Why would you even think that? When you call a function named ResumeThread() , what purpose would a CREATE_SUSPENDED flag serve? _beginthread()
Yanshof wrote: if the current thread is running ... how can i stop him and again set the thread continue running ? ( i guess that using ResumeThread again will make the thread run again )
Read the article I provided you. It plainly shows how to start, stop, suspend, and resume threads properly.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Google does wonders
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi
I am new to C++
Just wondering if anyone can help out here.
I have a string consisting of all the letters of the alphabet.
eg: string Alphabet ("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z");
I need to erase a particular letter of the alphabet within the string. eg H and then display the string back to the console app minus the letter erased.
I have tried playing around with Alphabet.erase() but so far have only managed to reduce the length of the string, not erase a specific character within it.
Can anyone show me how I could do this
Thanks in advance !!!
I really hate this darn machine;
I wish that they would sell it.
It won't do what I want it to,
but only what I tell it.
~Author Unknown
|
|
|
|
|
bool removeChar(const char& c)
{
if ('h' == c || 'H' == c)
return true;
return false;
}
string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
alphabet.erase(remove_if(alphabet.begin(), alphabet.end(), removeChar), alphabet.end());
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
To erase the letter, the previous solution works. The code below replaces the letter with a space:
wstring alphabet = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
wstring::size_type pos = alphabet.find(L'H');
if (pos != wstring::npos)
alphabet.replace(pos, 1, 1, L' ');
wcout << L'[' << alphabet.c_str() << L']' << endl;
-- modified at 15:54 Tuesday 19th September, 2006
|
|
|
|
|
Hello! Please help me!,
Is it possible to check how long you have been on the Internet?
can you check when you start Internet explorer och when you close Internet explorer or it there a better way? Please help me.
|
|
|
|
|
If you are wanting to tie it to browser activity, then I suspect a Browser Helper Object (BHO) is what you are after.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks do you have ant pointers where I can check and if there are any exemple?
|
|
|
|
|
When someone gives you a name, then google is all you need for more info.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
In addition to the link I already provided?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have a few nested splitters on my main screen and two of the panes use forms that are exactly the same in look and functionality except for a couple of strings. If there was a way I could send in some value to determine which stored procedure it should use to fill the list control, everything would be great and I could use an instance of the same class for both panes. But I create the formviews using RUNTIME_CLASS when creating the splitters.
While writing this post I've just thought about I could make the class I want to use a parent class, make two derived classes, each one calling the parent's constructor with the string or enum values I want. Something like this:
class CLeftFormView : public CMyFormView
{
};
class CRightFormView : public CMyFormView
{
};
This seems like it would work, but I wonder is there a better method for what I'm trying to do. Any suggestions are appreciated.
Thanks
|
|
|
|
|
Actually, that seems like a pretty reasonable approach to me. I'd definitely give it a go.
|
|
|
|
|
I'm reading a bunch of raw numerical data (floats representing verticies) from disk in one endian format, and need to convert it to another (flip the bytes around).
Currently I am reading the numbers one by one and bit-shifting them to the correct format, then placing them into their respective places in an array of verticies (float[3]'s).
I am trying to speed up this whole operation, and may be able to do so with a better method/algorithm. The following also may help:
- Each float is 4 bytes and needs a pure reversal of bytes - not bits (bytes 1234 become 4321)
- the floats are contiguous on disk
- I know ahead of time how many floats I will be loading into a given array
- The array will be pre-allocated to hold the right number of verticies
- I must keep (or end up with) the array two-dimensional (array of float[3]'s) for later OpenGL usage
not sure if reading them all in at once, and applying a macro-bit-shift would be faster?
Thanks for any help
|
|
|
|
|
nadiric wrote: not sure if reading them all in at once, and applying a macro-bit-shift would be faster?
Yes. Reading them in one at a time increases disk access (which is expensive). Reading them in as a block decreases the number of reads required to get your data.
Something along the lines of the following should work:
float endian_shift(const float& f)
{
float ret = 0.0;
ret |= (f << 24);
ret |= ((f >> 8) << 24) >> 8;
ret |= ((f >> 16) << 24) >> 16;
ret |= (f >> 24);
return ret;
}
ifstream fin;
fin.open("myfile.dat", ios::binary);
vector<float> myData(SIZE);
copy(istream_iterator<float>(fin), istream_iterator<float>(), back_inserter(myData));
fin.close();
transform(myData.begin(), myData.end(), myData.begin(), endian_shift);
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Thanks for the reply,
Just tossing a few other thoughts around...
Given the following:
- vertex is of type float[3]
- verticies is an array of SIZE vertex (verticies = new vertex[SIZE];)
- vertsfromfile is an array of (SIZE*3) floats
are the floats in "verticies" aligned one after the other in this fashion:
verticies[0][0]verticies[0][1]verticies[0][2]verticies[1][0]verticies[1][1]...and so on to allow for something like memcpy(verticies,vertsfromfile,(sizeof(vertex)*SIZE)) ?
or is this just crazy talk?
Thanks
|
|
|
|
|
If the file is written out such that each vertex is written as float1float2float3, then writing out a series of vertices would just mean you would have vertex1vertex2vertex3... where each vertex matched the pervious pattern. Thus, you could read them in in such a fashion (though, I would still stick with using the copy algorithm).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi!
Can anyone tell me how to enumerate the USB Hubs connected to my PC?
In theory (i think) it should work like this:
hDevInfo = SetupDiGetClassDevs(GUID_DEVINTERFACE_USB_HUB, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
...and give me a list of the hubs. Using GUID_DEVINTERFACE_DISK as GUID works perfect for harddisks but when i try to use GUIDs from the usbiodef.h nothing is found.
Can i use my VS.NET 2002 for this or does it only work with the c Compiler from the DDK?
|
|
|
|
|
u can search in registrey . the ddk has a sample in it . name of that sample is usbview. just check it out.
If u can Dream... U can do it
|
|
|
|
|
Hello there. I need help with a simple MFC program, it needs to move the mouse to a specific point on the window. Is there a function that can move the mouse to a coordinate?
thanx..
KOM UIT DAAAAA!!!
|
|
|
|
|
You can use the SendInput function to move the mouse to any place on the screen. When using the function notice that the screen coordinates(resolution) have to be converted to mouse coordinates(0-65535) in both the horizontal and vertical directions.
Chipper Martin
|
|
|
|
|
What are the other parameters the SendInput function takes?
KOM UIT DAAAAA!!!
|
|
|
|
|
Click on this link and it will lead you to the direct microsoft information for SendInput
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/sendinput.asp
Chipper Martin
|
|
|
|
|
SetCursorPos()
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
I'm working on a program that tracks my stats as I'm playing online poker. The stats portion if working fine, now I want it to display bitmaps of my chosing on top of the poker window as I'm playing. I can get a handle to the window using FindWindow... is it possible to display the bitmap in the poker window using this somehow? If so, would it just be overwritten by the actual poker app as it also displays it's graphical info to the same window?
Any other ideas?
Thanks!
|
|
|
|
|
Once you use FindWindow to locate the correct hwnd for the poker window, you're most of the way home. Rather than trying to paint your bitmap in the DC for that window, which could very well run into the kinds of problems that you anticipate, consider instead creating a new child window using the poker hwnd as the parent. That way you'll have complete control and can paint what you want in your child window without worrying about what the poker app will paint. You can set yours to be a floating window or any number of other options, but I think this approach will give you the most flexibility.
|
|
|
|