Version 1.32 Steamworks SDK released 2/5/2015
The Steamworks SDK has been updated. Version 1.32 of the SDK adds C# bindings, a flat C-style API, improvements to the HTTP interface, and an initial release of the Steam Inventory Service.
Type
MyFunction = Function(CustomUrl : PChar) : DWORD; Stdcall;
Const
APIload = 'steam_api.dll';
PassString : String = 'http://forum.lazarus.freepascal.org';
implementation
{$R *.lfm}
{ TForm1 }
Function SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage(CustomUrl : Pchar) : DWord; stdcall; External APIload;
procedure TForm1.Button1Click(Sender: TObject);
Var
sHandle : TLibHandle;
Proc : MyFunction;
begin
sHandle := LoadLibrary(APIload);
If sHandle = dynlibs.NilHandle Then ShowMessage('load error');
Proc := MyFunction(GetProcedureAddress(shandle, 'SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage'));
If Proc = Nil Then ShowMessage('error')
Else Proc(Pchar(PassString));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
If SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage(pChar(PassString)) = 0 Then ShowMessage('ok');
end;
steam_api!SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage
6E451880 55 push %ebp
6E451881 8bec mov %esp,%ebp
6E451883 8b4d08 mov 0x8(%ebp),%ecx
6E451886 ff750c pushl 0xc(%ebp)
6E451889 8b01 mov (%ecx),%eax
6E45188B ff5078 call *0x78(%eax)
6E45188E 5d pop %ebp
6E45188F c3 ret
SteamFriends()->ActivateGameOverlayToWebPage( const char *pchURL )
// Initialize Steamworks
Steamworks::Initialize();
and optionally you can check it is running: if(!SteamAPI_IsSteamRunning())
{
MessageBoxA(0, "Steam not detected. Please run Steam before running this program.", "Error", 0);
return false;
}
before calling: // Go to a website using STEAM browser
if(window->KeyHit(Key::W)) SteamFriends()->ActivateGameOverlayToWebPage("http://www.leadwerks.com/");
Function SteamAPI_Init : Boolean; cdecl; External APIload; // Tried even with stdcall
If SteamAPI_Init = True Then ShowMessage('ok');
procedure OnLeaderboardFindResult(SteamLeaderboard: uint64; LeaderboardFod: uint8); cdecl;
begin
showmessage('Callback: OnLeaderboardFindResult');
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
if not(System_InitWrapper) then
begin
Showmessage('Steam wrapper init error. Please check your steam client and/or steam_appid.txt');
Halt;
end;
SteamCallbacks.OnLeaderboardFindResult:=OnLeaderboardFindResult;
System_RegisterCallbacks(SteamCallbacks);
SteamUserStats_FindOrCreateLeaderboard(PAnsiChar('x'),k_ELeaderboardSortMethodAscending,k_ELeaderboardDisplayTypeNumeric);
Timer1.Enabled := true;
end;
procedure TForm2.Timer1Timer(Sender: TObject);
begin
System_RunCallbacks;
end;