Open the browser loading page in C + + Builder

Source: Internet
Author: User
Tags microsoft outlook

today, when developing a project, it is required to implement an IP address that is queried based on the data and returned to the foreground to open with a browser. This stuff is very simple, huh. There are corresponding API functions in C + + Builder, let's talk about:

Calling external commands
If you use the default browser, call ShellExecute (null, _t ("open"), _t ("Explorer.exe"), _t ("http://www.baidu.com"), NULL, sw_show), or if you open with IE, Just call ShellExecute (null, _t ("open"), _t ("Iexplore.exe"), _t ("http://www.baidu.com"), null, sw_show);// In addition, there are other online explanations can use the API function ShellExecute specific usage can refer to the following: There are three Windows API functions can run executable files winexec, ShellExecute and CreateProcess. The function of  shellexecute is to run an external program (either open a registered file, open a directory, print a file, etc.) and have some control over the external program.   has several API functions to implement these functions, but in most cases shellexecute is more used, and it is not too complex.   Function prototype: hinstance ShellExecute (HWND hwnd,lpctstr lpoperation,lpctstr lpfile,lpctstr lpparameters,lpctstr Lpdirectory,int nshowcmd);  parameter description:   hwnd the name of the window  lpoperation the operation, such as "open", "print", "explore" respectively corresponding to " On, print, browse, or empty (""), this indicates a preset action. Lpfile the file to be manipulated. Lpparameters If lpfile specifies an executable file, the directory that represents the lpdirectory operation of the parameter nShowCmd how the new application will run. The values that are available are as follows: Sw_hide hidden sw_maximize maximized sw_minimize minimized, and the z Order order in the window after this window (that is, the next level of the window) starts the Sw_restore startup window and reverts to the initialization size Sw_show Start the window Sw_showdefault in its current size and status to run the Sw_showmaximized startup window in a preset manner and maximize the Sw_showminimized startup window and mostThe sw_showminnoactive minimizes but does not change the currently launched Window Sw_showna displays the window in its current state but does not change the currently launched window Sw_shownoactivate to initialize the size of the window but does not change the currently launched window Sw_ Shownormal Start and display the window, if the maximum (small), the window will be restored. This value should be used when running the program for the first time   example one: Open http://test.com website ShellExecute (Handle, "open", "http://test.com/", Nil,nil, Sw_ Shownormal);    if the filename parameter is set to the "mailto:" protocol format, then the function launches the default mail client program, such as Microsoft Outlook (also including Microsoft Outlook Express) or Netscape Messanger.   Example two: send a letter to [email protected] (User account @ Mail server address)  shellexecute (Handle, "open", "mailto: [email protected]", nil, Nil, SW_SHOWNORMAL); Opens the Write New message window and automatically fills in the recipient's location.  Here are some different uses: Start a new application ShellExecute (Handle, "open", "C:\test\app.exe", nil, Nil, sw_show); Open Notepad and open a file (the system can recognize the path of the Notepad application, so we do not have to use the absolute path) ShellExecute (Handle, "open", "notepad", "C:\test\readme.txt", Nil, sw_  SHOW);    ShellExecute (Handle, "print", "C:\test\test.doc", nil, Nil, sw_show); Note: You may see word temporarily turned on, but it will automatically close.

Open the browser loading page in C + + Builder

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.