|
-
Aug 9th, 2000, 09:47 AM
#1
Thread Starter
Good Ol' Platypus
I find that nobody really answers posts nowadays. So here's my idea: Post to this, and one of the people who have responded will answer, but most likely it will be me . So, what troubles your VB-Life?
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 9th, 2000, 09:53 AM
#2
Hyperactive Member
See Thread Impossible to Answer Question
http://forums.vb-world.net/showthrea...threadid=25753
If you want, try your luck at any of the four question I asked. Thanks for your time. Joe
[Edited by Joey_k29 on 08-09-2000 at 10:55 AM]
-
Aug 9th, 2000, 10:07 AM
#3
Thread Starter
Good Ol' Platypus
You could use mciGetCreatorTask, but I don't know how, or you could do this:
Code:
Do
chDir E:\ (or whatever you're CD-ROM drive is)
Loop until err.number <> 0
'code to excecute when it's open
I know it's a little far-fetched, but it may work. (Q #4)
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 9th, 2000, 10:13 AM
#4
Thread Starter
Good Ol' Platypus
To your first question, You may be able to do this with obtaining a window handle from the shell. Although, I have no clue how to do the rest. Why do you want to do those things, anyway?
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 9th, 2000, 10:13 AM
#5
Lively Member
What is the UBound() Function?
Mag-Net's Home
Visual Studio 6-Enterprise - SP4
ICQ: 35519773
Have Fun 
-
Aug 9th, 2000, 10:16 AM
#6
Thread Starter
Good Ol' Platypus
The Ubound() function returns the highest number of your array. For example, If I had this code:
Code:
Option Base 1
Dim MyArray() as Integer
Private Sub Form_Load()
Redim MyArray(15)
MsgBox "Ubound returns " & ubound(myarray) & ". Lbound returns " & lbound(myarray) & "."
Msgbox "Ubound should return 15 while lbound will return 1 (option base 1)."
End Sub
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 9th, 2000, 10:26 AM
#7
Hyperactive Member
I am trying to log what programs are being accessed on the cdrom. Do you have any specific code for the answer to my first question that I may use?
Thank you Joe
By the way, unfortunately the cdrom thing did not work. It works if the cdrom is just put in, but if you explore it the code does not execute. Thanks anyway. Any other ideas?
[Edited by Joey_k29 on 08-09-2000 at 11:31 AM]
-
Aug 9th, 2000, 10:29 AM
#8
Lively Member
Thanks, just wondered what it was, I didnt really need an example, but thanks neway, well that was my question
Mag-Net's Home
Visual Studio 6-Enterprise - SP4
ICQ: 35519773
Have Fun 
-
Aug 9th, 2000, 10:35 AM
#9
Hooks
How do I log messages sent to other processes?
I tried to SetWindowLong to my proc, but then i found out it only works if you're trying it on your own window.
I need some good hooks explanation.
Anyone?
-
Aug 9th, 2000, 10:46 AM
#10
Thread Starter
Good Ol' Platypus
If you mean SubClassing, this will work:
Code:
Public Const GWL_WNDPROC = -4
Public lpPrevWndProc As Long
Public Sub Hook(Frm as Form)
Dim FrmhWnd as Long
FrmhWnd = frm.hWnd
lpPrevWndProc = SetWindowLong(FrmhWnd,GWL_WNDPROC,AddressOf MyWndProc)
End Sub
Public Sub UnHook(Frm as Form)
Dim Temp
Dim FrmhWnd as Long
FrmhWnd = frm.hWnd
temp = SetWindowLong(FrmhWnd,GWL_WNDPROC,lpPrevWndProc)
End Sub
Function MyWndProc(ByVal hw As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
MsgBox "Message: " & format(now,"HH:MM:SS") & " " & Cstr(hw) & " " & Cstr(uMsg) & " " & CStr(wParam) & " " & CStr(lParam)
MyWndProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, lParam)
End Function
That's a short subclassing technique. Call it like this:
Code:
Private Sub Form_Load()
Hook Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnHook Me
Cancel = False
End
End Sub
I didn't just make you call the hWnd in the Hook and Unhook because this way it looks funny.
Uh...yeah....hook me....hic!
     
As you can see, some like it while others do not.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 9th, 2000, 11:03 AM
#11
Not really...
This is easy.
I know how to do this stuff.
But in this method i can't hook into windows which are not in my app.
Any other suggestions?
-
Aug 9th, 2000, 11:12 AM
#12
Thread Starter
Good Ol' Platypus
Re: Not really...
Originally posted by Sc0rp
But in this method i can't hook into windows which are not in my app.
So, that's you're style. I don't know how to get other program's hWnds, but you may be able to get the window by it's classname, and use that hwnd. Are you trying to do this for winamp? If you are, I can send you my ddraw shell example for Winamp (you can use it to make Visualizers, no royalties or anything). BTW, I'm out for lunch now
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 9th, 2000, 11:28 AM
#13
Lively Member
Mp3-Player
How do ido a good mp3-player.
Is ther esomething i can use for free
-
Aug 9th, 2000, 11:41 AM
#14
Sastraxi: When dealing with Hooking and SubClassing, it's easier to pass the hWnd of the Form rather than passing the Form itself. This way, you can SubClass other programs.
Sc0rp: To find the hWnd of a window, use Findwindow
Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
Private Sub Command1_Click()
'Get the hWnd of Calculator and SubClass it
hParent = FindWindow(0&, "Calculator")
SubClass hParent
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Unsubclass Calculator
UnSubClass hParent
End Sub
-
Aug 9th, 2000, 12:19 PM
#15
Fanatic Member
There is an exewrap example that logs ussage, i will paste it in here(modified to log only the CD-Rom)
Code:
Sub Main()
On Error GoTo errHandler
Debug.Print Command$
If Command$ <> "" Then
Dim i As Integer
i = InStr(Command$, "\") 'get Position of first slash
Dim MyStr As String
MyStr = Left(Command$, i - 1) 'get drive letter
If MyStr = "D:" Then ' Is it The CD-Rom
'(code to log usage)
End If
Call Shell(Command$, vbNormalFocus) 'Shell that program
End If
End
Exit Sub
errHandler:
MsgBox Err.Description, vbCritical Or vbOKOnly, Err.Number 'what went wrong
If Err.Number <> 53 Then
Call Shell(Command$, vbNormalFocus) 'Make sure the program runs!
End If
End Sub
Change the registry like this
Code:
HKEY_CLASSES_ROOT\exefile\shell\open\command to: "C:\exewrap.exe" "%1" %*
HKEY_CLASSES_ROOT\lnkfile\shell\open\command to: "C:\exewrap.exe" "%1" %*
HKEY_CLASSES_ROOT\piffileshell\open\command to: "C:\exewrap.exe" "%1" %*
HKEY_CLASSES_ROOT\batfile\shell\open\command to: "C:\exewrap.exe" "%1" %*
HKEY_CLASSES_ROOT\com\file\shell\open\command to: "C:\exewrap.exe" "%1" %*
NOTE: Make sure you put in the correct file path, this program mite lock you out of your computer, so make a back up of this part of your registry, so you can restore it!
See tip http://www.vb-world.net/tips/tip121.html
-
Aug 9th, 2000, 12:44 PM
#16
Thread Starter
Good Ol' Platypus
I know you should pass the hWnd, not the form. I was just pointing out that that is not the correct method, but it was REALLY funny! Hook Me.. Yeah, Hook Me, too!
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 9th, 2000, 12:50 PM
#17
New Member
Look @ Thread "Making a clock tick" just posted
Do you have any suggestions?
-
Aug 9th, 2000, 12:56 PM
#18
As I stated there, you would probably need to use a WAV file for that.
-
Aug 9th, 2000, 01:00 PM
#19
Thread Starter
Good Ol' Platypus
Same Thing!
I once did the same thing! Here's the code:
Code:
--modtick.bas--
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Const SND_ASYNC = &H1 ' play asynchronously
Const Tick = "tick.wav"
Sub Main()
Dim A
Dim OldSecond As Long
OldSecond = Second(Now)
Do
If Second(Now) <> OldSecond Then
OldSecond = Second(Now)
PlayWav Tick, SND_ASYNC
End If
DoEvents
Loop
End Sub
Sub PlayWav(ByVal File As String, Args As Long)
Dim RET As Long
RET = sndPlaySound(App.Path & "\" & File, Args)
End Sub
This reply probably has some bugs, but you get the idea.
[Edited by Sastraxi on 08-09-2000 at 02:17 PM]
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 9th, 2000, 01:02 PM
#20
Thread Starter
Good Ol' Platypus
Abel: MP3's
I'm pretty sure you could use a DirectX component to do that. I'm not sure, but is the Multimedia aspect of directX DirectPlay or DirectAnimation?
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 9th, 2000, 01:04 PM
#21
Thread Starter
Good Ol' Platypus
There is a grammatical mistake in the subject of my last post. It should be MP3s, not MP3's.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 10th, 2000, 11:49 AM
#22
SubClassing
Megatron,
About your reply to my post with FindWindow.
I know how to find window handles, the problem is that when i try to SetWindowLong to an handle which is not mine, it returns an error.
-
Aug 10th, 2000, 01:44 PM
#23
Addicted Member
Does anyone know how I can alter the properties of the standard HTML selection list?
tx
dvst8
Secret to long life:
Keep breathing as long as possible.
-
Aug 11th, 2000, 07:59 AM
#24
Addicted Member
dependancy information
OK Here's one for you!
I need a way to figure out dependancy information for a project (like the way the package and deployment wizard does it) without using the package and deployment wizard. Any ideas anyone?
-
Aug 11th, 2000, 09:02 AM
#25
Hyperactive Member
Mage33
Try this site for WinSock stuff -
http://www.stardust.com/winsock/
That's Mr Mullet to you, you mulletless wonder.
-
Aug 11th, 2000, 10:35 AM
#26
Thread Starter
Good Ol' Platypus
Well, too bad that there isn't App.UsedDLLFiles. 
But there is a way, I'm sure of that. You could find out manually, of course.
Cmdlg32.ocx
Msvbm60.dll
mycontr.ocx
kernel32.dll
user32.dll
Stuff like that. API calls from the dll, Controls you are using, MSVBM60.DLL!
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Aug 11th, 2000, 10:37 AM
#27
Thread Starter
Good Ol' Platypus
DVST8:
I'm not really sure what you're talking about. Can you perhaps give a more detailed explanation?
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
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
|