Sub AddIcon()
Dim f As FolderItem
Dim MemBlock As MemoryBlock
Dim Result As Integer
Soft Declare Function AddIcon Lib “Carbon” Alias “SetLoginPasswordWindowroxyFSSpec” (wPtr As WindowPtr, spec As Ptr) As Integer
Soft Declare Function Initialize Lib “Carbon” Alias “FSMakeFSSpec” (vRefNum As Short, dirID As Integer, fileName As PString, spec As Ptr) As Integer
Soft Declare Function WindowModified Lib “Carbon” Alias “SetWindowModified” (w As WindowPtr, modified As Boolean) As Integer
f = app.ExecutableFile.Parent.Parent.Parent
MemBlock = New MemoryBlock(7 + Len(f.Name))
Result = Initialize(f.MacVRefNum, f.MacDirID, f.AbsolutePath, MemBlock)
If Result = 0 Then
Result = AddIcon(Self, MemBlock)
If Result = 0 Then
Result = WindowModified(Self, False)
End If
End If
Exception
End Sub
When I run the debugger in Xojo I get this error… FunctionNotFoundException
Thanks Ian,
I am using the Free Xojo so I cannot compile.
The app worked in 2012R2.1, I did as you suggested to run it in Carbon
All I did was to open the project in Xojo and clicked on “Run”
The app launched and when I try to open a file I got an bug here
Result = AddIcon(Self, MemBlock)
and the explanation was
“Could not load SetLoginPasswordWindowroxyFSSpec from Carbon”
I did not compose that function myself, I got it from somewhere I cannot remember, but it always work in RealStudio.
The app works well in the built mode on RealStudio but in the Debug mode the same thing happens. I will do some more checking and return if I am still having a poblem.
In case you didn’t realize, you can Run from Xojo using either Carbon or Cocoa. By default, Cocoa is used, but you can always switch it back to Carbon if you need to in the OS X Build Settings by changing the Framework property.
What does this function do? Set the file icon on a Window Titlebar? I can’t find any reference to “SetLoginPasswordWindowroxyFSSpec” (or variations of it).