|
Characters are represented by a numeric value. It is that value that is stored in your variable not the letter itself, for chars these are the ASCII values. So its just as fast to use a number as it is to use a letter.
|
|
|
|
|
Thanx.
The game (soldner secret wars) i am working on (mainly patches) has many data like:
const int max_sounds=5;
by using this:
const char max_sounds=5;
i can optimize SIZE, becouse 20 classes uses 1 class for work that has this defined.
or am i wrong?
cu
|
|
|
|
|
oversight-[project-zero] wrote: chars are mainly used for strings.
Not exactly true. Char's are used for lots of things, including pure data manipulation. It's simply 2 bytes which can be interpreted as an ANSII character. That said, if you're only going to be holding very small numbers like 5 and you're EXTREMELY worried about space/efficiency, you should use BYTE for values which you know will be less than 16. I'm not sure how much time this will all save you to be honest, these types of issues are normally only a passing thought in designing your application because there are so many more design issues that would likely speed up your program much more.
|
|
|
|
|
thanx,
at this moment we have still (mod-team) status... and i am the only c/c++ coder.
This forum is a great help.
(talks are going on about soldner 2 www.secretwars.net= www.soldner.jowood.com)
You might wonder why this game source is so complicated lol.
(i hate wings !!!, crappy coders!!!!)
i can use a few helping hands making soldner a better game, if you are interested.....
The source is like this:
dynamics,core etc is defined in classes, DEEP polymorpish and derived stuff.
(just defined..... no value`s in c++)
The xml and python is used to define the game property`s.
Thats called the gdb::xxxxx (game database).
The gdb is implemented in c/c++ but called from python and xml.
becouse of this complexity, i am seeking for talented coders.
At our team talks are going on about a contract with jowood.
We where/are a mod team, but i think thats changing rapidly.
Jowood needs project zero, without project zero NO soldner.
Cu at the soldner battlefield.
|
|
|
|
|
|
oversight-[project-zero] wrote: becouse chars are mainly used for strings.
what's that crap ?
char is an integer in C/C++, and its name is quite bad as beginners make too much confusion... a char is only a 8 bits integer. in C/C++, there's no high level type for strings. strings are simply char arrays, ended with a char whose value is 0 .
never using a char will slow down your application compared to an int for such a use...
however, you'll have to consider the values stored within... char is a signed type, so stored values between -128 and 127 . if you want values from 0 to 255 , use unsigned char . and if you want more, use short , int (size is dependant of the plateform ; can be 8, 12, 32 or 64 bits !!! be careful !), long ...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
It is not so that using integers (32 bits) will slow your applications compared to using chars (signed or not of importance since 8 bit is 8 bit).
In game development speed is everything and a 32 bit CPU processes 32 bit values quicker then 8 bit values. So using an int is faster then a char.
|
|
|
|
|
hi ,
i want to get my system ip by using some code in my program , how i can do it,
i tried from registry in HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces
but it's a type of reg_multi_sz.
which type variable i should made in queryvalue function
plz respond as soon as
thanks in advance
|
|
|
|
|
|
I cant find the directshow sdk anywhere..! I downloaded the latest directx sdk, but it seems like it has been excluded from that package. Anybody who knows where I can get it? I am trying to access a webcam. Are there any other ways to do this?
øivind
|
|
|
|
|
|
hai..
in VC++ how can we insert a tree control in to a grid or list control .
please help
thanks in advance
shibu
|
|
|
|
|
|
|
Hi All,
(Sorry for my poor english )
I am currently writting a software using Direct Show to play both streaming and audio (e.g. MP3, WMA, etc.), which somehow like a Music player as WMP/Winamp.
First, I wrote a stand-alone player (with MFC in dialog-based approach) and it works fine. Then, I intergrate this dialog to be as a child dialog and put it into my main application, problems come
My application contains a main dialog, with two child dialogs build on it, while one is the player mentioned above and the other is for playlist purpose which contain List control for managing song record. The player works fine as it is when playing audio files, but problem occur when playing streaming media.
I tried to figure out what happen and find that the failure of playing streaming media ONLY occur after the playlist dialog is being created! it report that no filter can be found ... It sounds a mircale to me as there is nothing related to Direct Show for the playlist dialog (you can treat it just a simple dialog-based function).....
Is there anyone can give me some suggestions?
Thanks a lot!
|
|
|
|
|
I have a 3rd party program which contains a chat area. I am trying to create a function which sends a message to that chat. I have the handle to the parent window and the handle to the Edit window where you type. I am not having any trouble setting the text in the Edit window, my issue is sending the text. All I want to do is be able to send the box a simulated Return key press, but I'm having a lot of issues with it and can't seem to get it to work.
I spied the window and when a real Return is pressed, it generates two messages:
P WM_KEYDOWN nVirtKey:VK_RETURN cRepeat:1 ScanCode:1C fExtended: 0 fAltDown: 0 fRepeat: 0 fUp: 0<br />
<br />
P WM_KEYUP nVirtKey:VK_RETURN cRepeat:1 ScanCode:1C fExtended: 0 fAltDown: 0 fRepeat:1 fUp:1<br />
For KEYDOWN, the parameters are:
wParam: 0000000D
lParam: 001C0001
For KEYUP, the parameters are:
wParam: 0000000D
lParam: C01C0001
Given all this information, my current function looks like:
<br />
void say( const char* toSay )<br />
{<br />
HWND tempa = SetActiveWindow( hwnd );<br />
HWND tempw = SetFocus( chatBox );<br />
Sleep(500);<br />
SendMessage( chatBox, WM_SETTEXT, (WPARAM)0, (LPARAM)toSay );<br />
Sleep(1000);<br />
PostMessage( chatBox, WM_KEYDOWN, VK_RETURN, 0x001C0001 );<br />
Sleep(2000);<br />
PostMessage( chatBox, WM_KEYUP, VK_RETURN, 0xC01C0001 );<br />
Sleep(2000);<br />
SetFocus( tempw );<br />
SetActiveWindow( tempa );<br />
}
I have had very little success with this method. It will sometimes send the first message it gets but then will no longer send anything. It seems like this should be much simpler, as I'm sure it's a common need. Any help is greatly appreciated.
|
|
|
|
|
|
Thanks for the link Vikram, however it seems that there is a bug with that engine (and the user comments seem to confirm) that creates problems with XP.
From what I saw in the source of that project, I thought that this would work:
void say( const char* toSay )<br />
{<br />
if( !SetForegroundWindow( chatBox ) ){ cout << "COULD NOT SET CHATBOX TO ACTIVE" << endl; }<br />
Sleep(500);<br />
UINT scan = MapVirtualKey( VK_RETURN, 0 );<br />
Sleep(500);<br />
SendMessage( chatBox, WM_SETTEXT, (WPARAM)0, (LPARAM)toSay );<br />
Sleep(2000);<br />
keybd_event(VK_RETURN, scan, KEYEVENTF_EXTENDEDKEY | 0, 0 );<br />
Sleep(2000);<br />
keybd_event(VK_RETURN, scan, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);<br />
}
However, that doesn't seem to work. As in my previously posted function, the chatBox is set with the text and when VK_RETURN is sent it does clear, but it does not show up in the chat, it just gets cleared. I'm not sure why this is.
-- modified at 3:43 Saturday 17th December, 2005
|
|
|
|
|
how to destroy a CFormView Dialog from another CFormView Dialog
"Men never do evil so completely and cheerfully as when they do it from religious conviction"
-Pascal
|
|
|
|
|
Is there an article about creating an icon dynamically?? For example, like task manager does when you minimize it to tray, it displays CPU usage. Is there a way to draw a bitmap on memDC and then somehow convert it to HICON ??
thx
---
http://sprdsoft.cmar-net.org - We Sprd You Softly
Our site features contents and several images. All of this is very weird.
In the end, war is not about who's right, it's about who's left.
|
|
|
|
|
CreateIconIndirect() .
Use an all black bitmap as the mask.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Thanx PJ, will try
---
http://sprdsoft.cmar-net.org - We Sprd You Softly
Our site features contents and several images. All of this is very weird.
In the end, war is not about who's right, it's about who's left.
|
|
|
|
|
There's HIWORD and LOWORD macros for retreiving but what are for setting ?
--------------------------------
Human stupidity is infinite.
|
|
|
|
|
|
Umm...right. I knew it was something that obvious. Need to stop trying to do something at 1am.
--------------------------------
Human stupidity is infinite.
|
|
|
|