David, The Shell function is a very simple function that simply runs another program, but does not provide any communication with that program. In order to synchronize the behavior of the calculator with the behavior of your form, you will need to find some way to identify the calculator as a 'process.' ' You can use the Windows Management Interface (WMI) to find the Calculator process. Then you can use SendKeys to send commands to the Calculator, such as 'Ctrl+C' to copy the value in the calculator display to the clipboard, from where you can use the clipboard functions in VB6 to 'paste' the value into a variable in your code. You can also use Win32 API functions (or SendKeys) to instruct the Calculator process to terminate.
That code would go in the FormClose event handler of your form. Meyers-Jouan -Original Message- From: davidssempijja via visualbasic-l mailto:[email protected] Sent: Thursday, 2010 February 25 05:51 To: Michael Meyers-Jouan Subject: visualbasic-l Calling a Calculator in VB 6.0 Posted by davidssempijja on Feb 25 at 5:51 AM I've used this code to call system calculator on VB form and it works.
In this video tutorial you will learn about how to make scientific advanced calculator in visual basic 6.0 step. This site contains CODES about visual basic, C++, HTML,and so on. Feel free to visit and follow this site for more updates-Thank you -Ninz. AVERAGE CALCULATOR USING VB 6.0 T. Simple Calculator using Visual basic.NET; sample of visual basic application with source cod.
But when i close the form the Calculator doesnot also close. Also want to the figures in the calcutor screen be assigned to the textbox so that they can be displayed. Private Sub Command2Click ' cmdExec is the name of the command button on any form. Dim RetVal RetVal = Shell('C: WINDOWS System32 calc.exe', 1) ' Run Calculator.
End Sub Any idea please Thank you David. The espression 'to call system calculator on VB form' is not accurate. The Calc program will be started in a completely separate process. I think your two requests contradict each other (or you have not elaborated enough on the latter request) If the form is closing, and it is telling Calc to close, then it is too late for the Calc result to be shown on the Form. Perhaps if you could elaborate on the latter request (displaying Calc result in your Form).
In the meantime here is some simple code that will open Calc, and then close it, as the Form is unloading -. Option Explicit Private Declare Function GetForegroundWindow Lib 'user32' As Long Private Declare Function SendMessage Lib 'user32' Alias 'SendMessageA' (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Const WMCLOSE = &H10 Private lnghWnd As Long Private Sub cmdStartClick Call Shell('calc', vbNormalFocus) DoEvents lnghWnd = GetForegroundWindow End Sub Private Sub FormUnload(Cancel As Integer) Call SendMessage(lnghWnd, WMCLOSE, 0, 0) End Sub. HTH, Rob davidssempijja via visualbasic-l wrote: Posted by davidssempijja on Feb 25 at 5:51 AM I've used this code to call system calculator on VB form and it works. But when i close the form the Calculator doesnot also close. Also want to the figures in the calcutor screen be assigned to the textbox so that they can be displayed. Private Sub Command2Click ' cmdExec is the name of the command button on any form. Dim RetVal RetVal = Shell('C: WINDOWS System32 calc.exe', 1) ' Run Calculator.
End Sub Any idea please Thank you David. Thankx let me try this David On Thu, Feb 25, 2010 at 6:01 PM, Michael Meyers-Jouan via visualbasic-l wrote: Posted by Michael Meyers-Jouan(Software Developer) on Feb 25 at 10:15 AM DavidThe Shell function is a very simple function that simply runs another program, but does not provide any communication with that program. In order to synchronize the behavior of the calculator with the behavior of your form, you will need to find some way to identify the calculator as a 'process.' ' You can use the Windows Management Interface (WMI) to find the Calculator process. Then you can use SendKeys to send commands to the Calculator, such as 'Ctrl+C' to copy the value in the calculator display to the clipboardfrom where you can use the clipboard functions in VB6 to 'paste' the value into a variable in your code. You can also use Win32 API functions (or SendKeys) to instruct the Calculator process to terminate. That code would go in the FormClose event handler of your form.
Michael S. Meyers-Jouan -Original Message- From: davidssempijja via visualbasic-l mailto:[email protected] Sent: Thursday, 2010 February 25 05:51 To: Michael Meyers-Jouan Subject: visualbasic-l Calling a Calculator in VB 6.0 Posted by davidssempijja on Feb 25 at 5:51 AM I've used this code to call system calculator on VB form and it works. But when i close the form the Calculator doesnot also close. Also want to the figures in the calcutor screen be assigned to the textbox so that they can be displayed.
Private Sub Command2Click ' cmdExec is the name of the command button on any form. Dim RetVal RetVal = Shell('C: WINDOWS System32 calc.exe', 1) ' Run Calculator. End Sub Any idea please Thank you David. Check this out. NV7/ From: Michael Meyers-Jouan via visualbasic-l mailto:[email protected] Sent: Thursday, February 25, 2010 7:01 AM To: randycaus Subject: RE: visualbasic-l Calling a Calculator in VB 6.0 Image removed by sender. Posted by Michael Meyers-Jouan (Software Developer) on Feb 25 at 10:15 AM Image removed by sender.
Mark this reply as helpfulMark as helpful David, The Shell function is a very simple function that simply runs another program, but does not provide any communication with that program. In order to synchronize the behavior of the calculator with the behavior of your form, you will need to find some way to identify the calculator as a 'process.' ' You can use the Windows Management Interface (WMI) to find the Calculator process. Then you can use SendKeys to send commands to the Calculator, such as 'Ctrl+C' to copy the value in the calculator display to the clipboard, from where you can use the clipboard functions in VB6 to 'paste' the value into a variable in your code. You can also use Win32 API functions (or SendKeys) to instruct the Calculator process to terminate. That code would go in the FormClose event handler of your form. Meyers-Jouan -Original Message- From: davidssempijja via visualbasic-l mailto:[email protected] Sent: Thursday, 2010 February 25 05:51 To: Michael Meyers-Jouan Subject: visualbasic-l Calling a Calculator in VB 6.0 Posted by davidssempijja on Feb 25 at 5:51 AM I've used this code to call system calculator on VB form and it works.
But when i close the form the Calculator doesnot also close. Also want to the figures in the calcutor screen be assigned to the textbox so that they can be displayed. Private Sub Command2Click ' cmdExec is the name of the command button on any form.
Dim RetVal RetVal = Shell('C: WINDOWS System32 calc.exe', 1) ' Run Calculator. End Sub Any idea please Thank you David.
Try this: Shell 'calc.exe', vbNormalFocus Regards Dilip Verma - On Thu, 25/2/10, randycaus via visualbasic-l wrote: From: randycaus via visualbasic-l Subject: RE: visualbasic-l Calling a Calculator in VB 6.0 To: 'DilipVerma' Date: Thursday, 25 February, 2010, 9:59 PM Posted by randycaus on Feb 25 at 11:33 AM Mark as helpful Check this out. NV7/ From: Michael Meyers-Jouan via visualbasic-l mailto:[email protected] Sent: Thursday, February 25, 2010 7:01 AM To: randycaus Subject: RE: visualbasic-l Calling a Calculator in VB 6.0 Image removed by sender. Posted by Michael Meyers-Jouan (Software Developer) on Feb 25 at 10:15 AM Image removed by sender. Mark this reply as helpfulMark as helpful David, The Shell function is a very simple function that simply runs another program, but does not provide any communication with that program. In order to synchronize the behavior of the calculator with the behavior of your form, you will need to find some way to identify the calculator as a 'process.' ' You can use the Windows Management Interface (WMI) to find the Calculator process. Then you can use SendKeys to send commands to the Calculator, such as 'Ctrl+C' to copy the value in the calculator display to the clipboard, from where you can use the clipboard functions in VB6 to 'paste' the value into a variable in your code.
You can also use Win32 API functions (or SendKeys) to instruct the Calculator process to terminate. That code would go in the FormClose event handler of your form. Meyers-Jouan -Original Message- From: davidssempijja via visualbasic-l mailto:[email protected] Sent: Thursday, 2010 February 25 05:51 To: Michael Meyers-Jouan Subject: visualbasic-l Calling a Calculator in VB 6.0 Posted by davidssempijja on Feb 25 at 5:51 AM I've used this code to call system calculator on VB form and it works. But when i close the form the Calculator doesnot also close. Also want to the figures in the calcutor screen be assigned to the textbox so that they can be displayed.
Private Sub Command2Click ' cmdExec is the name of the command button on any form. Dim RetVal RetVal = Shell('C: WINDOWS System32 calc.exe', 1) ' Run Calculator. End Sub Any idea please Thank you David.