topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday April 18, 2024, 8:07 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - relipse [ switch to compact view ]

Pages: [1]
1
Hi, I just released FreshGospelStories.org
Which is Primarily for Christians to encourage them to evangelize the lost and allow them to share their experiences.

http://freshgospelstories.org

What do you all think?
I used PHP 7.4 jQuery css


2
When I first learned object-oriented programming and component creation, I decided to make this game in C++Builder back in 2003.
I dug it up and started playing it and was wondering if anyone would like to try it out.

I was considering writing another version in PHP or JavaScript, just a passing thought.

Hint* there are many secrets! It is like an RPG game

I wish I could find the source code.

EinGame Screenshots and Download

3
N.A.N.Y. 2022 / NANY 2022: Todo Lists
« on: December 31, 2021, 06:32 AM »
Todo Lists
2021-12-31 12_18_16-Todo — Mozilla Firefox.png

URL: https://cworklog.com/todo

Manage todo lists

Similar to Greeting Card Lists, this todo list lets you add todo items and mark them as "done" when they are complete.
Tech: PHP, JavaScript, jQuery, CSS

4
2021-12-22 14_47_46-Greeting Cards — Mozilla Firefox.png

Take a look at my Nany 2022 Entry!

It lets you keep track of who you bought for, signed and sent a greeting card to.

Technologies: PHP jQuery, CSS, HTML, AJAX

greetingcards.cworklog.com

tldr;

Greeting Cards is a free service to allow you to remember your greeting cards lists. For example, if you send out Christmas Cards during Christmas, it will let you keep track of who you bought for, what cards you signed, and if you sent them. There is no warranty. We may discontinue our service at any time.
Why no Password?

We do not use passwords, but rather email verification to login and save your greeting card lists.
Personal Data

    Your email address will only be used for account-related emails/verification. It will never be sold to third-parties. It will never be shared. Period.
    You may delete any of your Greeting Card lists from our server. It is permanently deleted and cannot be recovered (No lingering data).

Advertisements

There are no advertisements. I hate ads, especially creepy ones.

5
N.A.N.Y. 2021 / NANY 2021 Entry: Bible Progress!
« on: January 01, 2021, 09:14 PM »
I just made a Bible progress website!! For those who read the Bible from Genesis to Revelation, enter your progress!
Here is my progress!
https://cworklog.com...ospel/bible-progress

I hope I'm not too late!!

6
N.A.N.Y. 2021 / NANY 2021 Entry: The Lightning Bolt Quiz
« on: December 21, 2020, 07:55 PM »
Using PHP, HTML, CSS and a bit of JavaScript,
I came up with The Lightning Bolt Quiz
How many lightning bolts do you deserve?
https://cworklog.com/gospel/quiz
A unique way to share the gospel of Jesus Christ
2020-12-21 19_53_36-Window.png

7
I really want to beef up my WinProductive productivity app but I need some beta testers. I'd be willing to give a commercial license to anyone who will test and give me feedback for the next few months.
Check it out https://cworklog.com/winproductive

Whose in who wants to beta test?
2020-04-08 23_26_54-WinProductive by Jim A Kinsman.png
2020-04-08 23_28_01-WinProductive by Jim A Kinsman.png
2020-04-08 23_29_00-Discover and get early access to tomorrow's startups _ BetaList.png

8
DC Member Programs and Projects / WinProductive by relipse
« on: March 30, 2020, 06:11 AM »
In my spare time, I coded an app called WinProductive, which lets you keep track of how much time you spent in each Window:

WinProductiveMainScreen_2020-03-29.png

The app which keeps track of how much time you spend in each window. Start the app, minimize it for a few hours, then maximize it and see your results. You will see where your time spent in each application was.

https://cworklog.com/winproductive

What do you think? Feature Ideas?

9
N.A.N.Y. 2020 / Simple Budget
« on: December 03, 2019, 09:20 PM »
2019-12-03 20_56_00-Budget - Ninject Budget.png
2019-12-03 21_15_45-Budget - Ninject Budget.png
2019-12-03 21_19_28-Add Expenses - Ninject Budget.png
The idea of Ninject Budget is to do a simple job at keeping your budget each month you make expenses and add it to the Spent category, then you can easily see what is Left over
Put in your income and you can see how much is unallocated or not spent yet. At the end of the month you can carry-over what was over-spent and clear the rest. Pretty simple.
The idea was for a husband and wife to share a login and while on the road use the phone, so it is a mobile-first application.

https://cworklog.com/budget

Don't want to create an account? Try the demo account: username: demo password: demo123

What do you think?

10
N.A.N.Y. 2016 / NANY 2016 - Sharpmailer Mailing List (snail mail)
« on: December 25, 2015, 11:20 PM »
Hello, This year I have released Sharpmailer a mailing list for snail mail recipients also to keep track of their transactions
The best way to see it is to check out the live demo
http://sharpmailer.us and http://sharpmailer.us/admin/sharpmailer

See the screenshot for an example

Keep in mind the software is not yet available but open for a preview for anyone who is interested.

11
Hello,
I recently made a quick bible command line utility that works on any system with PHP.
Quickly look up verses or search the bible as simple as:
$ ./qb Jesus said
Mat 4:7  Jesus said unto him, It is written again, Thou shalt not tempt the Lord thy God.
Mat 8:13  And Jesus said unto the centurion, Go thy way; and as thou hast believed, so be it done unto thee. And his servant was healed in the selfsame hour.
Mat 8:22  But Jesus said unto him, Follow me; and let the dead bury their dead.
Mat 9:15  And Jesus said unto them, Can the children of the bridechamber mourn, as long as the bridegroom is with them? but the days will come, when the bridegroom shall be taken from them, and then shall they fast.
...
65 bible verses found.
$ ./qb Jesus%truth%life
Joh 14:6  Jesus saith unto him, I am the way, the truth, and the life: no man cometh unto the Father, but by me.
1 bible verses found.
$ ./qb Psa 1
1  Blessed is the man that walketh not in the counsel of the ungodly, nor standeth in the way of sinners, nor sitteth in the seat of the scornful.
2 But his delight is in the law of the LORD; and in his law doth he meditate day and night.
3  And he shall be like a tree planted by the rivers of water, that bringeth forth his fruit in his season; his leaf also shall not wither; and whatsoever he doeth shall prosper.
4 The ungodly are not so: but are like the chaff which the wind driveth away.
5  Therefore the ungodly shall not stand in the judgment, nor sinners in the congregation of the righteous.
6 For the LORD knoweth the way of the righteous: but the way of the ungodly shall perish.

It is open sourced at https://github.com/r...lipse/quickbible_cli
You just need PHP with the pdo_sqlite extension installed.
Works on Win/Mac/Linux

12
Post New Requests Here / IDEA: fling a window across the screen
« on: April 13, 2014, 05:54 AM »
You are given these via parameters on execution:
1. sx - Start X point
2. sy - Start Y point
3. fx - Final X point
4. fy - Final Y point
5. d - final displacement (int) of start to finish swipe
6. v - Velocity (double) of how fast the touch or swipe was
7. a - final acceleration of how fast the touch or swipe was accelerating (can be negative)


Coding Snack Job - Accept the above as command line parameters and then
Fling the window across the screen slowing it down due to the friction of the desktop.


This will be in used in conjunction with a touch-pad gesture program which I will release later.
It may pass parameters like so: s100,1032 f1300,123  d103 v1.38882 a-1.313

By the way, use WindowFromPoint() api call from sx,sy to grab the window that needs to be flung

13
Well I've finally decided to release http://cworklog.com under GPLv3
If you want a complete time logging system that I've been using for 3 years now, you can install it fresh on your own computer or central server to utilize.
And best of all if you want a feature, you can add it yourself by forking me! http://github.com/relipse/cworklog

Please let me know what you think as I know several of you were interested when I first released it publicly.
Jim

THIS IS A PHP PROGRAM IT REQUIRES A WEBSERVER (I USE A LOCAL XAMPP INSTALL)

14
Living Room / Robotic Ball Controlled by Anroid/iPhone/iPad
« on: April 09, 2014, 10:34 PM »
http://www.gosphero.com/

Yeah i want one for my cats :)
And potential babies :)

15
N.A.N.Y. 2014 / Nany 2014 Entry - Early Alpha - JsRoboKey
« on: September 14, 2013, 12:01 AM »
I am announcing JsRoboKey as one of my entries to NANY 2014. Right now it is pre-alpha but it's got some starter features similar to AutoHotkey.
I hope to get version 1.0 in by the new year!

In case you want some teasers, the app sits in the tray (similar to ahk) and will run a script. Here are some examples (go to http://github.com/relipse/JsRoboKey for more readable format):


Example Scripts
---------------

###### sendKeys()
A simple script might look like this:
   //run notepad, wait a little bit for it to open, then send some keystrokes
    rk.run('notepad');
    rk.sleep(700);
    rk.sendKeys('abcdefgABCDEFG1234567890!@#$%^&*()');

###### addGlobalHotkey()
Or even better, trigger to run notepad after a certain hotkey!
rk.addGlobalHotkey('Meta+Alt+N', function(){
   rk.run('notepad');
});
(Meta) means the Windows key


###### getForegroundWindow() and getWindowText()
And demonstrating some new functionality, this script will run notepad and wait for it to open
function fgWinMatches(winTitle){
    var hwnd = rk.getForegroundWindow();
    var title = rk.getWindowText(hwnd);
    if (title.toLowerCase().indexOf(winTitle.toLowerCase()) >= 0){
       return {hwnd:hwnd,title:title};
    }else{
       return false;
    }
}

function winWait(winTitle, callback){
   var match = fgWinMatches(winTitle);
   if (match === false){
      rk.setTimeout(function(){
         winWait(winTitle, callback);
      },400);
   }else{
     callback(match);
   }
}

rk.run('notepad');
winWait('notepad', function(match){
    rk.sendKeys('Hello World');
});
###### onClipboardChange()
A new feature onClipboardChange() which sets up a callback when the clipboard changes, think of the possibilities!
rk.onClipboardChange(function(data){
    if (typeof(data) != 'string'){ return; }
    if (data.indexOf('foobar') >= 0){
       rk.alert('foobar on clipboard: ' + data);
    }
});

###### onKeyPress() onKeyRelease()
*unstable* not yet in master (hotfix_keylisten branch)
rk.allowKeyListen();
rk.onKeyRelease(function(key){
   if (key == 'F7'){
     rk.sendKeys('Hello World F7');
   }
});

###### trayMsg()
demonstrating a few of the latest features as well,
after the tray bubble message gets shown, the callback gets called when the user clicks the tray message
rk.trayMsg('Hi','Check if JsRoboKey executable file exists...', function(){
   alert(__APPFILEPATH__ + ' exists: ' +
           rk.fileExists(__APPFILEPATH__));
});


rk.trayMsg('About','Click to open the JsRoboKey website', function(){
    rk.openUrl('http://github.com/relipse/JsRoboKey');
});

16
https://github.com/relipse/JsRoboKey

Here's the deal, this sucker is in pre-alpha, but a basic script such as the one below is working!
Code: Javascript [Select]
  1. //run notepad, wait a little bit for it to open, then send some keystrokes
  2.     rk.run('notepad');
  3.     rk.sleep(700);
  4.     rk.sendKeys('abcdefgABCDEFG1234567890!@#$%^&*()');

I need Qt C++ developers to just dive right in and start adding features. The goal is basically to make the power of AutoHotkey cross-platform and using the javascript language.

Check it out, and let me know if you are interested in helping.

17
Post New Requests Here / IDEA: 15 minute work log
« on: July 07, 2013, 07:14 PM »
So at my new job, we log our task every 15 minutes.
I was wondering if there was a desktop application to Keep track of each 15 minutes what you are doing, and then add up your times per task for the day.
I did this in jquery and html but was interested in a native app.

18
I am a freelancer so I get distracted easily on facebook. Can someone write an app to block a website for a certain amount of minutes. That way i could do work for 2 hours while i disable facebook.com

Ideally i'd like it to sit in the system tray and have a right click menu block website, and you type it in or choose it from recent list and then choose how many minutes you want it blocked.

This might be able to be accomplished by editing the windows hosts file and then re-editing it when the time is up.

Jim

19
N.A.N.Y. 2013 / NANY 2013 PLEDGE - Contractor's Work Log
« on: November 06, 2012, 12:13 AM »
https://cworklog.com

New
Now with HTTPS Secure, so you don't have to worry about your login credentials or time information being passed in plain text

facelift.jpg

mainwhammy.jpg

Well, I recently started doing contract programming and I needed a utility to track all my time. I honestly didn't research into it very long when I started building one on my own php webserver.

Nonetheless, I made it available to the public

The Web version is here: https://cworklog.com you can login using
username: test116
password: test116

or just register free for an account (email verification is off)

Windows GUI Client

and the downloadable client is here: https://cworklog.com...orkLogGUI.latest.zip

20
Thanks to the tons of articles and open source code, this would not be possible.
Well, lets say we want to add Scripting support -- specifically JavaScript support, in other words, the user can install a script to customize your application, the key is having a language, and an engine to parse it.
Well, because the TCppWebBrowser component is just an activex control that puts an Internet Explorer control on your app, we can use the scripting engine embedded within IE to do all our dirty work.

Once you drop a TCppWebBrowser on your form, and hide it away behind some other components, name it WebScripter or something.

Well, now we will need some basic utilities, number one, is a way to execute scripts, which you can use a few methods to do it,
one is to load an html page with that script included in the html, or just have a <script>my script</script>, or my favorite, after the TCppWebBrowser component loads and navigates to its first page, we can use the function below to execute javascript inside the currently loaded document (it must exist, do a Web->Navigate(L"about:blank"); if you need to)
bool TCppWebBrowserUtils::ExecJs(TCppWebBrowser *Web, WideString cmd)
{
 IHTMLDocument2  *doc = NULL;
 IHTMLWindow2 *win;
 if (!Web->Document){ return false; }
 bool success_status = false;
 if(SUCCEEDED(Web->Document->QueryInterface(IID_IHTMLDocument2, (LPVOID*)&doc)))  {
   HRESULT hr = doc->get_parentWindow(&win);
   if (SUCCEEDED(hr))  {
     VARIANT v;
     VariantInit(&v);
     win->execScript(cmd,NULL,&v);
     VariantClear(&v);
     win->Release();
     success_status = true;
   }
   doc->Release();
 }
 return success_status;
}


Ok, now that we got that, we are ready to execute custom scripts, load it from a file, drag and drop, or whatever, then pass it to the function above.

But you may be wondering, what is so special about this? We get all the cool things that JavaScript comes with such as regular expressions, substrings, the tons of functions on the internet that we can add.

Now, how can the user control our application?
The key is, window.external, which is what we are going to implement next.

At this time, you can compile your application, and execute some javascript, but we still need to add an implementation for window.external

The idea of window.external , is to be able to call non-script code, so that the user can execute C++ code by using a method of window.external.YourAppDoSomethingCool();

Well, how exactly do we get functions attached?
First of all, we need our own IDocHostUIHandler to attach to the WebBrowser component.
We can do this by adding a new class as below:

Spoiler
 //The below class lets you replace the right click menu, as well as attach functionality to window.external (SetExternal())
  // Simple implementation for IDocHostUIHandler and IUnknown interfaces
  // Implementation returns E_NOTIMPL for all IDocHostUIHandler methods except
  // ShowContextMenu. See comment block preceeding that ShowContxtMenu for
  // further information.
  class MyDocHandler :public IDocHostUIHandler
  {
    long refcount;
    IDispatch* External;
  public:
    TPopupMenu* PopupMenu;
    bool ShowIEPopup;
  public:
    //*Accessors
    void SetExternal(IDispatch* Ext)
    {
        if(External)
            External->Release();

        External = Ext;

        if(External)
            External->AddRef();
    }

    IDispatch* GetExternal()
    {
        return External;
    }

  public:

    MyDocHandler() :refcount(1), External(NULL), PopupMenu(NULL), ShowIEPopup(true){ }

    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID classid, void** intf) {
      if (classid == IID_IUnknown)
        *intf = (IUnknown*)this;
      else if (classid == IID_IDocHostUIHandler)
        *intf = (IDocHostUIHandler*)this;
      else
        return E_NOINTERFACE;
      return S_OK;
    }

    virtual ULONG STDMETHODCALLTYPE AddRef() {
      InterlockedIncrement(&refcount);
      return refcount;
    }

    virtual ULONG STDMETHODCALLTYPE Release() {
      InterlockedDecrement(&refcount);
      if (refcount == 0)
        delete this;
      return refcount;
    }

    // Returning S_OK tells the web browser that it need not display its
    // own context menu, presumably because the application hosting it has
    // displayed its own menu to replace it.
    // Since our host does not display any, no context menu is shown.
    virtual HRESULT STDMETHODCALLTYPE ShowContextMenu(
      /* [in] */ DWORD dwID,
      /* [in] */ POINT __RPC_FAR *ppt,
      /* [in] */ IUnknown __RPC_FAR *pcmdtReserved,
      /* [in] */ IDispatch __RPC_FAR *pdispReserved) {


          if (PopupMenu)
          {
             PopupMenu->Popup(ppt->x, ppt->y);
             return S_OK;
          }
          else if (!ShowIEPopup)
          { //don't show one at all
            return S_OK;
          }
          else{  //if there is no pop up menu, just use the default ie one
            return E_NOTIMPL;
          }

      }

    virtual HRESULT STDMETHODCALLTYPE GetHostInfo(
      /* [out][in] */ DOCHOSTUIINFO __RPC_FAR *pInfo) {
          return E_NOTIMPL;
      }

    virtual HRESULT STDMETHODCALLTYPE ShowUI(
      /* [in] */ DWORD dwID,
      /* [in] */ IOleInPlaceActiveObject __RPC_FAR *pActiveObject,
      /* [in] */ IOleCommandTarget __RPC_FAR *pCommandTarget,
      /* [in] */ IOleInPlaceFrame __RPC_FAR *pFrame,
      /* [in] */ IOleInPlaceUIWindow __RPC_FAR *pDoc) {
          return E_NOTIMPL;
      }

    virtual HRESULT STDMETHODCALLTYPE HideUI( void) {
          return E_NOTIMPL;
      }

    virtual HRESULT STDMETHODCALLTYPE UpdateUI( void) {
          return E_NOTIMPL;
      }

    virtual HRESULT STDMETHODCALLTYPE EnableModeless(
      /* [in] */ BOOL fEnable) {
          return E_NOTIMPL;
      }

    virtual HRESULT STDMETHODCALLTYPE OnDocWindowActivate(
      /* [in] */ BOOL fActivate) {
          return E_NOTIMPL;
      }

    virtual HRESULT STDMETHODCALLTYPE OnFrameWindowActivate(
      /* [in] */ BOOL fActivate) {
          return E_NOTIMPL;
      }

    virtual HRESULT STDMETHODCALLTYPE ResizeBorder(
      /* [in] */ LPCRECT prcBorder,
      /* [in] */ IOleInPlaceUIWindow __RPC_FAR *pUIWindow,
      /* [in] */ BOOL fRameWindow) {
          return E_NOTIMPL;
      }

    virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(
      /* [in] */ LPMSG lpMsg,
      /* [in] */ const GUID __RPC_FAR *pguidCmdGroup,
      /* [in] */ DWORD nCmdID) {
          return E_NOTIMPL;
      }

    virtual HRESULT STDMETHODCALLTYPE GetOptionKeyPath(
      /* [out] */ LPOLESTR __RPC_FAR *pchKey,
      /* [in] */ DWORD dw) {
          return E_NOTIMPL;
      }

    virtual HRESULT STDMETHODCALLTYPE GetDropTarget(
      /* [in] */ IDropTarget __RPC_FAR *pDropTarget,
      /* [out] */ IDropTarget __RPC_FAR *__RPC_FAR *ppDropTarget) {
          return E_NOTIMPL;
      }

    virtual HRESULT STDMETHODCALLTYPE GetExternal(
      /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDispatch) {
        if(ppDispatch == NULL)
            return E_POINTER;

        // make sure currently loaded doc is safe
        //if(!UrlSafeForExternal(WebBrowser->LocationURL))
        //    return E_NOTIMPL;

        if(External) {
            *ppDispatch = External;
            (*ppDispatch)->AddRef();
            return S_OK;
        }
        return E_NOTIMPL;
      }

    virtual HRESULT STDMETHODCALLTYPE TranslateUrl(
      /* [in] */ DWORD dwTranslate,
      /* [in] */ OLECHAR __RPC_FAR *pchURLIn,
      /* [out] */ OLECHAR __RPC_FAR *__RPC_FAR *ppchURLOut) {
          return E_NOTIMPL;
      }

    virtual HRESULT STDMETHODCALLTYPE FilterDataObject(
      /* [in] */ IDataObject __RPC_FAR *pDO,
      /* [out] */ IDataObject __RPC_FAR *__RPC_FAR *ppDORet) {
          return E_NOTIMPL;
      }
  };


The trick is, that this inherits from IDocHostUIHandler, and thus implements the virtual functions,
each function can return a few different types, E_NOTIMPL means you did not change anything, and you want the default behavior, whereas S_OK means you handled it -- like the popup menu
You really don't need to know much more if you want to see it in action, we still have to add our own interface:

#ifndef CppScripterH
#define CppScripterH
//---------------------------------------------------------------------------
#include <OleCtrls.hpp>
#include <SHDocVw_OCX.h>
#include <mshtml.h>
#include <mshtmhst.h>
#include "TCppWebBrowserUtils.h"

//This actually contains the functions that will be added to
//window.external
class IBrowserExternal
{
public:
    TStringList* GlobalVariables;  //initalized and freed outside of this class
public:
    IBrowserExternal():GlobalVariables(NULL){};
    ~IBrowserExternal() {};

    //currently the only functions are window.external.SetVar() and window.external.GetVar() as implemented below
    virtual void STDMETHODCALLTYPE SetVar(BSTR key, BSTR val)
    {
        GlobalVariables->Values[AnsiString(key)] = val;
    }
    virtual BSTR STDMETHODCALLTYPE GetVar(BSTR key)
    {
        return (WideString)GlobalVariables->Values[key];
    }
};

The above code is important, it is the class that will be used to store all the methods you want inside of window.external,
the above code only has 2 methods, GetVar() and SetVar(), a useful way to pass information between the script and your app.
Notice how it returns BSTR, and accepts BSTR, that is a string type in javascript, or a WideString() in BCB. Get used to it, you can cast between WideString() and AnsiString() to do string manipulation.


We also need the below code to basically attach the method invocation directly to our methods (i put the above and below code in the same .h file),


class TExternalDispatch : public IDispatch
{
public:
    TExternalDispatch();
    ~TExternalDispatch();
    // IUnknown
    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID classid, void** intf);
    virtual ULONG STDMETHODCALLTYPE AddRef();
    virtual ULONG STDMETHODCALLTYPE Release();

    //IDispatch
    virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT* pctinfo);

    virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(/* [in] */ UINT iTInfo,
        /* [in] */ LCID lcid,
        /* [out] */ ITypeInfo** ppTInfo);

    virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(
        /* [in] */ REFIID riid,
        /* [size_is][in] */ LPOLESTR *rgszNames,
        /* [in] */ UINT cNames,
        /* [in] */ LCID lcid,
        /* [size_is][out] */ DISPID *rgDispId);

    virtual HRESULT STDMETHODCALLTYPE Invoke(
        /* [in] */ DISPID dispIdMember,
        /* [in] */ REFIID riid,
        /* [in] */ LCID lcid,
        /* [in] */ WORD wFlags,
        /* [out][in] */ DISPPARAMS  *pDispParams,
        /* [out] */ VARIANT  *pVarResult,
        /* [out] */ EXCEPINFO *pExcepInfo,
        /* [out] */ UINT *puArgErr);

private:
    long refcount;
    IBrowserExternal* BrowserExternal;
    ITypeInfo* TypeInfo;
public:
    IBrowserExternal* getBrowserExternal(){ return BrowserExternal; }
};

#endif

We will also need more code in the .cpp file
Notice, this is extremely important, we must define all of the type information about our new methods:

//put this in the .cpp file to add window.external.SetVar() and GetVar()

//this describes the parameters SetVar() takes 2 string parameters, a key and value
static PARAMDATA rgpSetVar[] =
{
    { OLESTR("key"), VT_BSTR},
    { OLESTR("val"), VT_BSTR}
};

//GetVar() only takes 1 string, the key
static PARAMDATA rgpGetVar[] =
{
    { OLESTR("key"), VT_BSTR}
};

//for each function, weneed to add the code below
enum IMETH_ExtDisp
{
    IMETH_SetVar = 0,
    IMETH_GetVar
};

//likewise for this also
enum IDMEMBER_ExtDisp
{
    IDMEMBER_SetVar = DISPID_VALUE,
    IDMEMBER_GetVar
};

//now, see if you can figure this out -- this is the method data -- how it figures out how to call our member functions
//Get used to copying and pasting for each member function, the # represents the number of parameters
//the last item represents the return type VT_BSTR for string, VT_EMPTY for void, VT_INT for int, etc,
//look on the documentation
static METHODDATA rgmdataExtDisp[] =
{
    { OLESTR("SetVar"),           rgpSetVar,          IDMEMBER_SetVar,           IMETH_SetVar,         CC_CDECL, 2, DISPATCH_METHOD, VT_EMPTY },
    { OLESTR("GetVar"),           rgpGetVar,          IDMEMBER_GetVar,           IMETH_GetVar,         CC_CDECL, 1, DISPATCH_METHOD, VT_BSTR }
}

/* IDispatch class for our interface */

TExternalDispatch::TExternalDispatch()
:   refcount(1),
    BrowserExternal(NULL),
    TypeInfo(NULL)
{
    BrowserExternal = new IBrowserExternal();
    CreateDispTypeInfo(&idataExtDisp, LOCALE_SYSTEM_DEFAULT, &TypeInfo);
}

TExternalDispatch::~TExternalDispatch()
{
    if(TypeInfo)
        TypeInfo->Release();

    delete BrowserExternal;
}

/* IUnknown */

HRESULT STDMETHODCALLTYPE TExternalDispatch::QueryInterface(REFIID classid, void** intf)
{
    if(intf == NULL)
        return E_INVALIDARG;

    if (classid == IID_IDispatch || classid == IID_IUnknown) {
        AddRef();
        *intf = this;
        return S_OK;
    }

    *intf = NULL;
    return E_NOINTERFACE;
}

ULONG STDMETHODCALLTYPE TExternalDispatch::AddRef()
{
    InterlockedIncrement(&refcount);
    return refcount;
}

ULONG STDMETHODCALLTYPE TExternalDispatch::Release()
{
    InterlockedDecrement(&refcount);
    if (refcount == 0) {
        delete this;
        return 0;
    }
    return refcount;
}

/* IDispatch */

HRESULT STDMETHODCALLTYPE TExternalDispatch::GetTypeInfoCount(
    UINT* pctinfo)
{
    if(TypeInfo == NULL)
        return E_NOTIMPL; // shouldn't happen

    if(pctinfo == NULL)
        return E_INVALIDARG;

    *pctinfo = 1;

return S_OK;
}

HRESULT STDMETHODCALLTYPE TExternalDispatch::GetTypeInfo(
    /* [in] */ UINT iTInfo,
    /* [in] */ LCID lcid,
    /* [out] */ ITypeInfo** ppTInfo)
{
    if(TypeInfo == NULL)
        return E_NOTIMPL; // shouldn't happen

    if(iTInfo != 0)
        return DISP_E_BADINDEX;

    if(ppTInfo == NULL)
        return E_INVALIDARG;

    TypeInfo->AddRef();
    *ppTInfo = TypeInfo;

return S_OK;
}

HRESULT STDMETHODCALLTYPE TExternalDispatch::GetIDsOfNames(
    /* [in] */ REFIID riid,
    /* [size_is][in] */ OLECHAR** rgszNames,
    /* [in] */ UINT cNames,
    /* [in] */ LCID lcid,
    /* [size_is][out] */ DISPID* rgDispId)
{
    if(TypeInfo == NULL)
        return E_NOTIMPL; // shouldn't happen

    return TypeInfo->GetIDsOfNames(rgszNames, cNames, rgDispId);
}

HRESULT STDMETHODCALLTYPE TExternalDispatch::Invoke(
    /* [in] */ DISPID dispIdMember,
    /* [in] */ REFIID /*riid*/,
    /* [in] */ LCID /*lcid*/,
    /* [in] */ WORD wFlags,
    /* [out][in] */ DISPPARAMS* pDispParams,
    /* [out] */ VARIANT* pVarResult,
    /* [out] */ EXCEPINFO* pExcepInfo,
    /* [out] */ UINT* puArgErr)
{
    if(TypeInfo == NULL)
        return E_NOTIMPL; // shouldn't happen

    return TypeInfo->Invoke(BrowserExternal, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
}


Ok and finally we actually have to connect the pieces, note this is not complete code, you have to copy each part into the designated section
#include "External.h"
#include "TCppWebBrowserUtils.h"

//form variables:
MyDocHandler* scriptdochandler;
TExternalDispatch* webscripter_external;
THashedStringList* GlobalVariables;

//now add in constructor
webscripter_external = new TExternalDispatch();
scriptdochandler = new MyDocHandler();
GlobalVariables = new THashedStringList();


now find a good place to do the below, after of course we've ensured that Document exists and Navigate(L"about:blank"); or something

//after we load the first document CppWebBrowser1->Document will be NULL until we do a Navigate()

ICustomDoc *custdoc;
CppWebBrowser1->Document->QueryInterface(&custdoc);

//change the popupmenu
//dochandler->PopupMenu = PopupMenu;

//enable Global Variables
webscripter_external->getBrowserExternal()->GlobalVariables = GlobalVariables;

//allow pages to call window.external. (this might be a security flaw)
scriptdochandler->SetExternal(webscripter_external);

if (custdoc)
{
   custdoc->SetUIHandler(scriptdochandler);
   custdoc->Release();
}


put this in the destructor, or OnClose() or whatever
//now don't forget to free memory
delete webscripter_external;
delete scriptdochandler;
delete GlobalVariables; //perhaps let them persist? -- save to file?


Wala!!, now go ahead and try it out:
String js = "window.external.SetVar('foo','bar');";
ExecJs(WebScripter, js);
ExecJs(WebScripter, L"alert(window.external.GetVar('foo'));");

You can add more methods that take integers and strings and boolean


21
Borland C++ Builder Contest / FlashCard Pro
« on: August 14, 2006, 07:21 PM »
FlashCard Pro
FlashCard Pro is a tool to help you study.

Works great for high school and college students. I used it for my Spanish class last semester!



Documentation: http://www.xhirl.com...flashcardpro/webhelp

Download (includes 6 free flash card sets)

22
Borland C++ Builder Contest / Trandesk Multiple Desktops
« on: August 14, 2006, 02:54 AM »
Trandesk Multiple Desktops
A Multiple Desktop Manager

Well, have you ever tried XP's powertoys, Microsoft coded a multiple desktop app, but I found many improvements and started working on Trandesk.


I think the best part is doing Ctrl-Alt-D and pressing left right up or down to switch desktops...

http://www.xhirl.com...are/trandesk/webhelp <-- documentation

DOWNLOAD BELOW

23
Borland C++ Builder Contest / Oracle SQL PlusPlus
« on: July 25, 2006, 08:38 AM »
Oracle SQL*PlusPlus
Because SQLPlus wasn't good enough....

If anyone uses ORACLE for a database server, then you'll love SQLPlusPlus.
Syntax highlighting, a nice Grid to view your queries.
A command history.
Support for running scripts.
I was sick and tired of SQLPlus, so I coded my own and now I use it all the time for complex queries and for simple ones...
Here is a screenshot of the latest version, with options to view your data how you want it.

osqlpp.JPG

You can download a demo below, you will need oracle server (or some connection that allows you to connect remotely)


24
Pandemic List
A self-customizing to-do list

The problem that I had was that not every program has a to-do list, furthermore, I was working on a project that consisted of multiple sub-projects using different IDEs, and I would use a to-do list in one, and then switch to the other app and i lost track of all my items.

My solution was to create a self-customized todo list. One that does the job, looks simple. I got part of my layout idea from Frontpage's todo list, which was very easy to add items, and was not complicated.

Also C++Builder 6 had a todo list which was very useful, but it is slow, and item completion is a little ok.

There are 4 different views for the todo list, my most recent view I added today was the TrayIcon popup view.
When you switch applications and a new todo item happens, the tray icon animates.


Screenshot of Pandemic-List Popup
popupview.jpg

Screenshot of Pandemic-List Floating View
floatview.jpg
SECONDS LATER, it looks like this!!! What happens when I start browsing the internet with internet explorer?
notice under "associated application" i have it customized to "Internet Research", which uses a regular expression to match all Internet Explorer windows. As soon as Internet explorer is focused, the to-do list items appear (this can be disabled when "Show All Items" is checked).
floatviewmagicappear.jpg

Also we can dock it to the right side of the screen so we ALWAYS know what to do
rightdockview.jpg


Docked to the Top of the screen
Notice you can copy/cut and paste items to and from text!!!
docktopview.jpg

below is my items pasted (in INI format), in the future, i'm thinking about rich text version so we can paste directly in WORD!

[Item2]
Status=0
Priority=1
Task=send in rebates
Group=
Application=
DateModified=7/23/2006 7:03:52 PM
DateCreated=7/23/2006 7:03:52 PM

[Item3]
Status=1
Priority=1
Task=OCR research
Group=
Application=Internet Research
DateModified=7/23/2006 7:31:58 PM
DateCreated=7/23/2006 7:31:58 PM

[Item4]
Status=2
Priority=1
Task=submit pandemic list
Group=
Application=
DateModified=7/23/2006 7:04:04 PM
DateCreated=7/23/2006 7:04:04 PM




25
General Software Discussion / A few new programs
« on: November 07, 2005, 03:34 AM »
Hey I have a ton of small apps at www.xhirl.com/software
can you tell me what you guys think
(just added the SignupRecordTracker and the PowerNamer

-ReLipse

Pages: [1]