Windows is a message-driven operating system, so you can use messages to operate any controls in windows. In Windows, a large number of APIs are open to users. Users can use these APIs to operate controls in Windows from the underlying layer and use messages, the following uses C # To operate IE browser through Win32 API --- to obtain ie url as an example: As for the prototype of
toPostQuitMessage ()the value, here you can ignore it, fromWinMain ()The return value will be used in the exit code for the end of the process. Focus : Getmessgae () will return 1 If there is an error, be sure to remember this, or at some point you will have a sore egg ... Even if GetMessage () is defined to return a Boolean value, it can also return a value other than TRUE or FALSE , because BOOL is defined using a UINT(unsigned int). The following code example may work, but the condition wil
we need to define such an enumeration? Where do the two passwords 0x000000a9 and 0x001f01ff come from in hexadecimal notation? Isn't this enumeration or macro defined in MSDN?
In fact, MSDN does have several predefined values that can be ea. the macro assigned by grfAccessPermissions. The two hexadecimal numbers above are a DWORD switch variable related to setting file system security, named ACCESS_MASK. For specific definitions, refer to MSDN. The header file of the
initiated the application ./// Public Const intSw_showdefault =Ten; /// ///minimizes the window, even if the thread that owns the window is suspended. Use this parameter when minimizing windows from other threads/// Public Const intSw_forceminimize = One; #endregion[DllImport ("user32.dll", EntryPoint ="ShowWindow")] Public Static extern BOOLShowWindow (inthwndintncmdshow); }Call the ShowWindow method in WPF:User32api.showwindow (new System.Windows.Interop.Wind
1.SetTimer (Hwnd,uint,uint,timerproc); The first parameter is set to capture the window handle of the timed message, the second parameter is the timer's ID, the third is the timing length in milliseconds, the last parameter is set to NULL, You can make the window's callback function handle the WM_TIMER message. In general, the SetTimer call is made when the window is created, and the wm_timer response is added to the callback function. Then the window is destroyed when the timer is destroyed: Ki
, IntPtr.Zero, "Tpanel", "Print Preview");
What I want to say is: Parameter hwndchildafter can write IntPtr.Zero,lpszclass and Lpszwindow can be null.
I usually use the enumeration method: Enumerate the list of all the handles of this window, and then filter the list to get the desired handle. On the code:[DllImport ("user32.dll", ExactSpelling = True)]public static extern bool Enumchildwindows (IntPtr hwndparent, Enumwindowsproc lpenumfunc, int lParam); [DllImport ("User32.dll")]public
the filenNumberOfBytesToRead: Specifies the number of bytes read from the fileLpnumberofbytesread: The number of bytes used to receive the actual readlpoverlapped: A pointer to the overlapped struct, this parameter to work, you must add the file_flag_overlapped tag when CreateFile open the File Settings file property, telling the system to access the file asynchronously. By default, it is accessed in the form of synchronous IOCases:Define a handle variable handle hfile;//Create a file hfile = C
invalidate them.public static extern int Enablescrollbar (INTPTR hWnd, UINT flags, uint arrows);This function sets the specified window to the top of the z-order.public static extern int BringWindowToTop (IntPtr hWnd);The function scrolls the directory for the specified form client area.static public extern int Scrollwindowex (IntPtr hWnd, int dx, int dy,ref rect rcscroll, ref RECT Rcclip, IntPtr Updateregio N, ref RECT rcinvalidated, UINT flags);The function determines whether the given window
If we need to use the writeprivateprofilestring of the Win32 API functionFor this function, we first need to declare this function in the form that calls this function.If we want to execute it in the click function of a button, we should write it like this
* -- Define write applicationProgramDLL Functions of INI filesDeclare integer writeprivateprofilestring in WIN32API as writeprivstr;String csection,
Reprinted:
Globalmemorystatus, Win32 API function.
This function is used to obtain available physical and virtual memory information. The function is defined:
Void globalmemorystatus(Lpmemorystatus lpbuffer);
This function has no return value. The parameter is a pointer to the structure named memorystatus. The returned information of the function is stored in the memorystatus structure.
This function is u
In the previous section, we learned about creating a window, and then we created the button on the window and clicked the action.1, open vc++6.0, click File--Open Workspace Select example1, click OK, open the project.2, add codeDefine Global variables FirstHWND button1;Change the callback function as followsLRESULT CALLBACK Winsunproc (HWND hwnd,uint umsg,wparam wparam,lparam LPARAM)//callback function definition{Switch (umsg){Case WM_CREATE:Button1=createwindow ("button", "First key", ws_visibl
Second, the conceptual model of MFC
We have studied the "domain model" of the WIN32 API, and have a more comprehensive understanding of it. Next, we focus on the research on the app framework for the study of the MFC conceptual model.
The message response/delivery mechanism in the app framework is the most important. The hook mechanism is closely related to the message response/transfer mechanism, and the
In Visual Studio 2005 or a later version, you can use APIs to create a tootip. After creation, messages such as ttm_addtool will fail to be sent because the loaded commctrl dll version does not match. The solution is as follows:
1. Change # DEFINE _ win32_winnt 0x0501 to # DEFINE _ win32_winnt 0x0500 in the stdafx. h file.
2. Add the following code before # include "commctrl. H" # pragma comment (Lib, "comctl32.lib:
# If _ win32_winnt> 0x0500
# If defined _ m_ix86# Pragma comment (linker, "/ma
charset is not specified, the default value charset. Auto is used.C. The entrypoint parameter specifies the name of the DLL entry point. If entrypoint is not specified, the method name is used.D. The exactspelling parameter indicates whether the entrypoint must exactly match the spelling of the indicated entry point. If exactspelling is not specified, use the default value false.E. The preservesig parameter indicates whether the method signature should be retained or converted. When the signatu
masks the asynchronous, non-blocking concepts of the socket, and the developer does not need to understand the principle and working mechanism of asynchronous, nonblocking sockets. Therefore, it is recommended that beginners learn to compile the network communication program, but do not use MFC provides classes, and first with the Winsock2 API, which helps to understand the asynchronous, non-blocking socket programming mechanism.For simplicity, both
Below is a clear document for the allocation of Win32 resources found in a browser, which simply translates a few texts. TheThis document is of great help to prevent resource leaks.========================================================== ==========================================================Does the resource allocation function need to be cleared manually?========================================================== ================================
In response to longware's feedback this afternoon, we found that some Win32 APIs such as findwindow, findjavaswex, and sendmessage may fail in Windows 7 in some cases.
The discovery process was as follows: longware users reported my experiment in "screen recording function Technology Exploration and sharing ".ProgramThe screen recording process cannot be completed normally in Windows 7. After my workshop test, I found that the findwindowauto used in
When I first came into contact with this problem, I found that the API provides a COM interface call, And IShellLink will allow you to create a shortcut. You need to create a shortcut on the desktop, you just need to save the shortcut to the desktop directory. However, you need to understand the calling method of this COM interface and some API usage problems, such as CreateShortCut, which is very cumbersom
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.