PDA

Click to See Complete Forum and Search --> : lets share some Undocumented API functions


prye
Aug 8th, 2000, 04:30 AM
i'll start with one i converted to vb from a C code i was looking at:

it will shell explorer's Find Files dialog:

Declare Function SHFindFiles Lib "shell32.dll" Alias "#90" (ByVal pidlRoot As Long, ByVal pidlSavedSearch As String) As Long

to use it, SHFindFiles VbNull, VbNull

what api's can you share? :D

Sam Finch
Aug 8th, 2000, 05:46 AM
Cool, Fraid I don't know any Undocumented ones, I'm pretty sure there was something in that court case thing that said they were going to have to document all the APIs. Wo that'll be quite cool. (probably have to wait a few years knowing the blinding speed the U.S. Justice system works)

Mad Compie
Aug 8th, 2000, 01:26 PM
Here are some undocumented API:

****** File exists? ************
Private Declare Function SHFileExists Lib "shell32" Alias "#45" (ByVal szPath As String) As Long
Private Sub Form_Load()
MsgBox "Does the file exist?" + Str$(SHFileExists "c:\autoexec.bat"))
End Sub

****** Format dialog ************
Const SHFD_CAPACITY_DEFAULT = 0 ' default drive capacity
Const SHFD_CAPACITY_360 = 3 ' 360KB, applies to 5.25" drives only
Const SHFD_CAPACITY_720 = 5 ' 720KB, applies to 3.5" drives only
Const SHFD_FORMAT_QUICK = 0 ' quick format
Const SHFD_FORMAT_FULL = 1 ' full format
Const SHFD_FORMAT_SYSONLY = 2 ' copies system files only (Win95 Only!)
Private Declare Function SHFormatDrive Lib "shell32" (ByVal hwndOwner As Long, ByVal iDrive As Long, ByVal iCapacity As Long, ByVal iFormatType As Long) As Long
Private Sub Form_Load()
'iDrive = The drive number to format. Drive A=0, B=1 (if present, otherwise C=1), and so on.
SHFormatDrive Me.hwnd, 0, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_QUICK
End Sub

******
szPath has an executable extension (if last 4 char are either ".exe", ".com", ".bat" or ".pif") ************
Private Declare Function SHPathIsExe Lib "shell32" Alias "#43" (ByVal szPath As String) As Long
Private Sub Form_Load()
MsgBox "Is path EXEC?" + Str$(SHPathIsExe("c:\autoexec.bat"))
End Sub

Aug 8th, 2000, 05:11 PM
Both EnumDisplaySettings and ChangeDisplaySettings are undocumented. See this tip (http://www.vb-world.net/tips/tip67.html) for their documentation.

V(ery) Basic
Aug 9th, 2000, 11:56 AM
Hell, it is a stupid question, but is there a site that documents all the undocumented API functions, or will I have to sue Microsoft to find that out?

Aug 9th, 2000, 12:18 PM
I don't know what the API's are, but I know there are winsock APIs that are not documented.

Mad Compie
Aug 10th, 2000, 01:10 PM
Yet another usefull API:
'************* GradientFill() ********
Private Type TRIVERTEX
x As Long
y As Long
Red As Integer 'Ushort value
Green As Integer 'Ushort value
Blue As Integer 'ushort value
Alpha As Integer 'ushort
End Type
Private Type GRADIENT_RECT
UpperLeft As Long 'In reality this is a UNSIGNED Long
LowerRight As Long 'In reality this is a UNSIGNED Long
End Type

Const GRADIENT_FILL_RECT_H As Long = &H0 'In this mode, two endpoints describe a rectangle. The rectangle is
'defined to have a constant color (specified by the TRIVERTEX structure) for the left and right edges. GDI interpolates
'the color from the top to bottom edge and fills the interior.
Const GRADIENT_FILL_RECT_V As Long = &H1 'In this mode, two endpoints describe a rectangle. The rectangle
' is defined to have a constant color (specified by the TRIVERTEX structure) for the top and bottom edges. GDI interpolates
' the color from the top to bottom edge and fills the interior.
Const GRADIENT_FILL_TRIANGLE As Long = &H2 'In this mode, an array of TRIVERTEX structures is passed to GDI
'along with a list of array indexes that describe separate triangles. GDI performs linear interpolation between triangle vertices
'and fills the interior. Drawing is done directly in 24- and 32-bpp modes. Dithering is performed in 16-, 8.4-, and 1-bpp mode.
Const GRADIENT_FILL_OP_FLAG As Long = &HFF

Private Declare Function GradientFillRect Lib "msimg32" Alias "GradientFill" (ByVal hdc As Long, pVertex As TRIVERTEX, ByVal dwNumVertex As Long, pMesh As GRADIENT_RECT, ByVal dwNumMesh As Long, ByVal dwMode As Long) As Long
Private Function LongToUShort(Unsigned As Long) As Integer
'A small function to convert from long to unsigned short
LongToUShort = CInt(Unsigned - &H10000)
End Function
Private Sub Form_Load()
'API uses pixels
Me.ScaleMode = vbPixels
End Sub
Private Sub Form_Paint()
Dim vert(1) As TRIVERTEX
Dim gRect As GRADIENT_RECT

'from black
With vert(0)
.x = 0
.y = 0
.Red = 0&
.Green = 0& '&HFF& '0&
.Blue = 0&
.Alpha = 0&
End With

'to blue
With vert(1)
.x = Me.ScaleWidth
.y = Me.ScaleHeight
.Red = 0&
.Green = 0&
.Blue = LongToUShort(&HFF00&)
.Alpha = 0&
End With

gRect.UpperLeft = 0
gRect.LowerRight = 1

GradientFillRect Me.hdc, vert(0), 2, gRect, 1, GRADIENT_FILL_RECT_H
End Sub

Aug 11th, 2000, 09:53 AM
TransparentBlt

Private Declare Function TransparentBlt Lib "msimg32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal crTransparent As Long) As Boolean

Private Sub Command1_Click()
TransparentBlt Picture2.hdc, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, vbWhite
End Sub

Private Sub Form_Load()
Picture1.ScaleMode = vbPixels
Picture2.ScaleMode = vbPixels
End Sub

prye
Aug 12th, 2000, 12:27 AM
im currently working on a shell replacement..so im really looking for all the SH functions..i have some more, lemme know if anyone wants/needs them... Find Compuer dialog, fixed find files dialog, run dialog, special(virtual) folder paths..

Sophtware
Aug 12th, 2000, 12:13 PM
I would like to see them.

prye
Aug 13th, 2000, 02:07 AM
here's what ive dug up so far...

Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
Declare Function SHFindFiles Lib "shell32.dll" Alias "#90" (ByVal pidlRoot As Long, ByVal pidlSavedSearch As Long)
Declare Function SHFindComputer Lib "shell32.dll" Alias "#91" (ByVal pidlRoot As Long, ByVal pidlSavedSearch As Long)
Declare Function FileMenu_AppendFilesForPidl Lib "shell32.dll" Alias "#124" (ByVal hMenu As Long, ByVal uReserved As Long, ByVal uID As Long, ByVal pidl As String, uFlags As Any, uEnumFlags As Any, lpfnCallback As Any)
Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Public Declare Function SHRunDialog Lib "shell32" Alias "#61" (ByVal hOwner As Long, ByVal Unknown1 As Long, ByVal Unknown2 As Long, ByVal szTitle As String, ByVal szPrompt As String, ByVal uFlags As Long) As Long
Public Declare Sub SHAddToRecentDocs Lib "shell32" (ByVal lFlags As Long, ByVal lPv As Any)
Declare Function SHGetSpecialFolderLocation Lib "Shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long

Public Declare Function SHGetFolderPath Lib "SHFolder" Alias "SHGetFolderPathA" (ByVal hwndOwner As Long, ByVal nFolder As Long, ByVal hToken As Long, ByVal dwFlags As Long, ByVal sPath As String) As Long



----

im still lookinh for more :]

Crazy D
Aug 13th, 2000, 03:36 AM
It took a while but I found the url again....
http://www.geocities.com/SiliconValley/4942/
It has a bunch of neat functions.

prye
Aug 13th, 2000, 12:31 PM
that site is actually where i found some functions :]