This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (?i)((access_key|access_token|admin_pass|admin_user|algolia_admin_key|algolia_api_key|alias_pass|alicloud_access_key|amazon_secret_access_key|amazonaws|ansible_vault_password|aos_key|api_key|api_key_secret|api_key_sid|api_secret|api.googlemaps AIza|apidocs|apikey|apiSecret|app_debug|app_id|app_key|app_log_level|app_secret|appkey|appkeysecret|application_key|appsecret|appspot|auth_token|authorizationToken|authsecret|aws_access|aws_access_key_id|aws_bucket|aws_key|aws_secret|aws_secret_key|aws_token|AWSSecretKey|b2_app_key|bashrc password|bintray_apikey|bintray_gpg_password|bintray_key|bintraykey|bluemix_api_key|bluemix_pass|browserstack_access_key|bucket_password|bucketeer_aws_access_key_id|bucketeer_aws_secret_access_key|built_branch_deploy_key|bx_password|cache_driver|cache_s3_secret_key|cattle_access_key|cattle_secret_key|certificate_password|ci_deploy_password|client_secret|client_zpk_secret_key|clojars_password|cloud_api_key|cloud_watch_aws_access_key|cloudant_password|cloudflare_api_key|cloudflare_auth_k |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ' Need to add project references to C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscoree.tlb and mscorlib.tlb | |
| Private Declare PtrSafe Function DispCallFunc Lib "oleaut32.dll" (ByVal pv As LongPtr, ByVal ov As LongPtr, ByVal cc As Integer, ByVal vr As Integer, ByVal ca As Long, ByRef pr As Integer, ByRef pg As LongPtr, ByRef par As Variant) As Long | |
| Private Declare PtrSafe Sub RtlMoveMemory Lib "kernel32" (Dst As Any, Src As Any, ByVal BLen As LongPtr) | |
| Private Declare PtrSafe Function VarPtrArray Lib "VBE7" Alias "VarPtr" (ByRef Var() As Any) As LongPtr | |
| #If Win64 Then | |
| Const LS As LongPtr = 8& | |
| #Else | |
| Const LS As LongPtr = 4& |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Private Declare PtrSafe Function GetCurrentThreadId Lib "kernel32" _ | |
| () As Long | |
| Private Declare PtrSafe Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" _ | |
| (ByVal idHook As Long, ByVal lpfn As LongPtr, ByVal hmod As LongPtr, ByVal dwThreadId As Long) As LongPtr | |
| Private Declare PtrSafe Function SetDlgItemText Lib "user32" Alias "SetDlgItemTextA" _ | |
| (ByVal hDlg As LongPtr, ByVal nIDDlgItem As Long, ByVal lpString As String) As Long | |
| Private Declare PtrSafe Function CallNextHookEx Lib "user32" _ | |
| (ByVal hHook As LongPtr, ByVal ncode As Long, ByVal wParam As LongPtr, lParam As Any) As LongPtr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sub CATMain() | |
| CATIA.DisplayFileAlerts = False | |
| message = msgbox ("Do you want to close all windows?", vbYesNo,"Close All Window") | |
| if message = vbYes then | |
| Do while CATIA.Documents.count <> 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ' this cat script will export search result to a txt file. | |
| Sub CATMain() | |
| Dim sPath | |
| Dim i | |
| Dim oSelection 'As Selection | |
| Dim oSelectedElement 'As SelectedElement | |
| Dim sElementName 'As String | |
| Dim sElementPath 'As String | |
| Dim sInput |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ' so in summary, there are three ways to create memory bitmap and use it. | |
| ' createbitmap header, info structure --> put to disk file --> load to userform | |
| ' createbitmap header, info struction --> use copy memory to construct a IPicture --> load to userform | |
| ' use OleCreatePictureIndirect API call to save from bitmap handle directly. | |
| ' no need to mess with bitmap header or other low level detail. | |
| ' i like method 2, it is the most difficutl one, but i learned a lot about Win32 API and VB. | |
| ' Especially User Defined Type. and CopyMemory function. | |
| ' this example uses PUT method to save BitMapHeader and BitMapInfo struct to disk. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ' this method first get a DC entire window. | |
| ' then turn it into a memory bitmap. | |
| ' then create a iPicture interface using the bitmap. | |
| ' the benefit of using OleCreatePictureIndirect is that we don't need to worry about filling | |
| ' out bitmap header infomation manually. | |
| ' it is easier than other method in my git. | |
| ' You can also use GDI+, or even DotNet API, which provides simplified API than GDI. | |
| ' But i like low level API better. | |
| Option Explicit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ' this is a excel vba userform. | |
| ' it has only one image control. | |
| ' this macro will create a bitmap in memroy the hard way. | |
| ' filling BitMap header and BitMapinfo manually, then use BitBlt to get pixel to a Bytes array. | |
| ' use memorycopy to merge the 3 parts together to a byte array. | |
| ' then load the BMP array to to a IPicture interface. | |
| ' last step is to load the IPicture to the image control. | |
| Private Declare PtrSafe Function CreateCompatibleDC Lib "Gdi32" (ByVal hDc As LongPtr) As LongPtr | |
| Private Declare PtrSafe Function CreateCompatibleBitmap Lib "Gdi32" (ByVal hDc As LongPtr, _ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ' https://stackoverflow.com/questions/64729347/getting-a-udt-from-a-longptr-in-vba | |
| ' There are three ways to assign UDT. | |
| ' 1. Simply use = assgiment | |
| ' 2. use copymemory. | |
| ' 3. Allocate memory as a swap space, transfer the value. | |
| ' 4. in VB, you can't dereference a UDT pointer directly like in C "->" | |
| ' 5. You need to use copymemory to a UDT variable. Then use "." to reference that variable. | |
| Type IDT | |
| id As Long |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'https://www.vbforums.com/showthread.php?329373-MsgBoxEx-Extended-Message-Box | |
| '************************************************************* | |
| '* MsgBoxEx() - Written by Aaron Young, February 7th 2000 | |
| '* - Edited by Philip Manavopoulos, May 19th 2005 | |
| '************************************************************* | |
| Option Explicit | |
| Private Type CWPSTRUCT | |
| lParam As Long |
NewerOlder