borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Starting & Stopping Services)Next Topic (disable CRTL ALT Delete) New Topic New Poll Post Reply
AndreaVB Forum : API : Need help with API for CreateProcess(A)
Poster Message
bill24
Level: Protégé

Registered: 28-04-2005
Posts: 5

icon Need help with API for CreateProcess(A)

I have built an ActiveX DLL wrapper for CreateProcessA using the code found in the API section of this site as an example.

What I want to do is start the new process with the Window minimized. I have added the following in to the example I got here, but the Window doesn't start minimized:

Private Const STARTF_USESHOWWINDOW = &H1
Private Const SW_SHOWMINIMIZED = 2 (also tried 6)
. . .
Dim startup As STARTUPINFO (Private Type declared earlier)
. . .
startup.cb = Len(startup)
startup.dwFlags = STARTF_USESHOWWINDOW
startup.wShowWindow = SW_SHOWMINIMIZED
. . .
ret = CreateProcessA( _param_list_ )

Any help? TIA

[Edited by bill24 on 30-04-2005 at 02:07 AM GMT]

29-04-2005 at 09:06 PM
View Profile Send Email to User Show All Posts | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1156
icon Re: Need help with API for CreateProcess(A)

Hi Bill

I just tried it using the code from

http://www.andreavb.com/tip020004.html

with the addition of the following lines

    startup.dwFlags = &H1 'STARTF_USESHOWWINDOW
    startup.wShowWindow = 2 'SW_SHOWMINIMIZED


after the following line

    startup.cb = Len(startup)


and it worked

Steve

03-05-2005 at 09:45 AM
View Profile Send Email to User Show All Posts | Quote Reply
bill24
Level: Protégé

Registered: 28-04-2005
Posts: 5
icon Re: Need help with API for CreateProcess(A)

I used the code from the tip linked above, but I forgot to mention that I created the 'Declarations and 'Module part as an ActiveX DLL.

Then I built a test form with the 'Usage code, modified to create a New instance of the Class in the DLL.

I just changed it to put in exactly what steve_w posted, and the process still starts in a 'Normal' window, not minimized.  

03-05-2005 at 09:03 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Need help with API for CreateProcess(A)

And again, it works just fine... Just put all the module code in class module, and no problem...

____________________________
If you find the answer helpful, please mark this topic as solved.

03-05-2005 at 09:50 PM
View Profile Send Email to User Show All Posts | Quote Reply
bill24
Level: Protégé

Registered: 28-04-2005
Posts: 5
icon Re: Need help with API for CreateProcess(A)


It works, if you do it right!

I should have known it would be something like this. I cannot simply Copy/Paste stuff onto the network I'm working on. So I have to print and rekey it. And, of course, I made a mistake declaring the STARTUPINFO structure - should have checked this first as most obvious cause.

Thanks for the help...

03-05-2005 at 10:59 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : API : Need help with API for CreateProcess(A)
Previous Topic (Starting & Stopping Services)Next Topic (disable CRTL ALT Delete) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder