|
-
Feb 18th, 2016, 09:02 AM
#7
Re: Is it possible to do a non-blocking console read?
 Originally Posted by dilettante
I didn't think you needed to, but it may make sense to call CloseHandle() on the StdIO handles on exit.
Somebody in the Community Additions section of the GetStdHandle function's documentation thinks it may not be necessary:
 Originally Posted by BlueViper02
Typically, do not close the returned handle
It is not a duplicate handle, it is the real thing, so think twice before closing it 
BTW, The trick has shared an undocumented .VBP section tip that enables a Standard EXE project to be compiled as a console application (or standard DLL) without requiring post-processing of the EXE or use of IDE add-ins that hook into the build process:
Code:
Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\Windows\system32\stdole2.tlb#OLE Automation
Module=Module1; Module1.bas
Startup="Sub Main"
ExeName32="ConEater.exe"
Command32=""
Name="ConEater"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="BVO Computing Services"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
[VBCompiler]
LinkSwitches=/SUBSYSTEM:CONSOLE
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|