如何编写控制台程序,在WINDOWS里的DOS窗口里显示闪烁的字符(200分)

  • 主题发起人 主题发起人 weiliu
  • 开始时间 开始时间
W

weiliu

Unregistered / Unconfirmed
GUEST, unregistred user!
要求:不许用人为的方法进行交替显示(即在相同的位置上显示一个空格再显示一个字符然后再显示一个空格......的方法)。<br>我试过用API函数SetConsoleTextAttribute进行不同颜色的组合,结果没有发现可以使字符闪烁的组合,也没有看到其它的API函数可以有字符闪动的功能。
 
没有人能解决吗?大富翁的高人在吗?
 
要求:不许用人为的方法进行交替显示(即在相同的位置上显示一个空格再显示一个字符然后再显示一个空格......的方法)。<br><br><br>系统本身用的方法就是这种吧<br><br>有何不行呢,那怕是长字符串也可以减一个加一个,能实现就行了
 
to 楼上的,<br>主要是嫌麻烦,记得以前在DOS下编程的时候,实现字符的闪烁易如反掌,比如BASIC程序里的COLOR函数指定到某一个数字时,自符就自己会闪烁了,我在WIN98里做了实验,用老的GWBASIC,在全屏DOS方式下可以闪烁字符,而把它切换成DOS窗口,原先闪烁的字符就不闪了,而再换到全屏DOS又可以闪了,因此严重怀疑WINDOWS是否把DOS里的字符闪烁属性给另外定义了。
 
大家帮忙看看啊,是否跟ANSI.SYS有关系呢?
 
这个问题好解决啊,精通dos的都没有问题的
 
to lxggc,<br>既然好解决,老大你给个方案吧。
 
SetConsoleTextAttribute &nbsp;里没有闪烁的组合.<br><br>你先看有没有现成的有这功能的东东.也许本来就不能闪烁呢?
 
to QSmile,<br>因为我还有很老的DOS版本的BASICA或GWBASIC,我在WINDOWS里的DOS窗口下试过,在WIN98里就有字符闪烁的,但在WIN2K/XP里就没有了,相信是WINDOWS本身失去了在DOS里闪烁的功能,但是我以前曾经看过资料,ANSI.SYS能影响到这些。
 
INFO: Setting the Console Configuration <br><br>--------------------------------------------------------------------------------<br>The information in this article applies to:<br><br>Microsoft Win32 Application Programming Interface (API), used with:<br>the operating system Microsoft Windows NT, versions 3.1, 3.5, 4.0 <br>the operating system Microsoft Windows 2000<br><br>--------------------------------------------------------------------------------<br><br><br>SUMMARY<br>To create a command prompt with custom features such as <br><br>Settings<br>Fonts<br>Screen Size and Position<br>Screen Colors<br><br>create a new entry in the Program Manager for CMD.EXE (suppose that the description is CUSTOM), or a shortcut named custom if you are using NT4 or later), choose these items from the CMD system menu, and select Save Configuration in each dialog box. The settings are saved in the registry under <br> &nbsp; HKEY_CURRENT_USER/ <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console/ <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; custom <br>and are used when starting the CUSTOM command prompt from the Program Manager or when specifying: <br>start &quot;custom&quot; <br>This behavior is really a convenient side effect of <br>start &lt;string&gt; <br>which sets the title in the window title bar. When you create a new console window with the START command, the system looks in the registry and tries to match the title with one of the configurations stored there. If it cannot find it, it defaults to the values stored in: <br><br><br> &nbsp; HKEY_CURRENT_USER/ <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console/ <br> &nbsp; &nbsp; &nbsp; Configuration <br>This functionality can be duplicated in your own applications using the registry application programming interface (API). <br><br>For more information, please see the &quot;Registry and Initialization Files&quot; overview and the REGISTRY sample. <br><br>Additional query words: 3.10 3.50 <br><br> <br>SetConsoleWindowInfo<br>The SetConsoleWindowInfo function sets the current size and position of a console screen buffer's window. <br><br>BOOL SetConsoleWindowInfo(<br> &nbsp;HANDLE hConsoleOutput, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// handle to screen buffer<br> &nbsp;BOOL bAbsolute, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // coordinate type<br> &nbsp;CONST SMALL_RECT *lpConsoleWindow // window corners<br>);<br>Parameters<br>hConsoleOutput <br>[in] Handle to a console screen buffer. The handle must have GENERIC_WRITE access. <br>bAbsolute <br>[in] Specifies how the coordinates in the structure pointed to by the lpConsoleWindow parameter are used. If bAbsolute is TRUE, the coordinates specify the new upper-left and lower-right corners of the window. If it is FALSE, the coordinates are offsets to the current window-corner coordinates. <br>lpConsoleWindow <br>[in] Pointer to a SMALL_RECT structure that contains values that determine the new upper-left and lower-right corners of the window. <br>Return Values<br>If the function succeeds, the return value is nonzero.<br><br>If the function fails, the return value is zero. To get extended error information, call GetLastError. <br><br>Remarks<br>The function fails if the specified window rectangle extends beyond the boundaries of the screen buffer. This means that the Top and Left members of the lpConsoleWindow rectangle (or the calculated top and left coordinates, if bAbsolute is FALSE) cannot be less than zero. Similarly, the Bottom and Right members (or the calculated bottom and right coordinates) cannot be greater than (screen buffer height – 1) and (screen buffer width – 1), respectively. The function also fails if the Right member (or calculated right coordinate) is less than or equal to the Left member (or calculated left coordinate) or if the Bottom member (or calculated bottom coordinate) is less than or equal to the Top member (or calculated top coordinate). <br><br>For consoles with more than one screen buffer, changing the window location for one screen buffer does not affect the window locations of the other screen buffers. <br><br>To determine the current size and position of a screen buffer's window, use the GetConsoleScreenBufferInfo function. This function also returns the maximum size of the window, given the current screen buffer size, the current font size, and the screen size. The GetLargestConsoleWindowSize function returns the maximum window size given the current font and screen sizes, but it does not consider the size of the screen buffer. <br><br>SetConsoleWindowInfo can be used to scroll the contents of the screen buffer by shifting the position of the window rectangle without changing its size.
 
后退
顶部