Summary of the invention
Technical matters to be solved by this invention provides a kind of method of making general graphical interface in application program, and the general graphical interface of made can run under any figure API.
For solving the problems of the technologies described above, the present invention makes general graphical interface in application program method comprises the steps:
In the 1st step, original application program is written into described embedding program by embedding insmoding of program, and described embedding program comprises described insmoding, and also comprises driver module and control module;
The 2nd step, described insmoding to graphics engine or the graphics hardware API application rendered images of original application program; Described insmoding obtains the priority processing power of windows message to the original application program application;
In the 3rd step, the picture that described driver module was applied for based on the 2nd step provides graphics software API to described control module; Described driver module is transmitted windows message to described control module, and described control module is back to original application program to the feedback of windows message;
In the 4th step, described control module is called the graphical interfaces of extraneous application program, and perhaps described control module is write application program voluntarily and gathered its graphical interfaces, and this graphical interfaces is shown in the picture that the 2nd step institute applies for drafting.
The invention provides a kind of embedding program, comprise insmod, driver module and control module.Insmoding wherein is loaded into original application program with described embedding program, and driver module provides a kind of graphics software API for control module.No matter control module is called the external graphics interface is still write graphical interfaces voluntarily, all only depends on the graphics software API that driver module provides, and does not rely on graphics engine or the graphics hardware API of original application program.Therefore, the invention provides a kind of method of making general graphical interface in application program, described graphical interfaces can be applied to the application program based on any graphics engine or graphics hardware API.
Embodiment
See also Fig. 2, the present invention makes general graphical interface in application program method comprises the steps:
The 1st step insmoded and be written into the embedding program in original application program, and described embedding program comprises described insmoding, and also comprises driver module and control module;
Be written into the embedding program in original application program, can adopt the hook technology, this is a kind of comparatively proven technique, need not carry out any modification to original application program; Also can be written into instruction in the ad-hoc location adding of original application program, this need carry out trickle change to original application program;
The 2nd step, described insmoding to graphics engine or the graphics hardware API application rendered images of original application program; Described insmoding obtains the priority processing power of windows message to the original application program application;
The application rendered images is the basic functions that any graphics engine or graphics hardware API all have, and the right of priority that application obtains windows message is that original application program can provide;
In the 3rd step, the picture that described driver module was applied for based on the 2nd step provides graphics software API to described control module; Described driver module is transmitted windows message to described control module, and described control module is back to original application program to the feedback of windows message;
The driver module of described embedding program is equivalent to provide a graphics software API for control module, make control module basis this graphics software API exploitation to have the application program of graphical interfaces, and need not consider graphics engine or the graphics hardware API of original application program; Simultaneously driver module just bear the responsibility between original application program and the control module windows message and at the mutual transmission work of the feedback of windows message;
In the 4th step, described control module is called the graphical interfaces of the application program outside original application program and the embedding program; Perhaps described control module provides a programmed environment, can write the application program with graphical interfaces voluntarily in control module, and gathers the graphical interfaces of the application program of writing.The graphical interfaces that described control module will be called in or gather again is shown in the 2nd and goes on foot the picture of applying for.
The development structure synoptic diagram that adopts said method to make graphical interfaces sees also Fig. 3, because the driver module of the program of embedding provides a kind of graphics software API for control module, no matter the graphical interfaces of control module calling external program still voluntarily coding gather graphical interfaces, all only depend on the graphics software API that driver module provides, and do not rely on graphics engine or the graphics hardware API of original application program.
Now give more concrete elaboration with two specific embodiments to the method for the invention below:
One adopts the method for the invention to insert IE in the 3D recreation.
Because the 3D recreation is based on DirectX or OpenGL exploitation, and IE is based on the GDI exploitation, so existing technical scheme can't embed IE in the 3D recreation.
Adopt the method for the invention, can be implemented in the 3D recreation and insert IE, specifically comprise the steps:
The 1st step insmoded and adopts the hook technology to be written into the embedding program in the 3D recreation, need not carry out any modification to this 3D recreation; Described embedding program comprises described insmoding, and also comprises driver module and control module;
The 2nd step, described insmoding to graphics engine or the graphics hardware API application rendered images of 3D recreation; Described insmoding also obtains the priority processing power of windows message to this 3D recreation application;
In the 3rd step, the picture that described driver module was applied for based on the 2nd step provides graphics software API to described control module; Described driver module is transmitted windows message to described control module, and described control module is back to this 3D recreation to the feedback of windows message;
In the 4th step, described control module is called the graphical interfaces of IE, and the graphics software API that provides by described driver module is shown in the described picture that insmods and apply for.
Its two, adopt the method for the invention in video, to insert an interactive program.
Generally, can't embed application program in the video, have only part DVD video to support some simple interactive programs.
Adopt the method for the invention, can be implemented in and insert any interactive program in the video, specifically comprise the steps:
The 1st step insmoded and adopts the hook technology to be written into the embedding program in video, need not carry out any modification to this video; Described embedding program comprises described insmoding, and also comprises driver module and control module;
The 2nd step, described insmoding to graphics engine or the graphics hardware API application rendered images of video; Described insmoding also obtains the priority processing power of windows message to this video application;
In the 3rd step, the picture that described driver module was applied for based on the 2nd step provides graphics software API to described control module; Described driver module is transmitted windows message to described control module, and described control module is back to this video to the feedback of windows message;
In the 4th step, described control module provides a programmed environment, writes an interactive program by described control module, and the graphics software API that the picture surface of this interactive program provides by described driver module is shown in the described picture that insmods and apply for.
In sum, it no matter is the recreation texture mode based on static resource, still based on the video mode of dynamic resource, the present invention all can make graphical interfaces in application program, and the graphical interfaces of made can also use in various different applications.This has simplified greatly and has been the complicated process at different application customized graphics interface.