|
本帖最后由 coohit 于 2016-8-16 10:05 编辑
不错,在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.vibunion.com/thread-147956-1-1.html
至于java的UNDOCUMENTED属性,个人建议少用或者不用,其中一些在后续版本中将被取消,例如javaframe属性。 |
评分
-
2
查看全部评分
-
|