|
-
Jul 20th, 2007, 07:25 PM
#1
Thread Starter
Hyperactive Member
VB.net api?
In vb6 i could use api functions to say reboot a machine or open a word doc from a VB app.
In vb.net how do i do those things as it has changed. There are no api commands now .
-
Jul 20th, 2007, 07:30 PM
#2
-
Jul 20th, 2007, 07:31 PM
#3
Re: VB.net api?
Yes there are, and they aren't much different. Here are a couple declarations as examples:
vb Code:
Declare Ansi Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Declare Ansi Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Integer, ByVal lpString As System.Text.StringBuilder, ByVal nMaxCount As Integer) As Integer
My usual boring signature: Nothing
 
-
Jul 20th, 2007, 10:38 PM
#4
New Member
Re: VB.net api?
this is an Apigen for vb.net 2005.
very useful !
http://winrazor.chat.ru/apigen.zip
-
Jul 20th, 2007, 10:40 PM
#5
Frenzied Member
Re: VB.net api?
remember to change everything from long to integer.
-
Jul 21st, 2007, 02:20 AM
#6
Re: VB.net api?
...or open a word doc from a VB app.
Code:
Option Explicit On
Option Strict On
'Ad a reference to MS Word xx.0 Object Library
Imports Microsoft.Office.Interop
Public Class Form1
Private oApp As Word.Application
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
oApp.Quit()
oApp = Nothing
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim oDoc As Word.Document
oApp = DirectCast(CreateObject("Word.Application"), Word.Application)
oDoc = oApp.Documents.Open(FileName:="C;\Test.doc")
oApp.Visible = True
'Do stuff like read or write from/to the document
'Close and clean up
oDoc.Close(SaveChanges:=False)
oDoc = Nothing
End Sub
End Class
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 
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
|