|
I work with real-time graphics in flight simulation. It sounds like a timing problem more than anything. I'm not familiar with PC chips all that much, but it may be that the timing you've chosen to animate your objects can't be sustained at the rate you would like it to. In regular animation, the human eye can begin to detect 'stepping' at somewhere between 20-25 Hz (20-25 frames per second). So if you aren't displaying your scene faster than this, you are going to notice 'skipping' or 'stepping' of your scene objects. Hope this helps.
John P.
|
|
|
|
|
I am creating an application which has a list view control and you can drag and drop items into it - for example, from the explorer - which then processes the data and adds an entry to the list view. How would i implement this?
Thanks for your help,
--PerspX
|
|
|
|
|
Perspx wrote: How would i implement this?
Since CView provides the functionality, it should be handled automatically. What are you having trouble with?
"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
|
|
|
|
|
Well i am using straight C/C++ with no classes so I am not sure how to handle drag and drop. Is there some sort of APIs for this?
Thanks for your help!
--PerspX
|
|
|
|
|
Perspx wrote: Well i am using straight C/C++ with no classes...
My bad.
"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
|
|
|
|
|
|
Hi
I have an activex control. In that control I have a bitmap image. Now I have a function called GetImage(), I want to return this bitmap. How do I do that. What should be variable type of GetImage().
Any help would be of great help.
Regards
The Best Religion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Zainu wrote: What should be variable type of GetImage().
A pointer to an Image object.
"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
|
|
|
|
|
One way is via the IPicture[^] interface (and related interfaces and APIs).
Steve
|
|
|
|
|
Hello,
Can you please give me the reference for OnCmdMsg() method for CMDIFrameWnd class
Pritha
|
|
|
|
|
http://msdn2.microsoft.com/en-us/library/e1zkw1et(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/k63bsef7(VS.80).aspx
"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
|
|
|
|
|
Hi All,
I followed Michael Dunn's article on The Complete Idiot's Guide to Writing Shell Extensions - Part I[^], and created a pair of (two separate) extensions: one for creating file checksums; and a second for verifying. Reference: A File Checksum Shell Menu Extension Dll[^].
It is apparent these are mutually exclusive on Vista (I just retested on Windows 2000 - OK):
* Register both Create and Verify
- Only Create is available
* Register only Verify (unregister Create)
- Verify is available
Any ideas? I pasted part of the Registry Resource (to verify uniqueness of UUIDs). But I suspect it has to do with the way the handler registers. I verifed both are registered under HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers.
Also, I'm not convinced this is a Shell/COM issue, so I moved the question from the ATL board to the VC++ board.
Jeff
The Ctx prefix was added below so that the items would 'stack' (group together) on the Context menu.
HKCR
{
NoRemove CLSID
{
ForceRemove {7E745006-3E3F-42F8-B806-E24D4133439C} = s 'CtxVerifyHash Class'
...
and
HKCR
{
NoRemove CLSID
{
ForceRemove {571077DC-F353-43C8-ACAC-4DE4B7EFC4E3} = s 'CtxCreateHash Class'
...
|
|
|
|
|
Hi All,
A fresh build using Visual Studio 2005 (new project, not a port) did not resolve the issue. Also, the issue is confirmed in XP.
Jeff
|
|
|
|
|
I need help on how to get the device id in program for a particular pocket pc. I'm using Embedded Visual C++.
|
|
|
|
|
Hi, can anyone help me?
I need to run 4 threads(each thread handle the same function) in my app.
The function looks like this:
void ThreadFunction()
{
Do something...
Do something, but only one thread at one time //it doesn't consume much time
Do something...
EndThread()
}
1) How should I start threads? (CreateThread(),AfxBeginThread(),...)
2) How should I end threads? (EndThread() - ???)
3) How should I handle the part of code that must be processed only by one thread at a time?
Thank you very much for any help.
Petr
|
|
|
|
|
How to start a thread can depend on what the thread procedure uses -
For just Windows API, CreateThread()
If using any C Runtime (CRT), use _beginthread/_beginthreadex
If using MFC, use AfxBeginThread
Ending threads should be done by letting the thread procedure return normally.
Anything that needs to be thread safe (done by only one thread at a time) should be synchronized.
Mutex and critical section objects work well for this.
See Joseph Newcomer's article Using Worker Threads[^] for lots of handy info.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thank you for your help. I am using MFC.
I have already read something about synchronization.
If I use Mutex, it must be defined outside the ThreadFunction(). Am I right?
If I need to wait until other thread stopped using of critical part of code, what should I use? WaitForSingleObject() function?
|
|
|
|
|
zudroj wrote: If I use Mutex, it must be defined outside the ThreadFunction(). Am I right?
Not always. If more than one thread in your process needs to use the mutex, then you need its
handle outside the threadproc, somewhere where other threads can access it.
If the mutex is used only by that thread in the process (for example, a named mutex for
synchronizing different processes) then you could create/open it IN the threadproc.
Define it wherever it can be accessed by all threads that need the handle.
zudroj wrote: If I need to wait until other thread stopped using of critical part of code, what should I use? WaitForSingleObject() function?
Yes. When WaitForSingleObject() returns and indicates you own the mutex, make sure to call
ReleaseMutex() when you're done executing critical code so other threads can assume ownership of
the mutex.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thank you.
All I needed is working well.
|
|
|
|
|
zudroj wrote: 1) How should I start threads? (CreateThread(),AfxBeginThread(),...)
Maybe the big design decision is between creating a worker thread or a User-Interface one (see [^] and [^]).
zudroj wrote: 2) How should I end threads? (EndThread() - ???)
Gracefully. Ask the thread itself to terminate (setting a flag, using a use a Synchronization Object [^], for instance, an Event, ...).
zudroj wrote: 3) How should I handle the part of code that must be processed only by one thread at a time?
Again, use a Synchronization Object [^] (for instance a Critical Section).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi guys,
I am trying to use the Win32 API to fill a bitmap, using the function GetDIBBits(). My source bitmap is a 32-bit image, but I am hoping to create a 4-bit destination bitmap. I am of the understanding that this requires me to create a color table, and keep it in a BITMAPINFO structure. Does anybody see a problem with this snippet of code?
<br />
pbmi = (PBITMAPINFO) LocalAlloc(LPTR,sizeof(BITMAPINFO));<br />
<br />
<br />
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER) + 16*sizeof(long);<br />
pbmi->bmiHeader.biWidth = bmp.bmWidth;<br />
pbmi->bmiHeader.biHeight = bmp.bmHeight;<br />
pbmi->bmiHeader.biPlanes = bmp.bmPlanes;<br />
pbmi->bmiHeader.biBitCount = 4;<br />
<br />
pbmi->bmiHeader.biCompression = BI_RGB;<br />
<br />
if (pbmi->bmiHeader.biSizeImage == 0)<br />
pbmi->bmiHeader.biSizeImage = WIDTHBYTES((DWORD)pbmi->bmiHeader.biWidth * <br />
pbmi->bmiHeader.biBitCount) * pbmi->bmiHeader.biHeight;<br />
<br />
pbmi->bmiHeader.biClrImportant = 0;<br />
<br />
for(i = 0; i<16; i++)<br />
{<br />
pbmi->bmiColors[i].rgbRed = 0;<br />
pbmi->bmiColors[i].rgbBlue = 0;<br />
pbmi->bmiColors[i].rgbGreen = 0;<br />
pbmi->bmiColors[i].rgbReserved = 0;<br />
}<br />
<br />
pbmi->bmiColors[1].rgbRed = 255;<br />
<br />
pbmi->bmiColors[2].rgbRed = 128;<br />
<br />
pbmi->bmiColors[3].rgbGreen = 255;<br />
<br />
pbmi->bmiColors[4].rgbGreen = 128;<br />
<br />
pbmi->bmiColors[5].rgbBlue = 255;<br />
<br />
pbmi->bmiColors[6].rgbBlue = 128;<br />
<br />
pbmi->bmiColors[7].rgbRed = 255;<br />
pbmi->bmiColors[7].rgbGreen = 255;<br />
<br />
pbmi->bmiColors[8].rgbRed = 128;<br />
pbmi->bmiColors[8].rgbGreen = 128;<br />
<br />
pbmi->bmiColors[9].rgbRed = 255;<br />
pbmi->bmiColors[9].rgbBlue = 255;<br />
<br />
pbmi->bmiColors[10].rgbRed = 128;<br />
pbmi->bmiColors[10].rgbBlue = 128;<br />
<br />
pbmi->bmiColors[11].rgbGreen = 255;<br />
pbmi->bmiColors[11].rgbBlue = 255;<br />
<br />
pbmi->bmiColors[12].rgbGreen = 128;<br />
pbmi->bmiColors[12].rgbBlue = 128;<br />
<br />
pbmi->bmiColors[13].rgbRed = 0;<br />
pbmi->bmiColors[13].rgbGreen = 128;<br />
pbmi->bmiColors[13].rgbBlue = 0;<br />
<br />
pbmi->bmiColors[14].rgbRed = 192;<br />
pbmi->bmiColors[14].rgbGreen = 192;<br />
pbmi->bmiColors[14].rgbBlue = 192;<br />
<br />
pbmi->bmiColors[15].rgbRed = 255;<br />
pbmi->bmiColors[15].rgbGreen = 255;<br />
pbmi->bmiColors[15].rgbBlue = 255;<br />
Am I missing something here?
Thanks
|
|
|
|
|
TheDelChop wrote: Am I missing something here?
Yes, you didn't allocate memory for the colour entries (pbmi->bmiColors[] ).
You have to do:
pbmi = (PBITMAPINFO) LocalAlloc(LPTR, sizeof(BITMAPINFO) + 15 * sizeof(RGBQUAD));
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I am currently a student and have wondered into the realm of c++. The problem is that I am creating a program that can edit NC code for multi-axial milling machines. The problem is as follows.
I have the line of text that I wish to edit, this has been stored as a CString. And would look something as follows: N650 G1 X152.5 S5200
The only part of this string that I want to change is the S5200, and would like to change it to say S8000.
It isn’t possible to read the different parts of the code into the CString as the whole line is read from an XML. And the number of characters before the S5200 is not always constant
Is there a way to read the CString until the S Character is found and then write over it?
Any help with this would be much appreciated and my apologies if this is a menial question, it is however hard to find such information on something so specific.
Regards
Jason Smith
|
|
|
|
|
CString::Find() and CString::Replace() can help you in achieving this.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
jasn Smith wrote: Is there a way to read the CString until the S Character is found and then write over it?
Yes, assuming no other "S" precede the one you want.
"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
|
|
|
|