Some links to start you off.
http://msdn.microsoft.com/en-us/libr...91(VS.85).aspx
http://www.microsoft.com/msj/0898/idl/idl.aspx
The files you need are on the Platform SDK CD.
The following code demonstrates how to invoke the MIDL compiler.
Code:
FUNCTION Compile() AS LONG LOCAL szCmdLine AS ASCIIZ * 4096 LOCAL szTargetDir AS ASCIIZ * %MAX_PATH LOCAL szCL AS ASCIIZ * %MAX_PATH LOCAL szIncl AS ASCIIZ * %MAX_PATH LOCAL tsa AS SECURITY_ATTRIBUTES LOCAL tpi AS PROCESS_INFORMATION LOCAL tsi AS STARTUPINFO LOCAL lRet AS LONG GetShortPathName "C:\Program Files\Microsoft SDK\Bin\Win64\cl.exe", szCL, %MAX_PATH GetShortPathName "C:\Program Files\Microsoft SDK\include\", szIncl, %MAX_PATH ' Build the command for invoking the Windows resource compiler ' ------------------------------------------------------------ szCmdLine = $DQ + "C:\Program Files\Microsoft SDK\Bin\midl.exe" + $DQ + _ " /nologo /env win32 /cpp_cmd " + szCL + _ " /I" + szIncl + _ " /tlb F:\Support\BHO\BHO.tlb" + _ " F:\Support\BHO\BHO.idl" szTargetDir = "F:\Support\BHO\" WriteLogFileHeader "F:\Support\InvokeMidl\log.txt", VARPTR(szCmdLine), LEN(szCmdLine) ' Create the pipe for communicating with the console process tsa.nLength = SIZEOF(tsa) tsa.bInheritHandle = %TRUE IF ISTRUE CreatePipe(BYVAL VARPTR(ghReadPipe), BYVAL VARPTR(ghWritePipe), BYVAL VARPTR(tsa), 256 * 1024) THEN tsi.cb = SIZEOF(tsi) tsi.lpReserved = %NULL tsi.lpDesktop = %NULL tsi.lpTitle = %NULL tsi.dwX = 0 tsi.dwY = 0 tsi.dwXSize = 0 tsi.dwYSize = 0 tsi.dwXCountChars = 0 tsi.dwYCountChars = 0 tsi.dwFillAttribute = 0 tsi.dwFlags = %STARTF_USESTDHANDLES OR %STARTF_USESHOWWINDOW OR %STARTF_FORCEONFEEDBACK tsi.wShowWindow = %SW_HIDE tsi.cbReserved2 = 0 tsi.lpReserved2 = %NULL tsi.hStdInput = 0 tsi.hStdOutput = ghWritePipe tsi.hStdError = ghWritePipe lRet = CreateProcess(BYVAL %NULL, BYVAL VARPTR(szCmdLine), BYVAL %NULL, BYVAL %NULL, %TRUE, _ %CREATE_SUSPENDED OR %NORMAL_PRIORITY_CLASS OR %CREATE_SEPARATE_WOW_VDM, BYVAL %NULL, _ BYVAL VARPTR(szTargetDir), BYVAL VARPTR(tsi), BYVAL VARPTR(tpi)) ' The child process gets a copy of this handle CloseHandle ghWritePipe IF ISFALSE lRet THEN CloseHandle ghReadPipe EXIT FUNCTION END IF ResumeThread tpi.hThread ' Close the thread handle as soon as it is no longer needed CloseHandle tpi.hThread WaitForSingleObject tpi.hProcess, %INFINITE IF ghReadPipe THEN GetConsoleOutputVPB "F:\Support\InvokeMidl\log.txt" CloseHandle ghReadPipe END IF CloseHandle tpi.hProcess END IF END FUNCTION
Leave a comment: