View Full Version : coding vb utk link dgn software...urgent
korang ade tak source code visual basic utk
1. link terus ke software dlm pc kite? cthnye, klik satu button terus keluar aplication word.
2. klik satu button terus link ke internet
sharuzzaman
23-04-03, 06:38 PM
gunakan arahan
shell("notepad.exe")
untuk melaksanakan perisian notepad dan juga perisian-perisian lain.
katakan kalau nak launch IE untuk masuk bincang.net
URL="http://www.bincang.net"
browser="iexplore.exe"
link_to_execute=browser & " " & URL
shell(link_to_execute)
lihat arahan shell di MSDN library di http://msdn.microsoft.com
mekacih... biar aku try dulu ye..:::
serting
24-04-03, 09:03 AM
nak link tu gune command button ke?
Originally posted by sharuzzaman
gunakan arahan
shell("notepad.exe")
untuk melaksanakan perisian notepad dan juga perisian-perisian lain.
katakan kalau nak launch IE untuk masuk bincang.net
URL="http://www.bincang.net"
browser="iexplore.exe"
link_to_execute=browser & " " & URL
shell(link_to_execute)
1. link utk notepad bolehlah, yang lain tu tak bolehlah
2. yang link ke IE tu tak bolehlah
lihat arahan shell di MSDN library di http://msdn.microsoft.com :uwaa:
pentamaya
24-04-03, 11:11 AM
Originally posted by serting
nak link tu gune command button ke?
Mestilah command button, takkan nak guna COMBO BOX atau HORIZONTAL BAR pulak kan......hehe. :)
Kod yg dikepilkan di atas betul, cuma part nak lokasi nak panggil file aplikasi word mesti betul linknya......sesuai dengan lokasi dimana MSOffice diinstall.
Cth : C:/Program Files/MSOffice/Word/word.exe
Harap maklum.
p.s. Nanti aku cuba cari codingnya.
C-Fumofufu
24-04-03, 11:11 AM
2. mungkin takleh pasai kite kene specify kat mane IE tu kot.
leh try gune cam
%SYSTEMROOT% dll
pentamaya
24-04-03, 11:42 AM
Poad.....ini yang sempat aku buatkan....harap kau create button dan test laa...okie.
----------------------------------------------------------------------------------------------------------
KENA GUNA ACTIVE X FUNCTION :-
Option Explicit
' The instance of Microsoft Word
Dim MSWord As Word.Application
Private Sub Form_Load()
' Create the instance of Word that will be used later.
Set MSWord = New Word.Application
End Sub
Private Sub cmdCheck_Click()
' Check the word in txtWord
Dim text As String
Dim suggestion As Word.SpellingSuggestion
Dim colSuggestions As Word.SpellingSuggestions
text = Trim$(txtWord.text)
If text = "" Then
MsgBox "Please enter a word in the text box", vbExclamation
txtWord.SetFocus
Exit Sub
End If
' Add a document, if there aren't any
If MSWord.Documents.Count = 0 Then
MSWord.Documents.Add
End If
' check the word
lstSuggestions.Clear
If MSWord.CheckSpelling(text) Then
' The word is correct.
lstSuggestions.AddItem "(correct)"
Else
' The word is uncorrect. Get the list of suggested words.
Set colSuggestions = MSWord.GetSpellingSuggestions(text)
If colSuggestions.Count = 0 Then
lstSuggestions.AddItem "(no suggestions)"
Else
For Each suggestion In colSuggestions
lstSuggestions.AddItem suggestion.Name
Next
End If
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
' Word needs to be explictly closed.
MSWord.Quit
End Sub
--------------------------------------------------------------------------------------------------------------------
izafarid
24-04-03, 02:27 PM
tambahan,
pastikan microsoft word diinstall
aku recommend ShellExecute sebab kita buleh control window yg kita nak create. eg:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const SW_SHOWNORMAL = 1
Const SW_HIDE = 0
Const SW_NORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3
Const SW_MAXIMIZE = 3
Const SW_SHOWNOACTIVATE = 4
Const SW_SHOW = 5
Const SW_MINIMIZE = 6
Const SW_SHOWMINNOACTIVE = 7
Const SW_SHOWNA = 8
Const SW_RESTORE = 9
Const SW_SHOWDEFAULT = 10
Const SW_MAX = 10
Private Sub Form_Load()
' run ms word
ShellExecute Me.hwnd, vbNullString, "winword.exe", vbNullString, "C:\", SW_SHOWNORMAL
' run contoh.txt with notepad
ShellExecute Me.hwnd, vbNullString, "notepad.exe contoh.txt ", vbNullString, "C:\", SW_MINIMIZE
' mail kat orang using default e-mailing system
ShellExecute Me.hwnd, vbNullString, "mailto:fulan@fulan.com", vbNullString, "C:\", SW_MAXIMIZE
End Sub
bye.
Kiriman asal oleh shamil
aku recommend ShellExecute sebab kita buleh control window yg kita nak create. eg:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const SW_SHOWNORMAL = 1
Const SW_HIDE = 0
Const SW_NORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3
Const SW_MAXIMIZE = 3
Const SW_SHOWNOACTIVATE = 4
Const SW_SHOW = 5
Const SW_MINIMIZE = 6
Const SW_SHOWMINNOACTIVE = 7
Const SW_SHOWNA = 8
Const SW_RESTORE = 9
Const SW_SHOWDEFAULT = 10
Const SW_MAX = 10
Private Sub Form_Load()
' run ms word
ShellExecute Me.hwnd, vbNullString, "winword.exe", vbNullString, "C:\", SW_SHOWNORMAL
' run contoh.txt with notepad
ShellExecute Me.hwnd, vbNullString, "notepad.exe contoh.txt ", vbNullString, "C:\", SW_MINIMIZE
' mail kat orang using default e-mailing system
ShellExecute Me.hwnd, vbNullString, "mailto:fulan@fulan.com", vbNullString, "C:\", SW_MAXIMIZE
End Sub
bye.
nie nak buat kat Active X ke form.exe yang biase tu?:confused:
buat kat mana2 pun buleh. yg penting abg declare dulu the dll function yg abg nak pakai. kalau private declare private, kalau nak call byk2 kali, declare public (aku selalu silap taip public jadi pubic..hahah) biasanya kat module *.bas. and then call lah dgn parameter yg betul. shell32.dll ni bukan activeX so abg takleh create com object/client out of this dll. study msdn doc in section Platform SDK/WinAPI32 for further info.
happy coding.
Kiriman asal oleh shamil
buat kat mana2 pun buleh. yg penting abg declare dulu the dll function yg abg nak pakai. kalau private declare private, kalau nak call byk2 kali, declare public (aku selalu silap taip public jadi pubic..hahah) biasanya kat module *.bas. and then call lah dgn parameter yg betul. shell32.dll ni bukan activeX so abg takleh create com object/client out of this dll. study msdn doc in section Platform SDK/WinAPI32 for further info.
happy coding.
kite nak gune command button button kan? lagi satu declare dll function tu mcm mane?
mcm mane coding kalau kite nak display dua text box pada satu text box read only? maksud aku, text box1 utk nama dan text box2 utk compose. lepas tu kite klik satu button die akan terus display pada read only text pada muka hadapan yang aku dah buat.
wah, tak berapa paham la hamba apa masalah abg. apa kaitan textbox ni dgn declare dll ni?
camni lah poad. abg try create one fresh new vb form, double click on it, dan replace all the codes with codes contoh yg saya kasik. then run it. then, u will understand apa fungsi declare dll ni. ok.
aku dah try. tapi bile die dah keluarkan microsoft word, kite tak boleh nak close vb.
synOvia
30-04-03, 06:56 AM
rase2 poan try close vb mase projek tengah run kot.....
aku tak nampak pun ade mssg box kat blkg tu:cipan: .sorry:D
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.