能否把其他的程序嵌入到我的程序中? 客户要求把一个程序A(从别处购买),嵌入到要开发的程序中。我们的程序运行时,能在同在一个界面,查看另一个程序中的面面,对另外一程序进行操作。如果有办法另开帖给分。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 很早以前曾做过一个东东,是把两个程序(EXE)的界面合并,我是截断了程序中的Create做的,不过这两个程序都是很简单的程序,按照你的说法,这些商业软件不适合吧,很麻烦并且稳定性无法保证。 syy64(太平洋) 能否详细说一下。那个程序只是个exe程序,不是com的。 要不然用Winexe和GLuint WINAPI ProcessSelection(CMyDoc* m_pDoc, GLuint hits, GLuint buffer[], bool bCutTree){ unsigned int i; CString str, strCommand, strDisplay; GLuint names, *ptr, id, idd; int z1, z2, zmin; RECT ChildRect; ChildRect.left = 100; ChildRect.right = 400; ChildRect.top = 100; ChildRect.bottom = 300; zmin = -1; ptr = (GLuint*)buffer; for(i=0;i<hits;i++) { names = *ptr; ptr++; z1 = *ptr; ptr++; z2 = *ptr; ptr++; id = *ptr; ptr++; if(id==0)continue; if(zmin==-1) { zmin = z2; idd = id; } else if(z2<zmin) { zmin = z2; idd = id; } } if(bCutTree)return idd; if(idd<10) str.Format("0%u", idd); else str.Format("%u", idd); CString strPath; LPTSTR pszPath; CString strCommandLine; LPTSTR pszCommandLine; STARTUPINFO startup; PROCESS_INFORMATION process; BOOL tSuccess; strPath += _T( "hpvfp6vr.exe" ); memset( &startup, 0, sizeof( startup ) ); startup.cb = sizeof( startup ); startup.dwFlags = STARTF_USESHOWWINDOW|STARTF_USEPOSITION; startup.wShowWindow = SW_HIDE; startup.dwX = 400; startup.dwY = 100; memset( &process, 0, sizeof( process ) ); strCommandLine.Format( "\"%s\" %s %s", LPCTSTR( strPath ), "2", str); pszCommandLine = strCommandLine.GetBuffer( 0 ); tSuccess = CreateProcess( NULL, pszCommandLine, NULL, NULL, false, 0, NULL, NULL, &startup, &process ); strCommandLine.ReleaseBuffer(); if( tSuccess ) { // Close the handles that CreateProcess returned so we don't leak // kernel resources. ASSERT( process.hProcess != NULL ); CloseHandle( process.hProcess ); ASSERT( process.hThread != NULL ); CloseHandle( process.hThread ); } else { strDisplay = "hpvfp6vr.exe 运行文件没有发现,请检查路径是否正确,文件名是否有效!"; ::MessageBox(NULL, strDisplay, "错误:", MB_OK|MB_ICONQUESTION|MB_SETFOREGROUND); }/* strCommand.Format("hpvfp6vr %s %s", "2", str); if(::WinExec(strCommand, SW_HIDE)<=31) { strDisplay = "hpvfp6vr.exe 运行文件没有发现,请检查路径是否正确,文件名是否有效!"; ::MessageBox(NULL, strDisplay, "错误:", MB_OK|MB_ICONQUESTION|MB_SETFOREGROUND); } */ return idd; to: syy64(太平洋) 您提供的方法,运行稳定性如何? 用CreateProcess可以,去msdn查吧,不过是有点麻烦的.还有几个类似的叫winexe什么来着,简单一些,不过msdn不推荐使用.最好是ole了 你可以把要被迁入的exe设父窗口。你在你的程序里面用一个findwindows()找到窗口句柄,然后setparent(),将这个窗口的父窗口设置为你的exe的窗口。不过要注意界面位置,否则不美观 process monitor会自己生成64位进程,好奇讨论下 MFC 分割窗口后某一窗口显示多个view问题 关于#pragma pack(push,1) 问题 如何做到使别的应用程序钩不到指定的消息???? 如果我想要在鼠标移动到特定的窗口区域时,改变鼠标形状,我的代码如何写? 大侠们,SOS!!!!!!!!!!!!!! VC与DELPHI谁强谁弱? 请问如何读写NT下的I/O段口?多多帮助!! 神啊,救救我吧,我想知道在哪可以下载"TCP/IP详解"的源代码 ??? ToolBar的enable问题 winsock 控件实时性问题
能否详细说一下。那个程序只是个exe程序,不是com的。
GLuint WINAPI ProcessSelection(CMyDoc* m_pDoc, GLuint hits, GLuint buffer[], bool bCutTree)
{
unsigned int i;
CString str, strCommand, strDisplay;
GLuint names, *ptr, id, idd;
int z1, z2, zmin;
RECT ChildRect;
ChildRect.left = 100;
ChildRect.right = 400;
ChildRect.top = 100;
ChildRect.bottom = 300;
zmin = -1;
ptr = (GLuint*)buffer;
for(i=0;i<hits;i++)
{
names = *ptr;
ptr++;
z1 = *ptr;
ptr++;
z2 = *ptr;
ptr++;
id = *ptr;
ptr++;
if(id==0)continue;
if(zmin==-1)
{
zmin = z2;
idd = id;
}
else if(z2<zmin)
{
zmin = z2;
idd = id;
}
}
if(bCutTree)return idd;
if(idd<10)
str.Format("0%u", idd);
else
str.Format("%u", idd);
CString strPath;
LPTSTR pszPath;
CString strCommandLine;
LPTSTR pszCommandLine;
STARTUPINFO startup;
PROCESS_INFORMATION process;
BOOL tSuccess;
strPath += _T( "hpvfp6vr.exe" );
memset( &startup, 0, sizeof( startup ) );
startup.cb = sizeof( startup );
startup.dwFlags = STARTF_USESHOWWINDOW|STARTF_USEPOSITION;
startup.wShowWindow = SW_HIDE;
startup.dwX = 400;
startup.dwY = 100;
memset( &process, 0, sizeof( process ) ); strCommandLine.Format( "\"%s\" %s %s", LPCTSTR( strPath ), "2", str);
pszCommandLine = strCommandLine.GetBuffer( 0 );
tSuccess = CreateProcess( NULL, pszCommandLine, NULL, NULL, false,
0, NULL, NULL, &startup, &process );
strCommandLine.ReleaseBuffer();
if( tSuccess )
{
// Close the handles that CreateProcess returned so we don't leak
// kernel resources.
ASSERT( process.hProcess != NULL );
CloseHandle( process.hProcess );
ASSERT( process.hThread != NULL );
CloseHandle( process.hThread );
}
else
{
strDisplay = "hpvfp6vr.exe 运行文件没有发现,请检查路径是否正确,文件名是否有效!";
::MessageBox(NULL, strDisplay, "错误:", MB_OK|MB_ICONQUESTION|MB_SETFOREGROUND);
}/* strCommand.Format("hpvfp6vr %s %s", "2", str);
if(::WinExec(strCommand, SW_HIDE)<=31)
{
strDisplay = "hpvfp6vr.exe 运行文件没有发现,请检查路径是否正确,文件名是否有效!";
::MessageBox(NULL, strDisplay, "错误:", MB_OK|MB_ICONQUESTION|MB_SETFOREGROUND);
} */
return idd;
您提供的方法,运行稳定性如何?
还有几个类似的叫winexe什么来着,简单一些,不过msdn不推荐使用.
最好是ole了
你在你的程序里面用一个findwindows()找到窗口句柄,然后setparent(),将这个窗口的父窗口设置为你的exe的窗口。不过要注意界面位置,否则不美观