原帖由 rap2009 于 2008-4-17 21:59 发表
你的意思是,你做那个软件页面,非最小化时是置顶显示吗?
我运行一下,没有置顶。我没有装vc,我装了后再试试吧,还有你那个动库是实现置顶的吧,那没有源码啊,我自己试试吧。 不会把?我前不久才用完,是置顶的(即总在最前),不需要装vc。你要按照我写的说明文字来下载正确的版本。如果确实不行,那你告诉我你用的 matlab 版本
源码就没有了,其实就两行代码,你到 simwe 论坛搜索一下吧,taohe 老大的作品
——居然让我找到了,哈哈:
-
- /*=================================================================
- * mexwndontop ---- makes an MATLAB window always on top
- *
- * Use this command-line to compile in MATLAB:
- * mex mexwndontop.cpp user32.lib
- *
- * Input ---- A string
- * Output ---- None
- *
- * Created by: taohe for simwe forum
- *=================================================================*/
- /* $Revision: 1.10 $ */
- #include <windows.h>
- #include "mex.h"
- void mexFunction( int nlhs, mxArray *plhs[],
- int nrhs, const mxArray*prhs[] )
-
- {
- char *input_buf;
- int buflen,status;
- /* Check for proper number of arguments */
- if (nrhs != 1) {
- mexErrMsgTxt("One input argument required.");
- } else if (nlhs > 1) {
- mexErrMsgTxt("Too many output arguments.");
- }
- /* Input must be a string. */
- if (mxIsChar(prhs[0]) != 1)
- mexErrMsgTxt("Input must be a string.");
- /* Input must be a row vector. */
- if (mxGetM(prhs[0]) != 1)
- mexErrMsgTxt("Input must be a row vector.");
- /* Get the length of the input string. */
- buflen = (mxGetM(prhs[0]) * mxGetN(prhs[0])) + 1;
- /* Allocate memory for input and output strings. */
- input_buf = (char *)mxCalloc(buflen, sizeof(char));
- /* Copy the string data from prhs[0] into a C string
- * input_buf. If the string array contains several rows,
- * they are copied, one column at a time, into one long
- * string array. */
- status = mxGetString(prhs[0], input_buf, buflen);
- if (status != 0)
- mexWarnMsgTxt("Not enough space. String is truncated.");
- /* Do the actual computations in a subroutine */
- //mexWarnMsgTxt(input_buf);
- HWND hWnd;
- hWnd = FindWindow(NULL, input_buf);
- SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 1, 1, SWP_NOSIZE | SWP_DRAWFRAME);
- return;
- }
复制代码
[ 本帖最后由 eight 于 2008-4-17 22:23 编辑 ] |