|
-
Mar 1st, 2005, 02:39 PM
#1
Thread Starter
Lively Member
message
I have a process that runs and takes a long time.
I would like to display a message and change the cursor while the user waits.
Wht kind of message box or other feature could i use to do this and how would i fit it in with my code?
This is the code for the sub procedure:
Public Sub ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ReturnValue
' Initialize the STARTUPINFO structure:
start.dwFlags = STARTF_USESHOWWINDOW
start.cb = Len(start)
start.wShowWindow = 6
' Start the shelled application:
ReturnValue = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
' Wait for the shelled application to finish:
Do
ReturnValue = WaitForSingleObject(proc.hProcess, 0)
DoEvents
Loop Until ReturnValue <> 258
ReturnValue = CloseHandle(proc.hProcess)
End Sub
Last edited by smileyface5; Mar 2nd, 2005 at 06:28 AM.
-
Mar 1st, 2005, 03:36 PM
#2
Re: message
You dont want to use a msgbox since that will halt the execution of your code until the msgbox
is clicked and dismissed. Try creating a small form to use as a message with no buttons.
VB Code:
'...
'...
' Wait for the shelled application to finish:
frmMessage.Show
MousePointer = vbHourGlass
Do
ReturnValue = WaitForSingleObject(proc.hProcess, 0)
DoEvents
Loop Until ReturnValue <> 258
frmMessage.Hide
Unload frmMessage
MousePointer = vbNormal
'...
'...
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 1st, 2005, 06:39 PM
#3
Thread Starter
Lively Member
Re: message
ive done this and the message comes up however it stays there and nothing happens.i tried putting a msgbox directly after it and it doesnt pop up so the code obviously stops there.
any ideas how i could fix this?
-
Mar 1st, 2005, 07:04 PM
#4
Re: message
It stops on what line of code?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 1st, 2005, 08:26 PM
#5
Thread Starter
Lively Member
Re: message
frmMessage.Show
'I put a message box here and it didnt display so it is not running past the line before this
MousePointer = vbHourGlass
Do
ReturnValue = WaitForSingleObject(proc.hProcess, 0)
DoEvents
Loop Until ReturnValue <> 258
frmMessage.Hide
Unload frmMessage
MousePointer = vbNormal
-
Mar 1st, 2005, 09:03 PM
#6
Re: message
Try ...
VB Code:
frmMessage.Show vbModeless
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 2nd, 2005, 06:26 AM
#7
Thread Starter
Lively Member
Re: message
perfect thanks a million!!
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
|