Hi Michael,
I want the DOS window not to appear at all (when my console application (the
shortcut) is called from task manager). My application only send a MSGBOX
when needed.
Could you give me more information about ShowWindow in Windows API ? I have
no idea what it is. I am very new in VB under Windows. And I like simple
things...
Below is a complete listing of the application.
--
Super Basic programmer under DOS since 1983. Absolutely dummy VB.NET
programmer under Windows !
"Michael D. Ober" wrote:
Do you want the window to appear minimized or not appear at all. In either
case, look up ShowWindow in the Windows API.
Mike Ober.
"Marcel Saucier" <Ma***********@ discussions.mic rosoft.comwrote in message
news:91******** *************** ***********@mic rosoft.com...
I have written a Console Application then created a shortcut to it on my
desktop. I was able to minimize the DOS window when I click my shortcut so
I
dont see anymore the DOS window
But, using Task Manager to run the shortcut, I am not able to get rid of
(minimize) the DOS window.
Is there somebody that is aware of this problem ?
My application is an agenda, so Task Manager runs it every 15 minutes, to
check for appointments. It would be nice not to see that DOS window every
time the application is running.
Marcel
--
Super Basic programmer under DOS since 1983. Absolutely dummy VB.NET
programmer under Windows !
Imports System.Globaliz ation
Module Module1
Dim I As Integer
Dim J As Integer
Dim K As Integer
Dim DAY_INT As Integer
Dim TIME_INT As Integer
Dim CD As String
Dim LAST_RUN_DATE As String
Dim CT As String
Dim LAST_RUN_TIME As String
Dim LBL(15) As String
Dim MESSAGE As String
Dim PARM_CONTROL_RE C As String
Dim PARM_LANGUAGE As String
Dim PARM_DAYS_SHOWN As String = "30"
Dim PARM_TAB_DAYS As String = "28-21-14-07-01-00"
Dim PARM_TAB_TIME As String = "40"
Dim PARM_USERS As String = "MS-DS"
Dim ET(20) As String
Dim FT(20) As String
Dim ST(20) As String
Dim CALL_MAIN As Boolean = False
Dim WEEK_DAY As Boolean = False
Dim DATE_CURR As Date
Dim DATE_REC As Date
Dim TIME_CURR As DateTime
Dim TIME_REC As DateTime
Dim CULTURE_INFO As CultureInfo = CultureInfo.Cur rentUICulture '
"en-US"...
Sub Main()
If Mid(CULTURE_INF O.ToString, 1, 2) = "en" Then PARM_LANGUAGE = "E"
Else PARM_LANGUAGE = "F"
CD = Mid(DateAndTime .DateString, 7, 4) & "-" &
Mid(DateAndTime .DateString, 1, 2) & "-" & Mid(DateAndTime .DateString, 4, 2)
CT = Mid(DateAndTime .TimeString, 1, 5)
DATE_CURR = CD
TIME_CURR = CT
If Mid(CT, 4, 2) = "00" Then Beep()
Call R1400_READ_RUN_ CONTROL()
Call R1000_LANGUAGE_ TEXT()
Call R1150_READ_FILE ()
DAY_INT = DateDiff(DateIn terval.Day, DATE_CURR, #12/31/2007#) : Call
R1100_CHECK_FOR _WEEK_DAYS()
For I = 1 To 15
If LBL(I) = "" Then Exit For
DATE_REC = Mid(LBL(I), 1, 10)
TIME_REC = Mid(LBL(I), 14, 5)
DAY_INT = DateDiff(DateIn terval.Day, DATE_CURR, DATE_REC)
TIME_INT = DateDiff(DateIn terval.Minute, TIME_CURR, TIME_REC)
If DATE_REC = "2007-12-31" And CT = TIME_REC And WEEK_DAY = True
Then DAY_INT = -100 : Call R1200_MESSAGE() : Exit For
For J = 1 To Len(PARM_TAB_DA YS) Step 3
If DAY_INT = Val(Mid(PARM_TA B_DAYS, J, 2)) Then MESSAGE =
ST(2) & RTrim(Mid(PARM_ TAB_DAYS, J, 2)) & ST(3) : Call R1200_MESSAGE() : Exit
For
Next
If DAY_INT < 0 And DAY_INT -100 Then Call R1200_MESSAGE()
Next
Call R1500_WRITE_NOT _RUNNING()
If CALL_MAIN = True Then If Dir("C:\REMIND_ M.EXE") = "" Then
Shell("C:\Docum ents and Settings\MARCEL SAUCIER\My Documents\Visua l Studio
2005\Projects\R EMIND_M\REMIND_ M\bin\Release\R EMIND_M.exe",
AppWinStyle.Nor malFocus) Else Shell("C:\REMIN D_M.exe",
AppWinStyle.Nor malFocus)
End Sub
Public Sub R1000_LANGUAGE_ TEXT()
ET(1) = "ENGLISH"
FT(1) = "FRANÇAIS"
ET(2) = "In "
FT(2) = "Dans "
ET(3) = " DAYS, on the "
FT(3) = " JOURS, le "
ET(4) = "You have MISSED an appointment, on the "
FT(4) = "Vous avez MANQUÉ un rendez-vous, le "
ET(5) = "MORE THAN 15 ENTRIES IN FILE..."
FT(5) = "PLUS DE 15 ENTRÉES AU FICHIER..."
ET(6) = "YOU HAVE AN APPOINTMENT TODAY !!!, on the "
FT(6) = "VOUS AVEZ UN RENDEZ-VOUS AUJOURD'HUI !!!, le "
ET(7) = "You have an appointment TOMORROW, on the "
FT(7) = "Vous avez un rendez-vous DEMAIN, le "
If PARM_LANGUAGE = "E" Then For I = 1 To 20 : ST(I) = ET(I) : Next I
Else For I = 1 To 20 : ST(I) = FT(I) : Next I
End Sub
Public Sub R1100_CHECK_FOR _WEEK_DAYS()
For J = DAY_INT To -7 Step -7
If J <= 7 And J >= 3 Then WEEK_DAY = True : Exit Sub
Next
End Sub
Public Sub R1150_READ_FILE ()
If Dir("C:\REMINDE R.TXT") = "" Then Exit Sub
FileOpen(1, "C:\REMINDER.TX T", OpenMode.Input)
I = 0
While Not EOF(1)
I = I + 1
If I 15 Then MsgBox(ST(5)) : Exit While
LBL(I) = LineInput(1)
End While
FileClose(1)
End Sub
Public Sub R1200_MESSAGE()
If DAY_INT 0 And CD = LAST_RUN_DATE Then Exit Sub
If DAY_INT = 0 And CD = LAST_RUN_DATE Then If TIME_INT >
Val(PARM_TAB_TI ME) Then Exit Sub
If DAY_INT = 1 Then MESSAGE = ST(7)
If DAY_INT = 0 And TIME_INT >= 0 Then MESSAGE = ST(6)
If (DAY_INT = 0 And TIME_INT < 0) Or (DAY_INT < 0 And DAY_INT >
-100) Then MESSAGE = ST(4)
If (DAY_INT = 0 And TIME_INT <= 0) Or (DAY_INT < 0 And DAY_INT >
-100) Then CALL_MAIN = True
If DAY_INT = -100 Then MsgBox(Mid(LBL( I), 12)) Else MsgBox(MESSAGE &
LBL(I))
End Sub
Public Sub R1400_READ_RUN_ CONTROL()
If Dir("C:\REMIND_ P.TXT") = "" Then Call R1600_WRITE_RUN NING() :
Exit Sub
FileOpen(1, "C:\REMIND_P.TX T", OpenMode.Input)
PARM_CONTROL_RE C = LineInput(1)
PARM_LANGUAGE = LineInput(1)
PARM_DAYS_SHOWN = LineInput(1)
PARM_TAB_DAYS = LineInput(1)
PARM_TAB_TIME = LineInput(1)
PARM_USERS = LineInput(1)
FileClose(1)
LAST_RUN_DATE = Mid(PARM_CONTRO L_REC, 5, 10)
LAST_RUN_TIME = Mid(PARM_CONTRO L_REC, 18, 5)
If Mid(PARM_CONTRO L_REC, 1, 1) = "0" Then Call R1600_WRITE_RUN NING()
Else End
End Sub
Public Sub R1500_WRITE_NOT _RUNNING()
PARM_CONTROL_RE C = "0" & " * " & CD & " * " & CT
Call R1700_WRITE_FIL E()
End Sub
Public Sub R1600_WRITE_RUN NING()
PARM_CONTROL_RE C = "1" & " * " & CD & " * " & CT
Call R1700_WRITE_FIL E()
End Sub
Public Sub R1700_WRITE_FIL E()
FileOpen(1, "C:\REMIND_P.TX T", OpenMode.Output )
Print(1, PARM_CONTROL_RE C & Chr(13) & Chr(10))
Print(1, PARM_LANGUAGE & Chr(13) & Chr(10))
Print(1, PARM_DAYS_SHOWN & Chr(13) & Chr(10))
Print(1, PARM_TAB_DAYS & Chr(13) & Chr(10))
Print(1, PARM_TAB_TIME & Chr(13) & Chr(10))
Print(1, PARM_USERS & Chr(13) & Chr(10))
FileClose(1)
End Sub
End Module