|
-
Aug 22nd, 2006, 06:50 AM
#1
[RESOLVED] Shell Problem
Hi all,
I am using shell and wait api to execute some exe.But the problem is that it gives a minize,maximize and close Button.If the user Press the close button, the process get affected.Is it able to hide the close button in shell and wait function.
Thanks in Advance
-
Aug 22nd, 2006, 06:53 AM
#2
Re: Shell Problem
You can use RemoveMenu API to remove the Close button from the Window? Or a better way would be hide it from the User.
Last edited by Shuja Ali; Aug 22nd, 2006 at 07:28 AM.
Reason: Corrected as per JR's comments
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Aug 22nd, 2006, 06:54 AM
#3
Re: Shell Problem
Dear RRN78,
I think you are wrong.Please the read the post.
-
Aug 22nd, 2006, 07:01 AM
#4
PowerPoster
Re: Shell Problem
remove it in your program, or the external process?
-
Aug 22nd, 2006, 07:01 AM
#5
Re: Shell Problem
I am running a external process.;
-
Aug 22nd, 2006, 07:06 AM
#6
Re: Shell Problem
 Originally Posted by danasegarane
I am running a external process.;
Did you take a look at my Post #3
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Aug 22nd, 2006, 07:12 AM
#7
Re: Shell Problem
dear Suja,
Please give an example for that API
-
Aug 22nd, 2006, 07:14 AM
#8
Hyperactive Member
Re: Shell Problem
Would you like the new process to be completely hidden, or do you need it to be visible but tamperproof? Is it a windowed process, or a CMD dos app?
-
Aug 22nd, 2006, 07:22 AM
#9
Re: Shell Problem
It will be better if you it is hidden also.
-
Aug 22nd, 2006, 07:23 AM
#10
Re: Shell Problem
The better way would be to Hide the process from the User. And regarding your example, if you do a search here for RemoveMenu API you will get 100s of examples.
Also check www.allapi.net
Last edited by Shuja Ali; Aug 22nd, 2006 at 07:29 AM.
Reason: Corrected as per JR's comments
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Aug 22nd, 2006, 07:24 AM
#11
Re: Shell Problem
Please Suggest the way of hidding the shell and wait process
-
Aug 22nd, 2006, 07:24 AM
#12
Re: Shell Problem
There is no API called RemoveSystemMenu, the name of the function is simply RemoveMenu. You just need to get the handle of the system menu first which you do with a call to GetSystemMenu. You'll need to know the hWnd of the window from which you want to remove the menu item. Since I don't know how you launch your application I can't help you with that more than that you could use FindWindow to get it. But there might be other ways depending on how you shell the app. Anyway when you know the hWnd you can use code simular to the following:
VB Code:
Private Declare Function GetSystemMenu Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal bRevert As Long _
) As Long
Private Declare Function RemoveMenu Lib "user32.dll" ( _
ByVal hMenu As Long, _
ByVal nPosition As Long, _
ByVal wFlags As Long _
) As Long
Private Const SC_CLOSE As Long = &HF060&
Private Const MF_BYCOMMAND As Long = &H0&
Public Sub RemoveClose(ByVal hWnd As Long)
'Remove the Close command from the window associated with the hWnd
'passed as the argument.
Dim hMenu As Long
hMenu = GetSystemMenu(hWnd, 0)
If hMenu Then
Call RemoveMenu(hMenu, SC_CLOSE, MF_BYCOMMAND)
End If
End Sub
-
Aug 22nd, 2006, 07:25 AM
#13
Re: Shell Problem
 Originally Posted by danasegarane
It will be better if you it is hidden also.
Then instead of using SW_SHOWNORMAL use SW_HIDE when you call ShellExecute API.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Aug 22nd, 2006, 07:27 AM
#14
Re: Shell Problem
 Originally Posted by Joacim Andersson
There is no API called RemoveSystemMenu, the name of the function is simply RemoveMenu.
I can't beleive that I have been writing RemoveSystemMenu instead of RemoveMenu.
Thanks for correcting that.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Aug 22nd, 2006, 11:01 AM
#15
Re: Shell Problem
Is there any method to run the shelled file in hidden mode.
-
Aug 22nd, 2006, 11:04 AM
#16
Re: Shell Problem
VB Code:
Shell "c:\myApp.exe", vbHide 'you can locate it on the task manager later
-
Aug 22nd, 2006, 11:52 AM
#17
Hyperactive Member
Re: Shell Problem
One thing to note is that Shell() runs concurrently with the rest of your program.. It does not wait until the process finishes before executing the lines after Shell().. This link points to a more diverse routine..
http://www.vbforums.com/showpost.php...96&postcount=8
-
Aug 23rd, 2006, 02:25 AM
#18
Re: Shell Problem
 Originally Posted by danasegarane
Is there any method to run the shelled file in hidden mode.
Can you post the code for ShellExecute that you are using. You just have to replace SW_SHOWNORMAL with SW_HIDE.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Aug 23rd, 2006, 06:10 AM
#19
Re: Shell Problem
Dear Suja,
I am using the following code.I am using the "Exec" Portion only.I
want to hide the shelled process.
Shell and wait
-
Aug 23rd, 2006, 07:31 AM
#20
Re: Shell Problem
Before calling the CreateProcess API set the dwShowWindow to 0.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Aug 23rd, 2006, 08:00 AM
#21
Re: Shell Problem
 Originally Posted by Shuja Ali
Before calling the CreateProcess API set the dwShowWindow to 0.
That's not enough, you also need to set the dwFlags member to STARTF_USESHOWWINDOW otherwise the wShowWindow is ignored (since you never set a value to wShowWindow it's already equal to 0). Changes shown in bold
VB Code:
Private Sub ExecCmd(CmdLine As String)
[b] Const STARTF_USESHOWWINDOW As Long = &H1 [/b]
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ret As Long
' Initialize the STARTUPINFO structure:
start.cb = Len(start)
[b] start.dwFlags = STARTF_USESHOWWINDOW [/b]
' Start the shelled application:
ret = CreateProcessA(0&, CmdLine, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
' Wait for the shelled application to finish:
ret = WaitForSingleObject(proc.hProcess, INFINITE)
ret = CloseHandle(proc.hProcess)
End Sub
Last edited by Joacim Andersson; Aug 23rd, 2006 at 08:07 AM.
-
Aug 23rd, 2006, 08:37 AM
#22
Re: Shell Problem
Dear JA,
Thanks for your code.I will try and will reply.
-
Aug 25th, 2006, 04:42 AM
#23
Re: Shell Problem
Thanks to all.My have got it.
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
|