| View previous topic :: View next topic |
| Author |
Message |
Sanjuro Contributor


Joined: 01 May 2003 Posts: 59 Location: Norfolk-United Kingdom
|
Posted: Mon Sep 08, 2003 4:15 pm Post subject: Create Event log entries? |
|
|
I would like the ability to create an entry in the event log/eventvwr fror my apps. Something along the lines of :
EVENT CREATE,<SECTION>,<TYPE>,<SOURCE>,<CATEGORY>,<ID>,<MESSAGE>
E.g.
EVENT CREATE, APPLICATION, Warning, SanjuroAPP, (4), 1001, SanjuroApp has closed because it failed to find the file %%FILE at the location %%LOC.
I know that their are 3rd party command line apps that will do this for me but inside VDS is better
Sanjuro _________________ "Apparently three out of four people make up 75 percent of the population.  |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Wed Sep 10, 2003 5:20 pm Post subject: |
|
|
I think you need an API called ReportEvent among others which requires 9 parameters in @LIB() function. As far as I know VDS supports only 8 parameters in any near foreseeable future So it is not possible in pure VDS. You may consider using external DLL's/gadget if U want or stick to the command line app. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Sep 10, 2003 7:28 pm Post subject: |
|
|
| CodeScript wrote: | I think you need an API called ReportEvent among others which requires 9 parameters in @LIB() function. As far as I know VDS supports only 8 parameters in any near foreseeable future So it is not possible in pure VDS. You may consider using external DLL's/gadget if U want or stick to the command line app. |
Well Actually CodeScript there is a way to get around this limitation but I was not going to say anything Anyway what you would have to do is this.
| Code: | LoadLib advapi32.dll
%A = @binary(word,%%fwEventType)@binary(word,%%fwCategory)
%%Ret = @lib(advapi32,ReportEvent,BOOL:,%%EventHandle,%A,%%IDEvent,%%pUserSid,%%cStrings,%%cbData,STR:%%plpszStrings,%%pvData)
|
The code above my not work depending on how VDS pushes the parameters onto the call stack for the functions. Usually you can combine parameters into a structure and pass the value of the structure to the function. In windows functions read the stack and pull the parameters off of the stack according to the variable type of the parameter so combining parameters into a structure should not matter. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Sep 11, 2003 2:31 am Post subject: |
|
|
Thanks mindpower for the suggestion.
I had tried similar trick earlier with an API. It said invalid parameters sometimes and sometimes the IDE just crashed. I have to try in this case though what happens. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Sep 11, 2003 9:58 am Post subject: |
|
|
No It doesn't work and sometimes the app appears to go crazy. I think the whole heap gets corrupted or something.
GetLastError gives 998 == Invalid access to memory location. The same thing occured with previous attempts with some other API.
mindpower did U get it working with any APIs. If so please let me know I will give that a try.
Also I am waiting for the VDS update which is going to increase the parameter limit to 12 as Jules said. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Thu Sep 11, 2003 3:05 pm Post subject: |
|
|
| CodeScript wrote: | No It doesn't work and sometimes the app appears to go crazy. I think the whole heap gets corrupted or something.
GetLastError gives 998 == Invalid access to memory location. The same thing occured with previous attempts with some other API.
mindpower did U get it working with any APIs. If so please let me know I will give that a try. |
I have not tried this CodeScript. I was afraid of the heap being corrupted. I guess you can't do this little trick with VDS then. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Thu Sep 11, 2003 7:23 pm Post subject: |
|
|
| Dr. Dread wrote: | .. or give Mac's VDSUG.dll a go - it supports up to 20 parameters when calling non-VDS DLLs.
Greetz
Dr. Dread |
Yeah but this one requires passing parameters by ref I have to try.
Any way :
I have written a sample code. This should hopefully work after the VDS update
http://codescript.vdsworld.com/VDS5src/NTeventlog.zip _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
|