- 帖子
- 333
- 在线时间
- 1030 小时
- 积分
- 153
- 威望
- 118 点
- 体能
- 895 点
- 储备体能
- 0 点
- 管理积分
- 0 点
- 推广积分
- 0 点
- 性别
- 男
- 注册时间
- 2005-11-18
- 最后登录
- 2012-5-17
- 帖子
- 333
- 积分
- 153
- 威望
- 118 点
- 体能
- 895 点
|
不错,在mathworks的fileexchange的那个链接下有一个.c文件可以看出,老外也是写了一个C-MEX调用windows的API实现的:- void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
- {
- /* declare variables */
- HWND hWnd;
- long nStyle;
- int strLength;
- char *windowname, *resizeState;
- /* length of the string */
- strLength = mxGetN(prhs[0])+1;
- /* allocate memory for the window name */
- /* MATLAB frees the allocated memory automatically */
- windowname = mxCalloc(strLength, sizeof(char));
- /* copy the variable from MATLAB */
- mxGetString(prhs[0],windowname,strLength);
- /* length of the string */
- strLength = mxGetN(prhs[1])+1;
- /* allocate memory for the resize state */
- /* MATLAB frees the allocated memory automatically */
- resizeState = mxCalloc(strLength, sizeof(char));
- /* copy the variable from MATLAB */
- mxGetString(prhs[1],resizeState,strLength);
- /* handle of the window */
- hWnd = FindWindow(NULL,windowname);
- /* get current window style */
- nStyle = GetWindowLong(hWnd,GWL_STYLE);
- /* make sure that the window can be resized */
- SetWindowLong(hWnd,GWL_STYLE,nStyle | WS_MAXIMIZEBOX);
- /* maximize window */
- ShowWindow(hWnd,SW_MAXIMIZE);
- /* window is not resizable */
- if(strcmp(resizeState,"off") == 0)
- {
- /* restore the settings */
- SetWindowLong(hWnd,GWL_STYLE,nStyle);
- }
- /* redraw the menu bar */
- DrawMenuBar(hWnd);
- }
复制代码 与SCIE的程序如出一辙。SCIE还曾经写过一个很有用的,用于获得figure窗口句柄的函数:
http://forum.simwe.com/thread-779810-1-3.html
至于java的UNDOCUMENTED属性,个人建议少用或者不用,其中一些在后续版本中将被取消,例如javaframe属性。 |
-
2
查看全部评分
-
|