|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Passing data from a dll to the main VB programwas written it sets up a FlexGrid where the columns are time intervals and the rows are individual light channels. A cell is set to one for a channel to be one during a time interval and set to 0 for a channel to be off during time interval. The grid looks like an Excel spreadsheet where you simply click on a grid to a cell on or off. Data is output, an interval at a time to a bit on the parallel printer port (using geekhideout_io.bas as a base dll). A new dll was written specific to the control hardware. What I am trying to do is to read data back in (as data is going out) on a different parallel printer port pin, and write this data back to the FlexGrid. I am trying to do this from the new dll so that timing between the outgoing data and the incoming data will remain in sync. Capturing the data is not a problem. Writing the data back to the flex grid is. In the main program, when a cell is turned on or off, a call is made CometMod.currentSong.setCell(MusicGrid, .row, .col, 0) where MusicGrid is the FlexGrid, .row & .col are the row and column of the cell and the 0 turns the cell off, where a 1 would turn it on. This same function turns the background of the cell white for off and black for on. Attempts to call this function from the dll have failed with a Run time error of '424 object required'. I was not really expecting it to work - but hoping it would. So it is it possible to write back to a FlexGrid located in the main program from a dll that has been called from the main program? As a disclaimer, I know some about VB, but I am not an expert. Plus, I do not pretend to understand all the intricacies of the program I am trying to add to. My thanks for all help. David
Show quote
Hide quote
"David V. Fansler" <DavidVFans***@discussions.microsoft.com> wrote in Are you talking about ActiveX dll or it is "true" dll?message news:FC1A2129-BB48-4FE5-A6D8-A4B0F38093D5@microsoft.com... >I am trying to make a contribution to an open VB6 program. As the program > was written it sets up a FlexGrid where the columns are time intervals and > the rows are individual light channels. A cell is set to one for a > channel > to be one during a time interval and set to 0 for a channel to be off > during > time interval. The grid looks like an Excel spreadsheet where you simply > click on a grid to a cell on or off. Data is output, an interval at a > time > to a bit on the parallel printer port (using geekhideout_io.bas as a base > dll). A new dll was written specific to the control hardware. > > What I am trying to do is to read data back in (as data is going out) on a > different parallel printer port pin, and write this data back to the > FlexGrid. I am trying to do this from the new dll so that timing between > the > outgoing data and the incoming data will remain in sync. Capturing the > data > is not a problem. Writing the data back to the flex grid is. > > In the main program, when a cell is turned on or off, a call is made > CometMod.currentSong.setCell(MusicGrid, .row, .col, 0) where MusicGrid is > the FlexGrid, .row & .col are the row and column of the cell and the 0 > turns > the cell off, where a 1 would turn it on. This same function turns the > background of the cell white for off and black for on. Attempts to call > this > function from the dll have failed with a Run time error of '424 object > required'. I was not really expecting it to work - but hoping it would. > > So it is it possible to write back to a FlexGrid located in the main > program > from a dll that has been called from the main program? > > As a disclaimer, I know some about VB, but I am not an expert. Plus, I do > not pretend to understand all the intricacies of the program I am trying > to > add to. > > My thanks for all help. > David > If it is ActiveX dll then you can raise event from one of public classes within your dll. In the client you should have instance of that class declared with WithEvents keyword. If it is "true" dll, then you can use callback technique - when you pass address of some function with predefined signature to the dll (procedure should be defined in regular module), and then dll calls this procedure by given address. Dmitriy. "Dmitriy Antonov" wrote: Hi Dmitriy - As a novice, I am not sure of the difference betweena an ActiveX or a true dll. I believe the geekhideout_io.dll is done in assmebly and can be called from any program. It handles the IO to any port on the computer. The dll which I have the source for was done in VB6. This dll sets the port to be the address of your printer port and uses calls to the geekhideout_io.dll to ouput and input from the printer port. To be honest, I have not yet found where the main VB program calls the dll called by the VB program. The progam uses the timer function of the Windows Media Player to determine the current interval. Is this enough infor to determine if I am using an ActiveX or true dll? If so, could you expound on your answer on how to return data? Thanks, David Show quoteHide quote > > Are you talking about ActiveX dll or it is "true" dll? > > If it is ActiveX dll then you can raise event from one of public classes > within your dll. In the client you should have instance of that class > declared with WithEvents keyword. > > If it is "true" dll, then you can use callback technique - when you pass > address of some function with predefined signature to the dll (procedure > should be defined in regular module), and then dll calls this procedure by > given address. > > Dmitriy. > > >
Show quote
Hide quote
"David V. Fansler" <DavidVFans***@discussions.microsoft.com> wrote in As I understand, you want to send some notification to your "main" message news:8833A936-0765-41DD-9238-22927002616D@microsoft.com... > > > "Dmitriy Antonov" wrote: > Hi Dmitriy - As a novice, I am not sure of the difference betweena an > ActiveX or a true dll. I believe the geekhideout_io.dll is done in > assmebly > and can be called from any program. It handles the IO to any port on the > computer. The dll which I have the source for was done in VB6. This dll > sets the port to be the address of your printer port and uses calls to the > geekhideout_io.dll to ouput and input from the printer port. > > To be honest, I have not yet found where the main VB program calls the dll > called by the VB program. The progam uses the timer function of the > Windows > Media Player to determine the current interval. > > Is this enough infor to determine if I am using an ActiveX or true dll? > If > so, could you expound on your answer on how to return data? > Thanks, > David >> >> Are you talking about ActiveX dll or it is "true" dll? >> >> If it is ActiveX dll then you can raise event from one of public classes >> within your dll. In the client you should have instance of that class >> declared with WithEvents keyword. >> >> If it is "true" dll, then you can use callback technique - when you pass >> address of some function with predefined signature to the dll (procedure >> should be defined in regular module), and then dll calls this procedure >> by >> given address. >> >> Dmitriy. >> application from the dll, which you are currently working with and this one is being developed in VB. If true, then it is ActiveX.dll (there is no way to create regular DLLs in VB, so its simple to make such conclusion). So as I said, you can raise an event (which may contain parameters) from that dll and catch this event within your main application. Without knowing some details of your dll's construction, its hard to give you advise as to particular implementation. I think the best way to do is to refer you to the Help system or some (in fact, any) textbook for beginners. VB makes creation and use of events pretty trivial task and its hard to imagine that you can do something definite in VB without knowing this material - so you should study it anyway - the sooner the better (even if you never develop classes then you will not avoid usage of events created by someone else - so you must know how it works anyway). In minimal words your task is: 1. In your DLL 1a. In one of your public classes - define event along with necessary arguments. Since you make calls to this dll from your "main" application and you do it using some public class within your dll, then the first candidate for such event would be, perhaps, this class. 1b. When, during execution of some task within dll, there is time to notify caller, than you just use RaiseEvent method 2. In main application 2a declare object of mentioned class with WithEvents keywords (you can do it in module level only - can't use variables defined locally in procedures) 2b add event handler and add the code within this handler to response appropriately Definitely, it is essential that you have to know how both of your projects - main app and dll -work, nobody here can help you with this task. I don't know whether I could do more than that for you (as long as I understand your task correctly) . Dmitriy. Thanks Dmitry
David Show quoteHide quote "Dmitriy Antonov" wrote: > > "David V. Fansler" <DavidVFans***@discussions.microsoft.com> wrote in > message news:8833A936-0765-41DD-9238-22927002616D@microsoft.com... > > > > > > "Dmitriy Antonov" wrote: > > Hi Dmitriy - As a novice, I am not sure of the difference betweena an > > ActiveX or a true dll. I believe the geekhideout_io.dll is done in > > assmebly > > and can be called from any program. It handles the IO to any port on the > > computer. The dll which I have the source for was done in VB6. This dll > > sets the port to be the address of your printer port and uses calls to the > > geekhideout_io.dll to ouput and input from the printer port. > > > > To be honest, I have not yet found where the main VB program calls the dll > > called by the VB program. The progam uses the timer function of the > > Windows > > Media Player to determine the current interval. > > > > Is this enough infor to determine if I am using an ActiveX or true dll? > > If > > so, could you expound on your answer on how to return data? > > Thanks, > > David > >> > >> Are you talking about ActiveX dll or it is "true" dll? > >> > >> If it is ActiveX dll then you can raise event from one of public classes > >> within your dll. In the client you should have instance of that class > >> declared with WithEvents keyword. > >> > >> If it is "true" dll, then you can use callback technique - when you pass > >> address of some function with predefined signature to the dll (procedure > >> should be defined in regular module), and then dll calls this procedure > >> by > >> given address. > >> > >> Dmitriy. > >> > > > As I understand, you want to send some notification to your "main" > application from the dll, which you are currently working with and this one > is being developed in VB. If true, then it is ActiveX.dll (there is no way > to create regular DLLs in VB, so its simple to make such conclusion). So as > I said, you can raise an event (which may contain parameters) from that dll > and catch this event within your main application. Without knowing some > details of your dll's construction, its hard to give you advise as to > particular implementation. I think the best way to do is to refer you to the > Help system or some (in fact, any) textbook for beginners. VB makes creation > and use of events pretty trivial task and its hard to imagine that you can > do something definite in VB without knowing this material - so you should > study it anyway - the sooner the better (even if you never develop classes > then you will not avoid usage of events created by someone else - so you > must know how it works anyway). > > In minimal words your task is: > 1. In your DLL > 1a. In one of your public classes - define event along with necessary > arguments. Since you make calls to this dll from your "main" application and > you do it using some public class within your dll, then the first candidate > for such event would be, perhaps, this class. > 1b. When, during execution of some task within dll, there is time to notify > caller, than you just use RaiseEvent method > > 2. In main application > 2a declare object of mentioned class with WithEvents keywords (you can do it > in module level only - can't use variables defined locally in procedures) > 2b add event handler and add the code within this handler to response > appropriately > > Definitely, it is essential that you have to know how both of your > projects - main app and dll -work, nobody here can help you with this task. > > I don't know whether I could do more than that for you (as long as I > understand your task correctly) . > > Dmitriy. > > > > > >
Why sending email programmatically must be so complicated?
VB 2005 Express..NOT OT...really! File Copy Without Win Buffering Stumped -- trying to update a VBA subroutine for VB.net Ascertain number of fields in a user defined type Help - What is the best approach? Short file names cRegistry problems read/writing to (Default) WH_MOUSEHOOK_LL VBA stealing keys from ActiveX control? |
|||||||||||||||||||||||