That source doesn't do anything by itself.. In any event, it is not a simple task to have RBase talk to the USB. I have looked (and I mean looked at its' properties and methods) at one component that seems to be pretty sucessful and I am unsure if even resorting to kludges it would be possible to get most of its' functionality available to RBase.


----- Original Message ----- From: "Paul InterlockInfo" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Wednesday, December 23, 2009 3:37 PM
Subject: [RBASE-L] - RE: Using RBASE 7.6 to control physical PC connected devices like speakers and USB or RS232 connected lights and sirens.


See Below: This is not the one I was looking for, but I saw a lot of responses so I found another. Now I will admit, this code is over my head. If I were to write such a rascal I would ask RBTI or Member of this list. I am trying to learn but time is short.



But I figured I would have to provide the information, examples and specs- well as much as possible. Like I said the project died and so did the information I had. Source Code Not tested!



Paul



I also believe Razzak has something already or an example that is easier?

The credit for the code goes to the team list in the code example. I did shorten/edit because it is not mine to copy/post.













From: [email protected] [mailto:[email protected]] On Behalf Of Lawrence Lustig
Sent: Wednesday, December 23, 2009 12:13 PM
To: RBASE-L Mailing List

How do you talk to a USB port in 7.6?  Sounds cool.

Larry







// USB2 API DLL example program

//

// USB2_DLL_Demo.cpp

//

// by:     I.Robinson, T.Rowling, PassMark Software

// date: 1-Feb-2005

//

// Purpose:

//            Demo software to show how to use the USB2 API.

//

// Copyright PassMark 2009

// www.passmark.com

#pragma warning(disable : 4996) //Disable CRT insecure warnings for strcpy and sprintf in visual studio 2005



//Includes

#include <windows.h>

#include <stdio.h>

#include <process.h>

#include <commctrl.h>

#include "resource.h"

#include <winioctl.h>

#include <time.h>



#include "USB2_DLL_Demo.h"

#include "USB2DLL.h"



HINSTANCE hGInstance = NULL;



//About.cpp

INT_PTR CALLBACK AboutDlgProc (HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam);



//Function prototypes

BOOL CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

void InitDialog (HWND hwnd);



//

//Globals for this module

//

HINSTANCE        g_hInstance;

HWND                  g_hwndMain;





int                           Mode;

bool       connectedPlugs[MAX_USB_DEV_NUMBER];



#define NUMUSBCOLUMNS 5



int usb_columns_width[NUMUSBCOLUMNS] = {

               100,

               150,

               100,

               100,

               150

};



char* usb_columns[NUMUSBCOLUMNS] = {

               "Serial",

               "Description",

               "Operations",

               "Errors",

               "Recovered Bus Errors"

};





//********************************

//Main windows procedure

//

//Code entry point

//********************************

int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInstance,

                   PSTR szCmdLine, int iCmdShow)

{





static char szAppName[] = "USB2DLLDEMO" ; // Refernece to recource name

               MSG         msg ;

               OSVERSIONINFO              OSversion;



               //Initialise some globals

               g_hInstance = hInst;



               //Get OS version

               OSversion.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);

               GetVersionEx (&OSversion);



               INITCOMMONCONTROLSEX commCtrl;

               commCtrl.dwSize = sizeof(INITCOMMONCONTROLSEX);

               commCtrl.dwICC = ICC_WIN95_CLASSES ;

               InitCommonControlsEx(&commCtrl);



               //Create and display the window

g_hwndMain = CreateDialog (g_hInstance, "USB2DLLDEMO", 0, (DLGPROC)WndProc);



               ShowWindow (g_hwndMain, iCmdShow) ;

               InitDialog (g_hwndMain);



               while (GetMessage (&msg, NULL, 0, 0))

               {

                               if (!IsDialogMessage(g_hwndMain,&msg)) {

                                               TranslateMessage (&msg) ;

                                               DispatchMessage (&msg) ;

                               }

               }

               return msg.wParam ;

}





//********************************

//Windows callback procedure

//

//Handles all the messages for the dialog box

//********************************

BOOL CALLBACK WndProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)

{


Reply via email to