|
i need help on how to make text scroll like in winamp does with the song title i seen a few classes that scrolled up i need right to left and maybe left to right.
|
|
|
|
|
Assuming you are having your text on a label, you can associate a control variable to that label and then use SetWindowPos() to set the window position in a for loop.(Keep changing the position of that window in any loop)
Alternatively See TextOut()/DrawText().
I hope that I made myself clear...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 23:50 Sunday 18th June, 2006
|
|
|
|
|
sorta clear im a noob and dont know what a label is yet
|
|
|
|
|
A label is a static control.You will have to change IDC_STATIC to associate control variable to it. After this follow the procedure mentioned in my previous post.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hallo
I have some project written and this is working fine. Now i have a base class not a abstract class and some derived.
Now i want to handle each derived class in a separate dll.
Now is this possible ?? And if so how to manage this ?? Do i have to make a lot of changes??
Thanks
Timen
|
|
|
|
|
You may have to add the base class in each DLL and derive the class from that base class..
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
I'm trying to use WriteConsoleOutput to print blocks of text to the screen (strings/streams). I would use WriteConsole() but then I have to move the cursor position after each line is printed and that isn't very elegant. I'm getting this error:
c:\Documents and Settings\John\My Documents\Visual Studio Projects\Testing_Win32_Console\Testing_Win32_Console.cpp(40): error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::allocator<_Ty>::value_type' (or there is no acceptable conversion)
with
[
_Ty=char
]
I know this is probably a really stupid question but I couldn't find any good examples of WriteConsoleOutput() in use on the internet, and I don't have anyone else's brain to pick.
The relevant line has a smiley next to it:
<br />
#include iostream
#include string<br />
#include windows.h<br />
<br />
using namespace std;<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
HANDLE hIn;<br />
HANDLE hOut;<br />
string TextToPrint;<br />
CHAR_INFO TemporaryBuffer[20];<br />
CONSOLE_SCREEN_BUFFER_INFO BufferInformation;<br />
COORD TextToWriteSize;<br />
COORD UpperLeftText;<br />
PSMALL_RECT DestCoords;<br />
<br />
hOut = GetStdHandle(STD_OUTPUT_HANDLE);<br />
hIn = GetStdHandle(STD_INPUT_HANDLE);<br />
GetConsoleScreenBufferInfo(hOut, &BufferInformation);<br />
TextToPrint = "It worked!";<br />
TextToWriteSize.X = TextToPrint.length();<br />
TextToWriteSize.Y = 1;<br />
UpperLeftText.X = 0;<br />
UpperLeftText.Y = 0;<br />
DestCoords->Top = 5;<br />
DestCoords->Left = 5;<br />
DestCoords->Right = 5 + TextToPrint.length();<br />
DestCoords->Bottom = 6;<br />
<br />
for(int i; i < 20; i++)<br />
TemporaryBuffer[i].Attributes = BufferInformation.wAttributes;<br />
<br />
for(int i; i < TextToPrint.length() - 1; i++)<br />
TemporaryBuffer[i].Char = TextToPrint[i]; :mad:<br />
<br />
WriteConsoleOutput(hOut, TemporaryBuffer, TextToWriteSize, UpperLeftText, DestCoords);<br />
<br />
cin.get();<br />
<br />
return 0;<br />
}<br />
-- modified at 16:13 Sunday 18th June, 2006
|
|
|
|
|
Hi,
There is alot wrong with your source code.
1.) PSMALL_RECT is a pointer, and you never assign it.
2.) In your for-loops, you need to assign the integer i a value. Modern ISO compliant compilers will not default to zero without bitterly complaining.
3.) In your second for-loop, you use a condition of (TextToPrint.length() - 1) which is incorrect. This will cause the last character to be omitted.
4.) Your assigning TemporaryBuffer[i].Char an incorrect string value.
Here is a repaired version that should work:
<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
HANDLE hIn;<br />
HANDLE hOut;<br />
string TextToPrint;<br />
CHAR_INFO TemporaryBuffer[20];<br />
CONSOLE_SCREEN_BUFFER_INFO BufferInformation;<br />
COORD TextToWriteSize;<br />
COORD UpperLeftText;<br />
SMALL_RECT DestCoords;<br />
<br />
hOut = GetStdHandle(STD_OUTPUT_HANDLE);<br />
hIn = GetStdHandle(STD_INPUT_HANDLE);<br />
GetConsoleScreenBufferInfo(hOut, &BufferInformation);<br />
TextToPrint = "It worked!";<br />
TextToWriteSize.X = TextToPrint.length();<br />
TextToWriteSize.Y = 1;<br />
UpperLeftText.X = 0;<br />
UpperLeftText.Y = 0;<br />
DestCoords.Top = 5;<br />
DestCoords.Left = 5;<br />
DestCoords.Right = 5 + TextToPrint.length();<br />
DestCoords.Bottom = 6;<br />
<br />
for(int i=0; i < 20; i++)<br />
TemporaryBuffer[i].Attributes = BufferInformation.wAttributes;<br />
<br />
for(int i=0; i < TextToPrint.length(); i++)<br />
{<br />
TemporaryBuffer[i].Char.AsciiChar = (char)TextToPrint[i];<br />
TemporaryBuffer[i].Char.UnicodeChar = (WCHAR)TextToPrint[i];<br />
}<br />
<br />
WriteConsoleOutput(hOut, TemporaryBuffer, TextToWriteSize, UpperLeftText, &DestCoords);<br />
<br />
cin.get();<br />
<br />
return 0;<br />
}<br />
<br />
Note: Your compiler will have Unicode or Ascii build environments. This version should work in both.
|
|
|
|
|
hello
I want to create a 2D 170*140 arrey with new .
I wrote :
float **safhe;
*safhe=new float[170];
for(int i=0;i<170;i++)
safhe[i]=new float[140];
but I dont know what is wrong
thank you
|
|
|
|
|
V_shr wrote: *safhe=new float[170];
You're dereferencing a pointer that you haven't assigned anything to yet. This is never what you want.
float **safhe;
<span style="color: Blue;">safhe=new float[170];</span><br style="color: Blue;">for(int i=0;i<170;i++)
safhe[i]=new float[140];
See the difference? Both *safhe and safhe[i] dereference a pointer, with safhe[i] effectively adding i * sizeof(float) to the address before dereferencing.
|
|
|
|
|
hello
thank you for your help
BUT
when I change that to "safhe=new float[170]" this error apears :
cannot convert 'float *' to 'float * *'
???
|
|
|
|
|
Sorry, missed that bit. You don't want to allocate an array of 170 float s, you want 170 float* . So, do something like:
safhe = new float*[170];<br />
<br />
|
|
|
|
|
|
Here is an easy way to 'new' a 2D array of ints.
<br />
TCHAR szBuff[32];<br />
const size_t Size = 10;<br />
int (*TwoDimensional)[Size][Size] = new int[Size][Size][Size];<br />
<br />
for(int i =0; i < Size;i++)<br />
{<br />
for (int y = 0; y < Size;y++)<br />
{<br />
*TwoDimensional[i][y] = y;<br />
}<br />
}<br />
<br />
for(int i =0; i < Size;i++)<br />
{<br />
for (int y = 0; y < Size;y++)<br />
{<br />
_stprintf(szBuff, _T("row %d col %d"), i, *TwoDimensional[i][y]);<br />
MessageBox(szBuff, _T("TwoDimension"), MB_OK);<br />
}<br />
}<br />
<br />
delete[] TwoDimensional;<br />
|
|
|
|
|
int (*TwoDimensional)[Size][Size] = new int[Size][Size][Size];
Is it 2D or 3D??
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi All,
I need to export some leaf from registry in runtime from my application.
I Dont know how to do it - Can someone help me ??
P.S : i need also to do marge in runtime....
|
|
|
|
|
|
See Here[^] maybe it is some helpful to you
whitesky
|
|
|
|
|
Hi,
I want to make a custom dropdown control, and created a WS_POPUP-style window for the dropdown list. The problem is when I click on the dropdownlist-window the parent window looses its focus and gets gray.
Does someone know how to create such a window that doesn't steal the focus from its parent?
Bye,
Chris
|
|
|
|
|
Zoomby wrote: Does someone know how to create such a window that doesn't steal the focus from its parent?
Sure. Don't ever give it focus, either explicitly (via SetFocus() ) or implicitly (by letting the default message handler call SetFocus() ). Overriding WM_LBUTTONDOWN will probably take care of things for you (but if you have child controls then you'll need to think about those as well). If you've left any non-client area on your pop-up, you'll also want to override WM_NCLBUTTONDOWN .
Finally, if you aren't already using it, use the WS_EX_TOOLWINDOW style to keep your pop-up out of the
task list.
|
|
|
|
|
Hi, thanks for the answer.
"by letting the default message handler call SetFocus()"
"Overriding WM_LBUTTONDOWN will probably take care of things for you"
Could you specify that a little bit?
|
|
|
|
|
Zoomby wrote: "Overriding WM_LBUTTONDOWN will probably take care of things for you"
Could you specify that a little bit?
The default behavior for WM_LBUTTONDOWN is to set focus to the window. So override it, don't set focus yourself, and don't call the default handler.
|
|
|
|
|
I think it's not possible to change the focus-behavior with WM_LBUTTONDOWN alone.
I'll try to describe it again:
What I want is a top-level window that don't gets activated when you use, click on it etc. That means, the parent windows title bar should not be grayed. Consider a (context-)menu for example. When you use it, its (parent) window doesn't get deactivated (I assume that menus are implemented as top-level windows, correct me if I'm wrong)
|
|
|
|
|
Zoomby wrote: I think it's not possible to change the focus-behavior with WM_LBUTTONDOWN alone.
Well, i've done it. You need to keep in mind what you're going for though; for instance, when you first create the window, show it by calling ShowWindow(SW_SHOWNOACTIVATE) .
Alternately, you could try something like the technique demonstrated in this article...
|
|
|
|
|
"Well, i've done it"
Well, how?
Could you tell me how to do it concretely? I told you, I've tried several thinks, and I have no idea how to do it.
|
|
|
|