Jump to content


Check out our Community Blogs

mnirahd

Member Since 29 Oct 2010
Offline Last Active Jun 08 2012 03:17 AM
-----

Posts I've Made

In Topic: Finding Logged On Username From A Service(Windows 7, Vista)

08 June 2012 - 03:14 AM

Yep, using WTSAPI helped. the logged on user session is always of type 'Interactive'. Enumerating through all session and getting username for interactive session type helped to find out correct logged on user name.

Thanks for your help

-Munir

In Topic: [SOLVED] Capturing User Activity Events From A Windows Service

08 June 2012 - 03:12 AM

Thanks,

I figured out that the best way was to capture the events for SessionChangeEvent in service as suggested by Kernel. However BlackRabbit answer helped me a lot because i need to wait for a session which is started as interactive.

Thanks both of you. Thumbs up!

In Topic: [SOLVED] Creating Thread And Calling The Class Member Function

06 June 2012 - 08:57 AM

1. First you need to pass the class object as argument to the thread routines. Do you know how to use CreateThread function? If not, look at


HANDLE WINAPI CreateThread(
  __in_opt   LPSECURITY_ATTRIBUTES lpThreadAttributes,
  __in	   SIZE_T dwStackSize,
  __in	   LPTHREAD_START_ROUTINE lpStartAddress,
  __in_opt   LPVOID lpParameter,
  __in	   DWORD dwCreationFlags,
  __out_opt  LPDWORD lpThreadId
);

Further studies,
http://msdn.microsof...3(v=vs.85).aspx

pass pointer to your class object to CreateObject function which is 4th argument.

2. You will have to define a thread routine that will be called as a result of CreateThread. Here you have one argument which is a void pointer. You can cast this to your class pointer
and can make use of your class within the thread.

Example:

   DWORD MyThreadRoutine(LPVOID myClassObj)
  {
			CMyClass *obj = (CMyClass *) myClassObj; //assuming the class you're using is CMyClass

			 obj->method1();
			 obj->method2();
			//whatever you like
  }

//main function

int main()
{
		 CMyClass obj;
		 DWORD threadID;
		 HANDLE ThreadHandle = CreateThread(0,
						 0,
						(LPTHREAD_START_ROUTINE) MyThreadRoutine,   //passing your routine function pointer
						&obj, //your object
						0,
						&threadID);

		 //wait for thread to finish - or do something else
}

In Topic: [SOLVED] Error Compiling C Program For Creating Windows Applications

06 June 2012 - 08:40 AM

A program database (PDB) file holds debugging and project state information that allows incremental linking of a Debug configuration of your program.

For further information, look at

http://msdn.microsof...1(v=vs.71).aspx

In Topic: Finding Duplicate Entries In A Log File

25 May 2012 - 08:29 AM

Merge sort can be an option if we sort small chunks of data first, write it back to disk and than iterate over those to sort all(and off course, filtering the identical one). External sort can be also a choice. http://en.wikipedia....xternal_sorting

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download