why isn't this api code working? 
Author Message
 why isn't this api code working?

'declaration
Private Declare Function PathCompactPath _              
        Lib "shlwapi" Alias "PathCompactPathA" ( _
        ByVal hDC As IntPtr, _
        ByVal lpszPath As String, _
        ByVal dx As Integer) As Integer

'code
Dim strFilePath as String = "C:\Program Files\Some
Dir\Some Dir\Etc\Some File.txt"

PathCompactPath(Me.Handle, strFilePath, 250)
sbMain.Panels(0).Text = strFilePath

For some reason, no matter what I change the destination
size to, the output string is always "...\Some File.txt".
I know the string should change depending on the size. For
example, "C:\Program Files\...\Etc\Some File.txt"

What am I doing wrong?

thanks in advance,
Todd



Sun, 25 Sep 2005 22:26:27 GMT  
 why isn't this api code working?
Me.Handle is a hwnd not a hdc.
Replace Me.Handle with IntPtr.Zero and it will work.


Quote:
> 'declaration
> Private Declare Function PathCompactPath _
> Lib "shlwapi" Alias "PathCompactPathA" ( _
> ByVal hDC As IntPtr, _
> ByVal lpszPath As String, _
> ByVal dx As Integer) As Integer

> 'code
> Dim strFilePath as String = "C:\Program Files\Some
> Dir\Some Dir\Etc\Some File.txt"

> PathCompactPath(Me.Handle, strFilePath, 250)
> sbMain.Panels(0).Text = strFilePath

> For some reason, no matter what I change the destination
> size to, the output string is always "...\Some File.txt".
> I know the string should change depending on the size. For
> example, "C:\Program Files\...\Etc\Some File.txt"

> What am I doing wrong?

> thanks in advance,
> Todd



Sun, 25 Sep 2005 22:37:36 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Why isn't any API code working

2. why isn't this api working?

3. Why isn't my code working?

4. Why isn't my filter working in the Common Dialog ShowOpen Function

5. Why Isn't MyBase.New() Working Here?

6. Why isn't this working??

7. Why isn't this working?

8. why isn't this working?

9. Why isn't this working

10. Why isn't this working?

11. Why isn't this working?

12. why isn't this working

 

 
Powered by phpBB® Forum Software