:紧急求救:小弟在2000下写的程序在98下用不了?????同样是微软出的操作系统,咱的程序执行起来的差距怎就那么大呢?(200分)

  • 主题发起人 主题发起人 大毛
  • 开始时间 开始时间
也许,但是不应该是D 版的问题。
有的时候窗体会出问题,但是这种情况极少。
 
实在不行,我这笨人还是用笨法子吧。
 
出错的时候可以考虑使用其他文本编辑器将dfm文件打开,然后修改一下错误的地方,就可以了。
 
过两天给大家来散分。
 
问题的症结已经找到,原来是我那个窗体中的DataTimePicker控件在作怪,在构造过程中就死了
出现"Invalid pointer operation",看了看一段帮助:
Description

TDateTimePicker is a visual component designed specifically for entering dates or times.
In dmComboBox date mode, it resembles a list box or combo box, except that the drop-down
list is replaced with a calendar illustration; users can select a date from the calendar.
Dates or times can also be selected by scrolling with Up and Down arrows and by typing.

Date-time picker ignores the BiDiMode setting for right-to-left reading, displaying dates
according to the system locale.
TDateTimePicker formats date and time values according to the date and time settings in the
Regional Settings of the Control panel on the user's system. Because TDateTimePicker is a
wrapper for a Windows control, these formats can be changed by changing the formatting
variables in the SysUtils unit. However, you can use the Windows API call DateTime_SetFormat
to programmatically specify these settings.

Note: The underlying Windows control is known to behave unpredictably when used to set dates
in 1752, the year English-speaking countries changed to the Gregorian calendar. Similar problems
may appear for different dates when a non-English locale is used. If an application may be
used to specify dates on or before the changeover in the current locale (for example, 1918 or
before in Russian locales), be sure to test the application using the dates affected.

大意是说:其格式设置必须调用Windows API函数通过编程来实现,而在我的程序里是在属性面板上修改的,
所以发生错误的,我理解的不知对不对?

用记事本打开其Dfm文件将Format= *********那行删除后,程序能顺利运行,
不过,我该如何通过编程达到我的目的:使DataTimePicker的 Format = yyyy年MM月dd日,
DateTime_SetFormat这函数怎么用啊?
 
问题已全部解决,感谢大家的参与。如下方式:
在有DateTimePicker控件的Form的OnCreate事件中加入
DateTime_SetFormat(DateTimePicker1.Handle,'yyyy年MM月dd日');
要注意,得在此单元内引入CommCtrl.
 
后退
顶部