SOLVED
Home

API call AllocConsole no longer works in Access 2016 on Windows 10

%3CLINGO-SUB%20id%3D%22lingo-sub-88250%22%20slang%3D%22en-US%22%3EAPI%20call%20AllocConsole%20no%20longer%20works%20in%20Access%202016%20on%20Windows%2010%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-88250%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20windows%20API%20call%26nbsp%3BAllocConsole%20no%20longer%20seems%20to%20work%20in%20VBA%20Access%202016%20on%20Windows%2010.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20functions%20correctly%20on%20Windows%207%20with%20Access%202016%20and%20I've%20been%20googling%20for%20the%20past%20few%20days%20tring%20to%20find%20an%20answer.%20The%20code%20is%20a%20follows...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPrivate%20Declare%20Function%20AllocConsole%20Lib%20%22kernel32%22%20()%20As%20Long%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFunction%20main_loop()%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20AllocConsole%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20Do%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BDoEvents%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B'do%20other%20stuff%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3BLoop%20While%20True%3C%2FP%3E%3CP%3EEnd%20Function%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAllocConsole%20always%20return%200%20on%20windows%2010.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERunning%20Access%20as%20an%20Administrator%20and%20enabing%20macros%20and%20adding%20trust%20centre%20setting%20etc%20have%20no%20effect.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20work%20around%20to%20get%20a%20console%20window%20to%20open%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3ERob%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-88250%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E2016%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-224150%22%20slang%3D%22en-US%22%3ERe%3A%20API%20call%20AllocConsole%20no%20longer%20works%20in%20Access%202016%20on%20Windows%2010%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-224150%22%20slang%3D%22en-US%22%3E%3CP%3EI%20found%20a%20work%20around%20by%20using%20Access%202013%20on%20Windows%2010.%20The%26nbsp%3BAllocConsole%20function%20then%20works!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-223624%22%20slang%3D%22en-US%22%3ERe%3A%20API%20call%20AllocConsole%20no%20longer%20works%20in%20Access%202016%20on%20Windows%2010%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-223624%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20may%20be%20a%20long%20shot%2C%20but%20have%20you%20verified%20that%20this%20API%20is%20actually%20available%20on%20the%20Windows%2010%20computer%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-221842%22%20slang%3D%22en-US%22%3ERe%3A%20API%20call%20AllocConsole%20no%20longer%20works%20in%20Access%202016%20on%20Windows%2010%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-221842%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20similar%20problem%20in%20my%20C%23%20windows%20app%20where%20I%20allocate%20a%20console%20window.%20The%20console%20window%20shows%2C%20but%26nbsp%3Bthe%20output%20stream%20and%20tracing%20no%20longer%20works%20on%20windows%2010.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHave%20you%20found%20a%20solution%20to%20your%20problem%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Rob Boardley
New Contributor

The windows API call AllocConsole no longer seems to work in VBA Access 2016 on Windows 10.

 

It functions correctly on Windows 7 with Access 2016 and I've been googling for the past few days tring to find an answer. The code is a follows...

 

Private Declare Function AllocConsole Lib "kernel32" () As Long

 

Function main_loop()

    AllocConsole

    Do

         DoEvents

         'do other stuff

   Loop While True

End Function

 

AllocConsole always return 0 on windows 10.

 

Running Access as an Administrator and enabing macros and adding trust centre setting etc have no effect.

 

Is there a work around to get a console window to open?

 

Thanks

Rob

    

 

 

3 Replies

I have a similar problem in my C# windows app where I allocate a console window. The console window shows, but the output stream and tracing no longer works on windows 10.

 

Have you found a solution to your problem?

This may be a long shot, but have you verified that this API is actually available on the Windows 10 computer? 

Solution

I found a work around by using Access 2013 on Windows 10. The AllocConsole function then works!

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies