1.

Solve : Using Windows API?

Answer»

Hello everyone,
I need help as i am new to this.
What i WANT is someone to help me out how to use windows api functions(function in dll files provided by windows) in a sample c program.

also if there are some good and illustrative web links or books regarding my question above, please do post it.

thank you. Quote from: HardwareTwitch on October 10, 2012, 12:44:22 AM

also if there are some good and illustrative web links or books regarding my question above, please do post it.

http://msdn.microsoft.com/en-us/library/windows/desktop/hh447209%28v=vs.85%29.aspxcan an1 help me with simple sample program in c(not using gui mainly but any other api function that can be implemented without gui) so i can see its output console based or anything
thank youQuote from: HardwareTwitch on October 13, 2012, 12:51:43 AM
can an1 help me with simple sample program in c(not using gui mainly but any other api function that can be implemented without gui) so i can see its output console based or anything
thank you

Code: [SELECT]
#include "stdafx.h"

#include <windows.h>
#include <VdmDbg.h>

BOOL WINAPI ProcessVDMs( DWORD, DWORD, LPARAM );
BOOL WINAPI ProcessTasks( DWORD, WORD, WORD, PSZ, PSZ, LPARAM );

#pragma comment( lib, "vdmdbg.lib" )

void main()
{
// Enumerate VDMs
VDMEnumProcessWOW(
(PROCESSENUMPROC)ProcessVDMs,
(LPARAM)NULL
);

}

BOOL WINAPI ProcessVDMs( DWORD dwProcessId, DWORD dwAttrib,
LPARAM t )
{
printf("VDM Process ID: %d\n", dwProcessId);

// Use process ID of VDM to enumerate through its tasks
VDMEnumTaskWOWEx(
dwProcessId,
(TASKENUMPROCEX)ProcessTasks,
(LPARAM)NULL
);

// Keep enumerating
return FALSE;
}

BOOL WINAPI ProcessTasks( DWORD dwThreadId, WORD hMod16, WORD hTask16,
PSZ pszModName, PSZ pszFileName, LPARAM lParam )
{
// Print task's information
printf("ThreadID: %d\n", dwThreadId);
printf("Module: %d\n", hMod16);
printf("Task: %d\n", hTask16);
printf("ModName: %s\n", pszModName);
printf("File: %s\n", pszFileName);

// Keep enumerating
return FALSE;
}




Source and Binary graciously provided by the handsome fellow that runs this site.


I think you might be tripping over standard HEADER file stuff; the Windows API for C is not USED much differently than other APIs, you include the header file (#include ) and then you call functions to interact with the Windows OS.Quote from: BC_Programmer on October 13, 2012, 03:57:01 AM
Code: [Select]
#include "stdafx.h"

#include <windows.h>
#include <VdmDbg.h>

BOOL WINAPI ProcessVDMs( DWORD, DWORD, LPARAM );
BOOL WINAPI ProcessTasks( DWORD, WORD, WORD, PSZ, PSZ, LPARAM );

#pragma comment( lib, "vdmdbg.lib" )

void main()
{
// Enumerate VDMs
VDMEnumProcessWOW(
(PROCESSENUMPROC)ProcessVDMs,
(LPARAM)NULL
);

}

BOOL WINAPI ProcessVDMs( DWORD dwProcessId, DWORD dwAttrib,
LPARAM t )
{
printf("VDM Process ID: %d\n", dwProcessId);

// Use process ID of VDM to enumerate through its tasks
VDMEnumTaskWOWEx(
dwProcessId,
(TASKENUMPROCEX)ProcessTasks,
(LPARAM)NULL
);

// Keep enumerating
return FALSE;
}

BOOL WINAPI ProcessTasks( DWORD dwThreadId, WORD hMod16, WORD hTask16,
PSZ pszModName, PSZ pszFileName, LPARAM lParam )
{
// Print task's information
printf("ThreadID: %d\n", dwThreadId);
printf("Module: %d\n", hMod16);
printf("Task: %d\n", hTask16);
printf("ModName: %s\n", pszModName);
printf("File: %s\n", pszFileName);

// Keep enumerating
return FALSE;
}




Source and Binary graciously provided by the handsome fellow that runs this site.


I think you might be tripping over standard header file stuff; the Windows API for C is not used much differently than other APIs, you include the header file (#include <windows.h>) and then you call functions to interact with the Windows OS.

thank you very much and 1 more question..
the microsoft link you gave me in above have those functions which you provided in the example?


Discussion

No Comment Found