converting c++ 2 freebasic

New to FreeBASIC? Post your questions here.
Dark
Posts: 6
Joined: Aug 31, 2008 17:03

converting c++ 2 freebasic

Postby Dark » Oct 09, 2008 3:36

I have this code in C++ and i was wondering if someone could convert it for me.

Code: Select all

/// Start ///
void DLLFUNC Func_RunFile(IDLL_Basic4GL_Runtime &basic4gl) {
    const char *file = basic4gl.GetStringParam(1);
    system(file);
}

void DLLFUNC Func_OpenWebSite(IDLL_Basic4GL_Runtime &basic4gl) {
    const char *URL = basic4gl.GetStringParam(1);
    ShellExecute( NULL, "open", URL, NULL, "C:\\", SW_SHOW );
}
/// End ///



And then they get registered with this...


/// Start ///
    registry.RegisterVoidFunction("RunFile", Func_RunFile);
    registry.AddParam(DLL_BASIC4GL_STRING);

    registry.RegisterVoidFunction("OpenWebSite", Func_OpenWebSite);
    registry.AddParam(DLL_BASIC4GL_STRING);
/// End ///
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Postby DrV » Oct 09, 2008 5:14

The RunFile function could just be replaced by FB's built-in Shell.

Code: Select all

#include "windows.bi"
#include "win/shellapi.bi"

sub OpenWebSite(byref URL as string)
  ShellExecute(NULL, "open", URL, NULL, "C:\", SW_SHOW)
end sub
marcov
Posts: 3074
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Postby marcov » Oct 09, 2008 9:32

DrV wrote:The RunFile function could just be replaced by FB's built-in Shell.

Code: Select all

#include "windows.bi"
#include "win/shellapi.bi"

sub OpenWebSite(byref URL as string)
  ShellExecute(NULL, "open", URL, NULL, "C:", SW_SHOW)
end sub


It looks like the rest is part of a shell extension. I don't know how these work. (register COM object?)
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Postby DrV » Oct 09, 2008 15:51

I assume the rest is just how external routines are registered with Basic4GL (I've never used it); FB doesn't need anything like this.
Dark
Posts: 6
Joined: Aug 31, 2008 17:03

Postby Dark » Oct 10, 2008 1:42

They are in fact part of a library for the creation of dlls thats why they are labled ddlinterface and so forth.I beleive i converted them appropriatly if i have any problems ill post. Thnx for the help guys :)

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 9 guests