By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,344 Members | 1,139 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,344 IT Pros & Developers. It's quick & easy.

The DOS window in a Console Application

P: n/a
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 !
Nov 8 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a

Marcel Saucier wrote:
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.
Isn't that what .pif files are for?

B.

Nov 8 '06 #2

P: n/a
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.microsoft.comwrote in message
news:91**********************************@microsof t.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 !


Nov 9 '06 #3

P: n/a
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.microsoft.comwrote in message
news:91**********************************@microsof t.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.Globalization
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_REC 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.CurrentUICulture '
"en-US"...

Sub Main()

If Mid(CULTURE_INFO.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(DateInterval.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(DateInterval.Day, DATE_CURR, DATE_REC)
TIME_INT = DateDiff(DateInterval.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_DAYS) Step 3
If DAY_INT = Val(Mid(PARM_TAB_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:\Documents and Settings\MARCEL SAUCIER\My Documents\Visual Studio
2005\Projects\REMIND_M\REMIND_M\bin\Release\REMIND _M.exe",
AppWinStyle.NormalFocus) Else Shell("C:\REMIND_M.exe",
AppWinStyle.NormalFocus)
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:\REMINDER.TXT") = "" Then Exit Sub
FileOpen(1, "C:\REMINDER.TXT", 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_TIME) 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_RUNNING() :
Exit Sub

FileOpen(1, "C:\REMIND_P.TXT", OpenMode.Input)
PARM_CONTROL_REC = 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_CONTROL_REC, 5, 10)
LAST_RUN_TIME = Mid(PARM_CONTROL_REC, 18, 5)
If Mid(PARM_CONTROL_REC, 1, 1) = "0" Then Call R1600_WRITE_RUNNING()
Else End
End Sub
Public Sub R1500_WRITE_NOT_RUNNING()
PARM_CONTROL_REC = "0" & " * " & CD & " * " & CT
Call R1700_WRITE_FILE()
End Sub
Public Sub R1600_WRITE_RUNNING()
PARM_CONTROL_REC = "1" & " * " & CD & " * " & CT
Call R1700_WRITE_FILE()
End Sub
Public Sub R1700_WRITE_FILE()
FileOpen(1, "C:\REMIND_P.TXT", OpenMode.Output)
Print(1, PARM_CONTROL_REC & 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

Nov 9 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.