Hi All:
This program tells the date and time in a window and also prints it in
a dos box. If I build the pdb (debug file info) It does not print in a
dos box, it hangs some where after the window, the process #
goes up by 1[Windows Task Manager] and it hangs and you
have to Manually kill the process [showtime.exe]
I have not changed the source code.
project- console Assembler and link works- showtime
help - debug build all don't work? -show
; REM SHOWTIME.ASM 2:12 PM 7/28/2006
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
include \masm32\include\user32.inc
include \masm32\include\msvcrt.inc
include \masm32\macros\macros.asm
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\msvcrt.lib
.data
LOCALE_SYSTEM_DEFAULT equ 0
hStdOut dd 0; Standard Console output
written dd 0;
dlen dd 0;
stm SYSTEMTIME<>
org stm; Must be eight words
wYear dw 0
wMonth dw 0
wToDay dw 0 ; Sunday 0 to Saturday 6
wDay dw 0
wHour dw 0
wMinute dw 0
wSecond dw 0
wKsecond dw 0
date_buf db 40 dup (?)
time_buf db 20 dup (?)
pzCaption db "Show Time",0
dateformat db " dddd, MMMM, dd, yyyy", 0
timeformat db "hh:mm:ss tt",0
cr_lf db 13,10
.code
start:
invTime:
invoke GetLocalTime, addr stm
; Print Date
public invFor
invFor:
invoke GetDateFormat, LOCALE_SYSTEM_DEFAULT, NULL, \
ADDR stm, ADDR dateformat, ADDR date_buf, 40
mov ecx, offset date_buf
add ecx, eax; add length returned by GetDateFormat
dec ecx
mov byte ptr [ecx], ' ';replace null with space
inc ecx
; Print Time!
public invPrt
invPrt:
invoke GetTimeFormat, LOCALE_SYSTEM_DEFAULT, NULL, \
ADDR stm, ADDR timeformat, ecx, 20
mov esi, offset date_buf
xor ecx,ecx
@@:; Find Length of date_buf
mov al,[esi]
inc esi
inc ecx
and al,al
jnz @b
dec ecx
mov [dlen],ecx
public invMess
invMess:
invoke MessageBox, NULL, addr date_buf, addr pzCaption, MB_OK
public invS
invS:
invoke GetStdHandle, STD_OUTPUT_HANDLE
mov hStdOut, eax
public invW
invW:
invoke WriteFile,
eax,
ADDR date_buf,
dlen,
ADDR written,
0
invoke WriteFile, hStdOut, ADDR cr_lf, 2, ADDR written, 0
public waitkey
waitkey:
inkey
invoke ExitProcess,NULL
end start
[attachment deleted by admin]
One thing I can think of is that SHOW.EXE is built as a GUI program and they don't get a console allocated to them...
Hi Sinsi:
I think you are right could explain why the dos box doesn't open up
when I run show.exe.