On Thu, 2 Sep 2004 16:37:50 -0500, Frank R. Jr. wrote:
[color=blue]
>How can u create a log in visual basic???[/color]
Public Sub appLog (logItem as String)
n%=FreeFile
Open App.Path & "\" & App.EXEName & ".log" For Output As n%
Print n%, CStr(Now) & " " & logItem
Close n%
End Sub
--
auric underscore underscore at hotmail dot com
*****
We meant to change a nation, and instead we changed a world.
-- Ronald Reagan
confused on how to make it work i tried enter the code in did not well i
mean it wouldnt run the test porgram
Private subform Load (logitem as string)
n%=FreeFile
Open App.Path & "\" & App.aim.exe & ".log" For Output As n%
Print n%, CStr(Now) & " " & logItem
Close n%
End Sub
Is what i did is there something wrong here ?
"Auric__" <not.my.real@em ail.address> wrote in message
news:tlafj01bgk 56b8btmjtq28ia2 qvl09vggr@4ax.c om...[color=blue]
> On Thu, 2 Sep 2004 16:37:50 -0500, Frank R. Jr. wrote:
>[color=green]
>>How can u create a log in visual basic???[/color]
>
> Public Sub appLog (logItem as String)
> n%=FreeFile
> Open App.Path & "\" & App.EXEName & ".log" For Output As n%
> Print n%, CStr(Now) & " " & logItem
> Close n%
> End Sub
>
> --
> auric underscore underscore at hotmail dot com
> *****
> We meant to change a nation, and instead we changed a world.
> -- Ronald Reagan[/color]
>"Auric__" <not.my.real@em ail.address> wrote in message[color=blue]
>news:tlafj01bg k56b8btmjtq28ia 2qvl09vggr@4ax. com...[color=green]
>> On Thu, 2 Sep 2004 16:37:50 -0500, Frank R. Jr. wrote:
>>[color=darkred]
>>>How can u create a log in visual basic???[/color]
>>
>> Public Sub appLog (logItem as String)
>> n%=FreeFile
>> Open App.Path & "\" & App.EXEName & ".log" For Output As n%
>> Print n%, CStr(Now) & " " & logItem
>> Close n%
>> End Sub[/color][/color]
On Fri, 3 Sep 2004 17:18:42 -0500, Frank R. Jr. wrote:
[color=blue]
>confused on how to make it work i tried enter the code in did not well i
>mean it wouldnt run the test porgram
>Private subform Load (logitem as string)
> n%=FreeFile
> Open App.Path & "\" & App.aim.exe & ".log" For Output As n%
> Print n%, CStr(Now) & " " & logItem
> Close n%
>End Sub
>Is what i did is there something wrong here ?[/color]
Don't top-post.
My code would be its own procedure - don't put it into Form_Load. Try
something like this:
Private Sub Form_Load () 'note how Form_Load looks - you did it wrong...
appLog "Here is where you enter what you want logged."
End Sub
Public Sub appLog (logItem as String)
n%=FreeFile
Open App.Path & "\" & App.EXEName & ".log" For Output As n%
Print n%, CStr(Now) & " " & logItem
Close n%
End Sub
--
auric underscore underscore at hotmail dot com
*****
And now, some new news.
"Auric__" <not.my.real@em ail.address> wrote in message
news:3fshj0hehq 29t6p06o5aivn4t lutmqio32@4ax.c om...[color=blue][color=green]
> >"Auric__" <not.my.real@em ail.address> wrote in message
>>news:tlafj01b gk56b8btmjtq28i a2qvl09vggr@4ax .com...[color=darkred]
>>> On Thu, 2 Sep 2004 16:37:50 -0500, Frank R. Jr. wrote:
>>>
>>>>How can u create a log in visual basic???
>>>
>>> Public Sub appLog (logItem as String)
>>> n%=FreeFile
>>> Open App.Path & "\" & App.EXEName & ".log" For Output As n%
>>> Print n%, CStr(Now) & " " & logItem
>>> Close n%
>>> End Sub[/color][/color]
>
> On Fri, 3 Sep 2004 17:18:42 -0500, Frank R. Jr. wrote:
>[color=green]
>>confused on how to make it work i tried enter the code in did not well i
>>mean it wouldnt run the test porgram
>>Private subform Load (logitem as string)
>> n%=FreeFile
>> Open App.Path & "\" & App.aim.exe & ".log" For Output As n%
>> Print n%, CStr(Now) & " " & logItem
>> Close n%
>>End Sub
>>Is what i did is there something wrong here ?[/color]
>
> Don't top-post.
>
> My code would be its own procedure - don't put it into Form_Load. Try
> something like this:
>
> Private Sub Form_Load () 'note how Form_Load looks - you did it wrong...
> appLog "Here is where you enter what you want logged."
> End Sub
>
> Public Sub appLog (logItem as String)
> n%=FreeFile
> Open App.Path & "\" & App.EXEName & ".log" For Output As n%
> Print n%, CStr(Now) & " " & logItem
> Close n%
> End Sub
>
> --
> auric underscore underscore at hotmail dot com
> *****
> And now, some new news.[/color]
Ok the code runs with out no errors now to see the log would make a text
box? or something like that here is the code how it stands
Private Sub Form_Load()
appLog "aim.exe"
End Sub
Public Sub appLog(logitem As String)
N% = FreeFile
Open App.Path & "\" & App.EXEName & ".log" For Output As N%
Print N%; CStr(Now) & "" & logitem
Close N%
End Sub
"Frank R. Jr." <blahblah@hotma il.com> wrote in message
news:mia_c.3832 9$wu.36491@okep read04...[color=blue]
>[/color]
<snip>
I think there is a misunderstandin g here. Wat Auric showed you is how to
write a log from YOUR application.
Let say you make an application called FrankProgram.ex e. Inside
FrankProgram.ex e you have the sub called. It will create FrankProgram.lo g
inw gere you can write whatever you feel like it.
Looks like you are trying to write a log for another program (aim.exe)?
This is only doable if your VB program is running in the background checking
the applications that are running (by finding the owner window) and creating
a log.
"Raoul Watson" <WatsonR@Intell igenCIA.com> wrote in message
news:jij_c.1488 $AB6.76@trndny0 4...[color=blue]
>
> "Frank R. Jr." <blahblah@hotma il.com> wrote in message
> news:mia_c.3832 9$wu.36491@okep read04...[color=green]
>>[/color]
> <snip>
>
> I think there is a misunderstandin g here. Wat Auric showed you is how to
> write a log from YOUR application.
>
> Let say you make an application called FrankProgram.ex e. Inside
> FrankProgram.ex e you have the sub called. It will create FrankProgram.lo g
> inw gere you can write whatever you feel like it.
>
> Looks like you are trying to write a log for another program (aim.exe)?
>
> This is only doable if your VB program is running in the background
> checking
> the applications that are running (by finding the owner window) and
> creating
> a log.
> Yes you are correct and of course the other program is running in the
> background as of that yes i know that what I am trying to do is make
> something like dead aim to where i can log my convos and do you mean by
> owner windows as to the program and it gives u the for detail of all the
> names?
>[/color]
On Sat, 04 Sep 2004 13:20:15 GMT, Raoul Watson wrote:
[color=blue]
>"Frank R. Jr." <blahblah@hotma il.com> wrote in message
>news:mia_c.383 29$wu.36491@oke pread04...[color=green]
>>[/color]
><snip>
>
>I think there is a misunderstandin g here. Wat Auric showed you is how to
>write a log from YOUR application.
>
>Let say you make an application called FrankProgram.ex e. Inside
>FrankProgram.e xe you have the sub called. It will create FrankProgram.lo g
>inw gere you can write whatever you feel like it.[/color]
Actually, it would create "FrankProgram.e xe.log", in the same directory
as "FrankProgram.e xe".
[color=blue]
>Looks like you are trying to write a log for another program (aim.exe)?
>
>This is only doable if your VB program is running in the background checking
>the applications that are running (by finding the owner window) and creating
>a log.[/color]
....which is something I personally have never had reason to do, so...
--
auric underscore underscore at hotmail dot com
*****
Today, top internet security experts announced a new type of virus that
formats your hard drive, burns a pentagram into your monitor, breaks the
wires to your speakers, dials 1-900 numbers on your modem, randomly
turns your cable box on and off, reports you to the FBI for sex crimes,
shoots your dog, and changes the settings on your refrigerator.
Ok auric thanks for your help i will try and figure it out unless Raoul can
help me with it
"Auric__" <not.my.real@em ail.address> wrote in message
news:3h8kj0ddjo 4q3urakronr59j4 4a059pbu1@4ax.c om...[color=blue]
> On Sat, 04 Sep 2004 13:20:15 GMT, Raoul Watson wrote:
>[color=green]
>>"Frank R. Jr." <blahblah@hotma il.com> wrote in message
>>news:mia_c.38 329$wu.36491@ok epread04...[color=darkred]
>>>[/color]
>><snip>
>>
>>I think there is a misunderstandin g here. Wat Auric showed you is how to
>>write a log from YOUR application.
>>
>>Let say you make an application called FrankProgram.ex e. Inside
>>FrankProgram. exe you have the sub called. It will create FrankProgram.lo g
>>inw gere you can write whatever you feel like it.[/color]
>
> Actually, it would create "FrankProgram.e xe.log", in the same directory
> as "FrankProgram.e xe".
>[color=green]
>>Looks like you are trying to write a log for another program (aim.exe)?
>>
>>This is only doable if your VB program is running in the background
>>checking
>>the applications that are running (by finding the owner window) and
>>creating
>>a log.[/color]
>
> ...which is something I personally have never had reason to do, so...
> --
> auric underscore underscore at hotmail dot com
> *****
> Today, top internet security experts announced a new type of virus that
> formats your hard drive, burns a pentagram into your monitor, breaks the
> wires to your speakers, dials 1-900 numbers on your modem, randomly
> turns your cable box on and off, reports you to the FBI for sex crimes,
> shoots your dog, and changes the settings on your refrigerator.[/color]
>"Auric__" <not.my.real@em ail.address> wrote in message[color=blue]
>news:3h8kj0ddj o4q3urakronr59j 44a059pbu1@4ax. com...[color=green]
>> On Sat, 04 Sep 2004 13:20:15 GMT, Raoul Watson wrote:
>>[color=darkred]
>>>"Frank R. Jr." <blahblah@hotma il.com> wrote in message
>>>news:mia_c.3 8329$wu.36491@o kepread04...
>>>>
>>><snip>
>>>
>>>I think there is a misunderstandin g here. Wat Auric showed you is how to
>>>write a log from YOUR application.
>>>
>>>Let say you make an application called FrankProgram.ex e. Inside
>>>FrankProgram .exe you have the sub called. It will create FrankProgram.lo g
>>>inw gere you can write whatever you feel like it.[/color]
>>
>> Actually, it would create "FrankProgram.e xe.log", in the same directory
>> as "FrankProgram.e xe".
>>[color=darkred]
>>>Looks like you are trying to write a log for another program (aim.exe)?
>>>
>>>This is only doable if your VB program is running in the background
>>>checking
>>>the applications that are running (by finding the owner window) and
>>>creating
>>>a log.[/color]
>>
>> ...which is something I personally have never had reason to do, so...[/color][/color]
On Sat, 4 Sep 2004 15:41:39 -0500, Frank R. Jr. wrote:
[color=blue]
>Ok auric thanks for your help i will try and figure it out unless Raoul can
>help me with it[/color]
Don't top post (again). I don't rearrange the order for nothing.
Raoul isn't the only one here, y'know; there are plenty others who *can*
help (whether they will or not is a different matter).
To help solve your problem, you should tell us:
- what version of VB you're using
- what version of Windows you're running (may or may not be pertinent)
--
auric underscore underscore at hotmail dot com
*****
- No! No!!! Stop! STOP!! You'll ruin everything!!
- MY GOD!! Are you kidding!? I've always dreamed of having super
POWERS!!! This is just too much to resist! I HAVE HEAD-EXPLODY!
"Auric__" <not.my.real@em ail.address> wrote in message
news:94jkj052d8 ak33dsca5so95fn 5db4vhnut@4ax.c om...[color=blue][color=green]
> >"Auric__" <not.my.real@em ail.address> wrote in message
>>news:3h8kj0dd jo4q3urakronr59 j44a059pbu1@4ax .com...[color=darkred]
>>> On Sat, 04 Sep 2004 13:20:15 GMT, Raoul Watson wrote:
>>>
>>>>"Frank R. Jr." <blahblah@hotma il.com> wrote in message
>>>>news:mia_c. 38329$wu.36491@ okepread04...
>>>>>
>>>><snip>
>>>>
>>>>I think there is a misunderstandin g here. Wat Auric showed you is how to
>>>>write a log from YOUR application.
>>>>
>>>>Let say you make an application called FrankProgram.ex e. Inside
>>>>FrankProgra m.exe you have the sub called. It will create
>>>>FrankProgra m.log
>>>>inw gere you can write whatever you feel like it.
>>>
>>> Actually, it would create "FrankProgram.e xe.log", in the same directory
>>> as "FrankProgram.e xe".
>>>
>>>>Looks like you are trying to write a log for another program (aim.exe)?
>>>>
>>>>This is only doable if your VB program is running in the background
>>>>checking
>>>>the applications that are running (by finding the owner window) and
>>>>creating
>>>>a log.
>>>
>>> ...which is something I personally have never had reason to do, so...[/color][/color]
>
> On Sat, 4 Sep 2004 15:41:39 -0500, Frank R. Jr. wrote:
>[color=green]
>>Ok auric thanks for your help i will try and figure it out unless Raoul
>>can
>>help me with it[/color]
>
> Don't top post (again). I don't rearrange the order for nothing.
>
> Raoul isn't the only one here, y'know; there are plenty others who *can*
> help (whether they will or not is a different matter).
>
> To help solve your problem, you should tell us:
> - what version of VB you're using
> - what version of Windows you're running (may or may not be pertinent)
> --
> auric underscore underscore at hotmail dot com
> *****
> - No! No!!! Stop! STOP!! You'll ruin everything!!
> - MY GOD!! Are you kidding!? I've always dreamed of having super
> POWERS!!! This is just too much to resist! I HAVE HEAD-EXPLODY![/color]
I am running vb6 sp6
And XP PRO
and what I am try to accomplish is log my convos on AIMv5.5
"Frank R. Jr." <blahblah@hotma il.com> wrote in message
news:7Mp_c.2494 01$Oi.202000@fe d1read04...
Maybe this will help Frank..
This code uses a list box temporarily to fill in with processes which are
running.
To find out if a proces is running is simple:
If isRunning("calc .exe") then
' Calculator is running
End if
Add a module and have this in the .bas file..
Public Declare Function ProcessFirst Lib "kernel32" Alias "Process32First "
(ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Public Declare Function ProcessNext Lib "kernel32" Alias "Process32N ext"
(ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Public Declare Function CreateToolhelpS napshot Lib "kernel32" Alias
"CreateToolhelp 32Snapshot" (ByVal lFlags As Long, lProcessID As Long) As
Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long)
As Long
Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeap ID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProce ssID As Long
pcPriClassBase As Long
dwFlags As Long
szexeFile As String * 260
End Type
Test it by creating a form with a textbox, a label, a command button and add
this code:
(Simply type the process name, like "calc.exe". Label1 returns "True" if
running)
Option Explicit
Public Function isRunning(Proce ssName As String) As Boolean
Const PROCESS_ALL_ACC ESS = 0
Dim uProcess As PROCESSENTRY32
Dim rProcessFound As Long
Dim hSnapshot As Long
Dim szExename As String
Dim exitCode As Long
Dim appCount As Integer
Dim i As Integer
On Local Error GoTo done
appCount = 0
Const TH32CS_SNAPPROC ESS As Long = 2&
uProcess.dwSize = Len(uProcess)
hSnapshot = CreateToolhelpS napshot(TH32CS_ SNAPPROCESS, 0&)
rProcessFound = ProcessFirst(hS napshot, uProcess)
Do While rProcessFound
i = InStr(1, uProcess.szexeF ile, Chr(0))
szExename = LCase$(Left$(uP rocess.szexeFil e, i - 1))
If Right$(szExenam e, Len(ProcessName )) = LCase$(ProcessN ame) Then
isRunning = True
appCount = appCount + 1
Exit Do
Else
isRunning = False
End If
rProcessFound = ProcessNext(hSn apshot, uProcess)
Loop
Call CloseHandle(hSn apshot)
done:
End Function
Private Sub Command1_Click( )
Label1.Caption = isRunning(Text1 .Text)
End Sub
Frank R. Jr. wrote:[color=blue]
> confused on how to make it work i tried enter the code in did not well i
> mean it wouldnt run the test porgram
> Private subform Load (logitem as string)
> n%=FreeFile
> Open App.Path & "\" & App.aim.exe & ".log" For Output As n%
> Print n%, CStr(Now) & " " & logItem
> Close n%
> End Sub
> Is what i did is there something wrong here ?
> "Auric__" <not.my.real@em ail.address> wrote in message
> news:tlafj01bgk 56b8btmjtq28ia2 qvl09vggr@4ax.c om...
>[color=green]
>>On Thu, 2 Sep 2004 16:37:50 -0500, Frank R. Jr. wrote:
>>[color=darkred]
>>>How can u create a log in visual basic???[/color]
>>
>>Public Sub appLog (logItem as String)
>> n%=FreeFile
>> Open App.Path & "\" & App.EXEName & ".log" For Output As n%
>> Print n%, CStr(Now) & " " & logItem
>> Close n%
>>End Sub
>>
>>--[/color][/color]
G'day Frank,
Put both of these subs in the form.
Private Sub Form_Load ()
dim strTMP as string ' declare the variable to hold the text
strTMP = "The form is loading" ' fill with text
'call the sub writeLog and send with it the text
Call writeLog (strTMP)
End Sub
Private Sub writeLog(strLog as string)
Dim nFile As Byte 'declare the variable to hold the file
nFile = FreeFile 'get the available file number
'open the file "aim.log" so we can write to it.
Open App.Path & "\" & aim & ".log" For Output As n%
'write to the file , the time-date, a comma, and strLog.
Print nFile, CStr(Now) & " " & logItem
Close n% 'close the file
End Sub
after you run the app there will be a text file in the app folder called
"aim.log", rewad it with notepad.
I'm not very good at explainations, does this help?
btw, if you don't understand what a word does, select it and press F1.
cheers,
build
Comment