VC development application Q & A

zhaozj2021-02-11  225

VC development application Q & A

Lin Qi January 09, 2001 19:16

In Microsoft's development tools, VC is still the most popular development tool, and a large number of developers have developed using VCs. When developing a VC application, we will encounter some common problems. After a summary, the general solution is given, hoping to help everyone. Q: The application often needs to start other programs, how to load, how many methods are better? Which is better? A: There are three SDK functions WINEXEC, Shellexecute, and createProcess can be loaded. Where Winexec is the simplest, two parameters, the previous specified path, the latter specified display mode, if the display mode is sw_showmaxmize, if a program without maximizing the button is loaded, there will be no normal Forms, but will appear in the list of task. Shellexecute is flexible than Winexex, you can specify a work directory. CreateProcess is the most complex, there are ten parameters, but most of them can be replaced with null, which can specify the security attributes of the process, inherit information, priority of the class, and more. In short, flexibility and simplicity are inversely ratio, you can decide which function to use according to the specific situation. Q: I define a handle for WM_LButtondown in cparentView, but when I build a new cchildview, the handle is not dealt with, why? A: It is very likely that there is a problem in the childview_map in the Childview file, especially if this is easy to happen, such as matching the base class in the parameter of Begin_Message_Map (Child, Parent). You can also check if the class name and the parent class name in the message image macro are correct. If you use your own message handle to manually replace the wizard, you must guarantee that there is no mistake, a wrong parameter or add one " Const "will change the message image, resulting in not being called correctly. Q: When developing an application, it is important to determine the path to the application. How do I automatically determine the path of the application? A: You can use getModuleFileName to get the application's path, but this function will return along with the execution file name, of course, you only use the string operation to remove the final execution file name. In fact, in program development, it is also possible to use the following set of directories, and the corresponding call functions are listed below, I hope to help you. Windows directory: getWindowsDirectory Windows System Directory: getSystemDirectory Temp Directory: GetTemp_ Current Directory: getCurrentDirectory Q: System parameters tend to determine some operational properties, so how to implement system parameters in the program? A: Here is a very critical SDK function SystemParametersInfo. Calling this function can query and set system parameters, such as the repeated rate setting of the button, the mouse double-click delay time, the icon font, and desktop wallpaper, etc., especially the first parameter determines which type of system parameter, such as spif_geticontitlelogfont (Icon Title Font), SPI_SETDESKWALLPAPER (Desktop Wallpaper), etc.

转载请注明原文地址:https://www.9cbs.com/read-4557.html

New Post(0)