|
well i know how to create the gui etc. i just dont know what code to use to record the screen. once i can get a base code to work on or an article or somethin then i can start. i dont know anything about recording code.
modified on Monday, May 5, 2008 7:34 PM
|
|
|
|
|
Can No one Help me!!!?????
|
|
|
|
|
windows works with "windows objects", try to get the desktop window object and.. work with it. I never tried what you want, but i'll start from something like i said.
Recording data is easy, problem is how to get those data.
|
|
|
|
|
I'm creating a linked list that stores two strings in each node.
I quickly drafted the code as:
<br />
struct SongInfo {<br />
CString Title;<br />
CString Address;<br />
SongInfo* next;<br />
};<br />
<br />
void CreateList() {
...<br />
if (bINeedAnother) {<br />
cur->next = new SongInfo;<br />
cur = cur->next;<br />
}<br />
...<br />
}<br />
I am using CStrings since the length of the strings is unknown. However, since once they are initialized they don't change, I am thinking I should change it to dynamically allocated WCHAR pointers, with the appropriate length for each string. Or is there another practice that would be better?
The other question is on the allocation of the nodes. The number of nodes can be as few as 10, and I've seen as much as 300. Is it a bad idea to allocate one node at a time (i.e. can I rely on Windows to keep the memory unfragmented)? If so, what is a good practice here?
(Sorry for the noobish questions, my programming professor sucked, and her linked lists ALWAYS crashed, and she ALWAYS blamed the OS.)
|
|
|
|
|
1. using CString is ok.
2. usually, when building linked lists, we (me) allocate one node at a time;
Best practice in 2008 would be to use STL (list or vector or dequeue).
|
|
|
|
|
STL containers are well optimized and you have several types where choose. A good practice is using STL (at least, it's my opinion)
Dinamic resizing of vectors was a great help for me some years ago.
|
|
|
|
|
Hello,
I need to change the typematic rate/delay (moreover accessing leds). is there any way to do it without a device driver?
I have seen some small MFC applications (less than 500kb..) that can access to leds. SDL libray can, Allegro can... but, without using 3rd party libraries only with VC++/MFC?
I need to send data to a custom keyboard (yes, i know it's an output device), but since XP kernel inhibits direct access to hardware i had to find other way to send data without making a device driver and... with typematic and led status i could achieve it (data will be sent so much times as needed, not only once).
All help will be great.
Thanks U.
modified on Wednesday, May 21, 2008 12:31 PM
|
|
|
|
|
alichan wrote: I need to change the typematic rate/delay (moreover accessing leds). is there any way to do it without a device driver?
Have you tried changing the following:
HKCU\Control Panel\Keyboard\KeyboardDelay
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Hi
How do I customize the standard property sheet buttons
I can change the text of the button using
CWnd *pWnd = GetDlgItem (ID_APPLY_NOW);
pWnd->SetWindowText("Hello");
but what i want to do it add an icon onto the button as well
Can any one help ?
thanks
simon
|
|
|
|
|
Associate a CBitmap object with the button and call its SetBitmap() method.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Im making a class to be used in a final project for my c++ class and in my game i need to create the object "shot" when the user shoots the problem is "this" when declaring Shot=new TImage(this); has to be a part of a member function.... heres my declaration of my class and the snipit of code where i create the object called "shot" please help
#ifndef SpaceInvaders<br />
#define SpaceInvaders<br />
#include <Classes.hpp><br />
#include <Controls.hpp><br />
#include <StdCtrls.hpp><br />
#include <Forms.hpp><br />
#include <ExtCtrls.hpp><br />
#include <Graphics.hpp><br />
<br />
class SpaceInvaders{<br />
private:<br />
public:<br />
TImage *Shot;<br />
bool __fastcall Collide(TControl *C1, TControl *C2);<br />
void __fastcall Shots(TControl *C1);<br />
void UserMovement(TControl *C1);<br />
};<br />
TImage *Shot;
and when i create the object...
<br />
Shot=new TImage(*TForm1);<br />
Shot->Parent=Form1;<br />
Shot->Width=15;<br />
Shot->Proportional=true;<br />
Shot->Visible=true;<br />
Shot->Top=ShootFrom_Y;<br />
Shot->Left=ShootFrom_X-(Shot->Width/2);<br />
|
|
|
|
|
What's the problem?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have read in a book that, the worst thing you can do for "optimizing the storage of constant data" is declaring a variable like..
CString g_str("this is the worst thing I can do");
Why I said this here because, recently I installed Visual studio 2008 feature pack and today while debuggig, I happened to step into the base class( CWinAppEx ) of my app class. There I found the below code..
CString strRegEntryNameWorkspace = _T("Workspace");
m_strRegSection = strRegEntryNameWorkspace;
With a little surprise, I scrolled the file, and in the top, there was another bunch of such declartions..
static const CString strRegEntryNameControlBars = _T("\\ControlBars");
static const CString strWindowPlacementRegSection = _T("WindowPlacement");
static const CString strRectMainKey = _T("MainWindowRect");
static const CString strFlagsKey = _T("Flags");
static const CString strShowCmdKey = _T("ShowCmd");
static const CString strRegEntryNameSizingBars = _T("\\SizingBars");
static const CString strRegEntryVersion = _T("ControlBarVersion");
static const CString strVersionMajorKey = _T("Major");
static const CString strVersionMinorKey = _T("Minor");
So pathetic
modified on Tuesday, April 29, 2008 10:26 AM
|
|
|
|
|
Naveen wrote: I have read in a book that, the worst thing you can do for "optimizing the storage of constant data" is declaring a variable like..
CString g_str("this is the worst thing I can do");
Do you, or the book's author, have metrics to back this up?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
It is actually a microsft press release book . Programming vc++ by David Kruglinski. And the reason is
if you are writing some code like
const char g_pch[] = "test";
the g_pch get stored in the .rdata section of the code. This section hold initialized readonly data. The more stuff you put in the .rdata section, the better because even multpile copy of application is running, no need to create seperate page file.
If you wrote like
const CString g_str("this is the worst thing I can do");
Now you've got the CString object (which is quite small) in the .bss section, and you've also got a character array in the .data section, neither of which can be backed by the EXE file. To make matters worse, when the program starts, the CString class must allocate heap memory for a copy of the characters. You would be much better off using a const character array instead of a CString object.
|
|
|
|
|
i guess defining a const CString is somewhat different than defining a CString object.
the optimizer certainly takes the constness in account more easily.
interresting though.
|
|
|
|
|
May be, but not excatly what you get when you declare like
const strRegEntryNameWorkspace[] =_T("Workspace");
and you see some of the variable declared are passed to functions which have LPCTSTR as parameter. Means they are not taking any advantage of the class CString
|
|
|
|
|
hum, yes, I answered a bit too fast too... even a const CString, the compiler doesn't really know what the CString class is for, so if you need literals, it's obvious that you have to use const TCHAR*s... or at best, use the resource string table.
|
|
|
|
|
CString and optimization should never be used in the same sentence. It is common sense that constant string literals is a more optimized way of storing string literals. There seems to have been a paradigm shift over the years that optimizations are no longer valid. Its funny how Moore's law has accurately predicted the number of transistors and Wirth's law[^] is correctly predicting that applications are increasingly becoming slower and slower.
I have noticed that many software engineers excessively use CStrings and have no concept of passing values through the stack rather than the heap. It is my opinion/philosophy that software engineers should be certified sort of like a doctor or lawyer. We should all be dressed in lab coats and wearing einsteins haircut[^].
Flame away!
-David Delaune
|
|
|
|
|
Randor wrote: CString and optimization should never be used in the same sentence. It is common sense that constant string literals is a more optimized way of storing string literals. There seems to have been a paradigm shift over the years that optimizations are no longer valid. Its funny how Moore's law has accurately predicted the number of transistors and Wirth's law[^] is correctly predicting that applications are increasingly becoming slower and slower.
This problem will only grow. Especially with the new .Net languages where you don't need to worry about the memory. I've recently used c# to create a report, due to the enormous data to put into the report the memory it used was about 1 GB. After I closed the report, the memory wasn't freed.
I though no problem, thats why there is a Garbage Collector running.
Yeah right, tried to create the report again and the OutOfMemoryException was thrown.
I rather stick with c/c++ where I can control the memory, in such way I need or see fit.
Randor wrote: I have noticed that many software engineers excessively use CStrings and have no concept of passing values through the stack rather than the heap. It is my opinion/philosophy that software engineers should be certified sort of like a doctor or lawyer. We should all be dressed in lab coats and wearing einsteins aircut[^].
I like this idea , We certainly need safety goggles too and a light saber, in case we are attacked by a lowlife BUG
codito ergo sum
|
|
|
|
|
Randor wrote: I have noticed that many software engineers excessively use CStrings and have no concept of passing values through the stack rather than the heap
I'm confused. Are you saying you pass a CString on the stack or the heap? Where is the object? Where is the string? What exactly are you saying here?
Randor wrote: CString and optimization should never be used in the same sentence.
I beg to differ(And so does Mr. DiLascia)...
http://www.microsoft.com/msj/archive/S1F0A.aspx[^]
|
|
|
|
|
i am working in vc8 in win32. now i am changing my code to windows mobile5.0. all things worked fine, except for time.
i have used only minimal time functions in that.
they are
1. localtime 2.gmtime 3.ctime 4.mktime 5.time
i have converted localtime, and mktime. but for others i dont have any idea about how to port other functions.
please help me to port it...
RAJA
|
|
|
|
|
You have the source to each of these functions. Why not look there?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|