|
|
|
Associated Browser Functions |
|
Functions |
|
|
LaunchConnectionDialog LaunchInternetControlPanel |
LaunchPrivacyDialog LaunchSecurityDialog
|
|
LaunchConnectionDialog |
|
Launches the Internet Properties dialog box with the Connections tab displayed.
Parameters
Return Value
|
|
DECLARE FUNCTION LaunchConnectionDialog _ LIB "inetcpl.cpl" _ ALIAS "LaunchConnectionDialog" ( _ BYVAL hParent AS DWORD _ )
AS LONG |
|
LaunchInternetControlPanel |
|
Launches the Internet Properties dialog box with the General tab displayed.
Parameters
Return Value
|
|
DECLARE FUNCTION LaunchInternetControlPanel _ LIB "inetcpl.cpl" _ ALIAS "LaunchInternetControlPanel" ( _ BYVAL hParent AS DWORD _ )
AS LONG |
|
LaunchPrivacyDialog |
|
Launches the Internet Properties dialog box with the Privacy tab displayed.
Parameters
Return Value
|
|
DECLARE FUNCTION LaunchPrivacyDialog _ LIB "inetcpl.cpl" _ ALIAS "LaunchPrivacyDialog" ( _ BYVAL hParent AS DWORD _ )
AS LONG |
|
LaunchSecurityDialog |
|
Launches the Internet Properties dialog box with the Security tab displayed.
Parameters
Return Value
|
|
DECLARE FUNCTION LaunchSecurityDialog _ LIB "inetcpl.cpl" _ ALIAS "LaunchSecurityDialog" ( _ BYVAL hParent AS DWORD _ )
AS LONG |
|
Example |
|
#COMPILE EXE
#DIM ALL
#INCLUDE "WIN32API.INC"
DECLARE FUNCTION LaunchConnectionDialog LIB "inetcpl.cpl" ALIAS "LaunchConnectionDialog" (BYVAL hParent AS DWORD) AS LONG
DECLARE FUNCTION LaunchInternetControlPanel LIB "inetcpl.cpl" ALIAS "LaunchInternetControlPanel" (BYVAL hParent AS DWORD) AS LONG
DECLARE FUNCTION LaunchPrivacyDialog LIB "inetcpl.cpl" ALIAS "LaunchPrivacyDialog" (BYVAL hParent AS DWORD) AS LONG
DECLARE FUNCTION LaunchSecurityDialog LIB "inetcpl.cpl" ALIAS "LaunchSecurityDialog" (BYVAL hParent AS DWORD) AS LONG
%IDC_GENERAL = 1001
%IDC_CONNECTIONS = 1002
%IDC_PRIVACY = 1003
%IDC_SECURITY = 1004
' ****************************************************************************************
' Main
' ****************************************************************************************
FUNCTION WINMAIN (BYVAL hInstance AS DWORD, BYVAL hPrevInstance AS DWORD, BYVAL lpszCmdLine AS ASCIIZ PTR, BYVAL nCmdShow AS LONG) AS LONG
LOCAL hWndMain AS DWORD
LOCAL hCtl AS DWORD
LOCAL hFont AS DWORD
LOCAL wcex AS WndClassEx
LOCAL szClassName AS ASCIIZ * 80
LOCAL rc AS RECT
LOCAL szCaption AS ASCIIZ * 255
LOCAL nLeft AS LONG
LOCAL nTop AS LONG
LOCAL nWidth AS LONG
LOCAL nHeight AS LONG
hFont = GetStockObject(%ANSI_VAR_FONT)
' Register the window class
szClassName = "MyClassName"
wcex.cbSize = SIZEOF(wcex)
wcex.STYLE = %CS_HREDRAW OR %CS_VREDRAW
wcex.lpfnWndProc = CODEPTR(WndProc)
wcex.cbClsExtra = 0
wcex.cbWndExtra = 0
wcex.hInstance = hInstance
wcex.hCursor = LoadCursor (%NULL, BYVAL %IDC_ARROW)
wcex.hbrBackground = %COLOR_3DFACE + 1
wcex.lpszMenuName = %NULL
wcex.lpszClassName = VARPTR(szClassName)
wcex.hIcon = LoadIcon (%NULL, BYVAL %IDI_APPLICATION) ' Sample, if resource icon: LoadIcon(hInst, "APPICON")
wcex.hIconSm = LoadIcon (%NULL, BYVAL %IDI_APPLICATION) ' Remember to set small icon too..
RegisterClassEx wcex
' Window caption
szCaption = "Internet Properties"
' Retrieve the size of the working area
SystemParametersInfo %SPI_GETWORKAREA, 0, BYVAL VARPTR(rc), 0
' Calculate the position and size of the window
nWidth = (((rc.nRight - rc.nLeft)) + 2) * 0.60 ' 60% of the client screen width
nHeight = (((rc.nBottom - rc.nTop)) + 2) * 0.50 ' 50% of the client screen height
nLeft = ((rc.nRight - rc.nLeft) \ 2) - nWidth \ 2
nTop = ((rc.nBottom - rc.nTop) \ 2) - (nHeight \ 2)
' Create a window using the registered class
hWndMain = CreateWindowEx(%WS_EX_CONTROLPARENT, _ ' extended style
szClassName, _ ' window class name
szCaption, _ ' window caption
%WS_OVERLAPPEDWINDOW OR _
%WS_CLIPCHILDREN, _ ' window style
nLeft, _ ' initial x position
nTop, _ ' initial y position
nWidth, _ ' initial x size
nHeight, _ ' initial y size
%NULL, _ ' parent window handle
0, _ ' window menu handle
hInstance, _ ' program instance handle
BYVAL %NULL) ' creation parameters
hCtl = CreateWindowEx(0, "BUTTON", "&General", %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %BS_FLAT, _
0, 0, 0, 0, hWndMain, %IDC_GENERAL, hInstance, BYVAL %NULL)
IF hFont THEN SendMessage hCtl, %WM_SETFONT, hFont, 0
hCtl = CreateWindowEx(0, "BUTTON", "&Connections", %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %BS_FLAT, _
0, 0, 0, 0, hWndMain, %IDC_CONNECTIONS, hInstance, BYVAL %NULL)
IF hFont THEN SendMessage hCtl, %WM_SETFONT, hFont, 0
hCtl = CreateWindowEx(0, "BUTTON", "&Privacy", %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %BS_FLAT, _
0, 0, 0, 0, hWndMain, %IDC_PRIVACY, hInstance, BYVAL %NULL)
IF hFont THEN SendMessage hCtl, %WM_SETFONT, hFont, 0
hCtl = CreateWindowEx(0, "BUTTON", "&Security", %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %BS_FLAT, _
0, 0, 0, 0, hWndMain, %IDC_SECURITY, hInstance, BYVAL %NULL)
IF hFont THEN SendMessage hCtl, %WM_SETFONT, hFont, 0
hCtl = CreateWindowEx(0, "BUTTON", "&Exit", %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %BS_FLAT, _
0, 0, 0, 0, hWndMain, %IDCANCEL, hInstance, BYVAL %NULL)
IF hFont THEN SendMessage hCtl, %WM_SETFONT, hFont, 0
' Show the window
ShowWindow hWndMain, nCmdShow
UpdateWindow hWndMain
' Message handler loop
LOCAL Msg AS tagMsg
WHILE GetMessage(Msg, %NULL, 0, 0)
IF ISFALSE IsDialogMessage(hWndMain, Msg) THEN
TranslateMessage Msg
DispatchMessage Msg
END IF
WEND
FUNCTION = msg.wParam
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Main Window procedure
' ****************************************************************************************
FUNCTION WndProc (BYVAL hWnd AS DWORD, BYVAL wMsg AS DWORD, BYVAL wParam AS DWORD, BYVAL lParam AS LONG) AS LONG
LOCAL rc AS RECT
LOCAL hr AS LONG
SELECT CASE wMsg
CASE %WM_CREATE
' -------------------------------------------------------
' A good place to initiate things, declare variables,
' create controls and read/set settings from a file, etc.
' -------------------------------------------------------
CASE %WM_SIZE
' ----------------------------------------------------------------------
' If you have a Toolbar and/or a Statusbar, send the following messages:
' SendMessage hStatusbar, wMsg, wParam, lParam
' SendMessage hToolbar, wMsg, wParam, lParam
' ----------------------------------------------------------------------
' Resize the two sample buttons of the dialog
IF wParam <> %SIZE_MINIMIZED THEN
GetClientRect hWnd, rc
MoveWindow GetDlgItem(hWNd, %IDC_GENERAL), (rc.nRight - rc.nLeft) - 95, (rc.nBottom - rc.nTop) - 155, 75, 23, %TRUE
MoveWindow GetDlgItem(hWNd, %IDC_CONNECTIONS), (rc.nRight - rc.nLeft) - 95, (rc.nBottom - rc.nTop) - 125, 75, 23, %TRUE
MoveWindow GetDlgItem(hWNd, %IDC_PRIVACY), (rc.nRight - rc.nLeft) - 95, (rc.nBottom - rc.nTop) - 95, 75, 23, %TRUE
MoveWindow GetDlgItem(hWNd, %IDC_SECURITY), (rc.nRight - rc.nLeft) - 95, (rc.nBottom - rc.nTop) - 65, 75, 23, %TRUE
MoveWindow GetDlgItem(hWNd, %IDCANCEL), (rc.nRight - rc.nLeft) - 95, (rc.nBottom - rc.nTop) - 35, 75, 23, %TRUE
END IF
CASE %WM_COMMAND
' -------------------------------------------------------
' Messages from controls and menu items are handled here.
' -------------------------------------------------------
SELECT CASE LOWRD(wParam)
CASE %IDC_GENERAL
IF HIWRD(wParam) = %BN_CLICKED THEN
hr = LaunchInternetControlPanel(hWnd)
EXIT FUNCTION
END IF
CASE %IDC_CONNECTIONS
IF HIWRD(wParam) = %BN_CLICKED THEN
hr = LaunchConnectionDialog(hWnd)
EXIT FUNCTION
END IF
CASE %IDC_PRIVACY
IF HIWRD(wParam) = %BN_CLICKED THEN
hr = LaunchPrivacyDialog(hWnd)
EXIT FUNCTION
END IF
CASE %IDC_SECURITY
IF HIWRD(wParam) = %BN_CLICKED THEN
hr = LaunchSecurityDialog(hWnd)
EXIT FUNCTION
END IF
CASE %IDCANCEL
IF HIWRD(wParam) = %BN_CLICKED THEN
SendMessage hWnd, %WM_DESTROY, wParam, lParam
FUNCTION = 0
EXIT FUNCTION
END IF
END SELECT
CASE %WM_SYSCOMMAND
' Capture this message and send a WM_CLOSE message
IF (wParam AND &HFFF0) = %SC_CLOSE THEN
SendMessage hWnd, %WM_CLOSE, wParam, lParam
EXIT FUNCTION
END IF
CASE %WM_CLOSE
' --------------------------------------------------------
' The WM_CLOSE message is processed BEFORE the WM_DESTROY
' message and it can be used to confirm program exit or
' tasks like deallocating memory or similar tasks.
' --------------------------------------------------------
CASE %WM_DESTROY
' ---------------------------------------------------------------------------
' Is sent when program ends - a good place to delete any created objects and
' store settings in file for next run, etc. Must send PostQuitMessage to end
' properly in SDK-style dialogs. The PostQuitMessage function sends a WM_QUIT
' message to the program's (thread's) message queue, and then WM_QUIT causes
' the GetMessage function to return zero in WINMAIN's message loop.
' ---------------------------------------------------------------------------
PostQuitMessage 0 ' This function closes the main window
FUNCTION = 0 ' by sending zero to the main message loop
EXIT FUNCTION
END SELECT
FUNCTION = DefWindowProc(hWnd, wMsg, wParam, lParam)
END FUNCTION
' ****************************************************************************************
|
Page last updated on Saturday, 07 January 2006 18:12:05 +0100