Welcome to Dream.In.Code
Become a VB Expert!

Join 149,481 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,411 people online right now. Registration is fast and FREE... Join Now!




ShellExecute Api

 
Reply to this topicStart new topic

ShellExecute Api, comes in handy

Rating  4
kaufman
1 May, 2007 - 05:32 PM
Post #1

New D.I.C Head
Group Icon

Joined: 29 Apr, 2007
Posts: 37


Dream Kudos: 25
My Contributions
The ShellExecute API opens a executeble/documentfile. It can also print, and open files.
heres how you would print a file
CODE

ShellExecute hWnd, "print", "C:\Folder\TextFile", _
    vbNullString, vbNullString, SW_SHOWNORMAL

notice the word "print" in it. that tells the computer for it to print the file.
CODE

SW_SHOWNNORMAL

that displays the page as normal.

Heres how you would open a file

CODE

ShellExecute hWnd, "open", "C:\Folder\TextFile.txt", _
    vbNullString, vbNullString, SW_SHOWNORMAL


There are aslo the following displays for your file

CODE

SW_HIDE

HIdes a window and opens another

CODE

SW_MAXIMIZE

CODE

makes the window maximized(big!)


CODE

SW_SHOW

opens the window normally

CODE

SW_SHOWMAXIMIZED

maximizes the window
CODE

SW_SHOWMINIMIZED

opens the window and displays it as like a small window

Well since i typed alot there are probally lots of mispelled words and stuff feel free to report them.

~~~kaufman~~~

This post has been edited by kaufman: 1 May, 2007 - 05:41 PM
User is offlineProfile CardPM
+Quote Post

Goddard
RE: ShellExecute Api
1 May, 2007 - 07:56 PM
Post #2

New D.I.C Head
*

Joined: 23 Apr, 2007
Posts: 25


My Contributions
Not to put the coding down for printing, but It's rare to see .txt files anymore that you need to print, mostly Word or Open Office files. And if someone is doing web design, then they are using dream weaver or some sort of flash.

You should put the codes maybe in the snippets section though, Label it as window options or something related.

You can also use the hide technique to make process windows disappear, liek taskmanger. And you can also open programs through vb code. Instead of a quick task section on my taskbar. I have a vb program with buttons that open up the programs i want. Mostly different browsers, Instant messenger programs, word and open office. Hyper links to like e-mail.

Make one giant snippet lol

Good work
User is offlineProfile CardPM
+Quote Post

kaufman
RE: ShellExecute Api
2 May, 2007 - 12:17 PM
Post #3

New D.I.C Head
Group Icon

Joined: 29 Apr, 2007
Posts: 37


Dream Kudos: 25
My Contributions
Well i guess it wouldnt take me that long to make a program
similar to the one that you yourself uses. becouse like i said on the tut
the ShellExecute api also works for executables.

And i may consider putting this in the code snippets section

This post has been edited by kaufman: 2 May, 2007 - 12:19 PM
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: ShellExecute Api
2 May, 2007 - 09:12 PM
Post #4

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,867



Thanked: 53 times
Dream Kudos: 550
My Contributions
Why is this just a regular post and not put in the tutorial's page?

You get Dream.In.Code Kudos for submitting tutorials.

They get reviewed so you can present your best foot forward.

You get a nice warm fuzzy feeling knowing you are helping fellow programmers.

There is a chance to win a thumb drive (I belive) every month.

There is a cool Contributer/Author badge that you can earn (much cooler than anything the cubscouts has).

___________________________________________

Of course as I reviewer I might ask you for more text explaning what is going on... but hey that would just be me trying to help you put you're best foot forward.
User is online!Profile CardPM
+Quote Post

Jayman
RE: ShellExecute Api
2 May, 2007 - 10:41 PM
Post #5

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,302



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
NickDMax, you are 100% right. And yes, we do offer a monthly 1GB Thumb drive giveaway for those member who post snippets and tutorials, in that same month.

You can find the thumb drive giveaway here.

So put your snippets or tutorials together and get a chance to win some cool stuff.

Speaking of which, I think Chris forget to do the drawing for this month. I will give him a kick in the butt for that. smile.gif

@kaufman, you are already posting the code in these posts you keep creating. Why not submit them to the snippets or tutorials section and earn due credit for them?

Believe me it really shouldn't matter to you so much that people will copy and use your code. That is gonna happen regardless of anything you do about. And if they don't get the code from you, I guarantee, it will come from someone else. I personally don't have a problem with sharing any code that I have produced. Because if someone is able to learn something from it, then I feel it was justified. Even though I know there are a ton of lazy asses out there, who are going to take the code and make claim to it as their own. No skin off my nose.

As Nick mentioned, if you don't want your code utilized by anyone else, don't make it public. Period.

But the whole point of this community, and yes we are a community, is to provide help and educate people on programming and web development, in addition to a host of other areas.

I don't mean to sound offensive, but the code you have been providing is not some big secret. It is already available just by googling it. ShellExecute has been around a lot longer than you have been programming. wink2.gif

Enough of my rambling now.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 04:24PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month