|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Activex EXE helpI am calling the Active EXE from my standard exe project. Below is the code (First method). Now the load menu function will load my MDI form based on the parameters. Once I close the mdi form my focus should go to my calling standard exe. I raised the event on MDI Unload event. Till this point everything working fine. Now the problem is my client would like to execute the same ActiveX Exe as well as standalone program too. In this case, if I create instance class clsmain from my sub Main (module) function, now its working fine as a stand-alone program. I am calling the LoadForm function from Main function. You can see the code on under second method. But when I call the same program as active exe, the focus not going back to my calling standard exe. The problem is now it’s created the clsmain object on module main function itself, so I lost the class object created from standard exe. So it’s not executing the raise event, I mean the focus not going back to standard exe. How to solve this issue? First method: --------------------------------------------------------------- 'Class module - clsmain Public Event Finished(Message As String) Private WithEvents frm As frmMDI Public Sub LoadMenu(Optional sPatientName1 As String, Optional sIntegrationPath1 As String) On Error Resume Next sPatientName = sPatientName1 sIntegrationPath = sIntegrationPath1 Set frm = New frmMDI frm.Show End Sub Public Sub frm_test2(ss As String) RaiseEvent Finished("END") End Sub ------------------------------------------------------------- 'Module Public Sub main() End Sub -------------------------------------------------------------- 'MDI Form 'Declartions Public Event test2(ss As String) Private Sub MDIForm_Unload(Cancel As Integer) RaiseEvent test2("SS") End End Sub ------------------------------------------------------------ 'from Standard exe Set ObjPrj = New Project.clsMain ObjPrj.LoadMenu para1, Para2 Second method: ------------------------------------------------------------- 'Module Public Sub main() dim test as new clsmanin test.LoadForm End Sub --------------------------------------------------------------- 'Class module - clsmain Public Sub LoadForm() frmmdi.show End Sub "Bala" <B***@discussions.microsoft.com> wrote in message I got a bit lost on the code there <g> First thing you'll want to do is get news:BF958966-BC2D-4980-8EDE-DDE2BEC35A0C@microsoft.com... > Hi All, > > I am calling the Active EXE from my standard exe project. Below is the > code > (First method). rid of the End statement in MDIForm_Unload. End is never needed and will cause more problems than it cures. Also, you're probably never getting the event from your code where you have..... RaiseEvent test2("SS") .....because, it one section of the code, you're creating an instance of frmMDI and storing its reference in a "withevents" variable called frm and in another section, you're using frmMDI.Show (using the form's name directly instead of the object variable you've setup WithEvents) -- Ken Halter - MS-MVP-VB - http://www.vbsight.com DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm Please keep all discussions in the groups.. For the test purpose I used the end statment (when execute like stand alone).
and the raisevent end will work when i work as activex EXE. So is it no other way to work this program as stand alone and also activex exe? Thanks bala Show quoteHide quote "Ken Halter" wrote: > "Bala" <B***@discussions.microsoft.com> wrote in message > news:BF958966-BC2D-4980-8EDE-DDE2BEC35A0C@microsoft.com... > > Hi All, > > > > I am calling the Active EXE from my standard exe project. Below is the > > code > > (First method). > > I got a bit lost on the code there <g> First thing you'll want to do is get > rid of the End statement in MDIForm_Unload. End is never needed and will > cause more problems than it cures. > > Also, you're probably never getting the event from your code where you > have..... > > RaiseEvent test2("SS") > > .....because, it one section of the code, you're creating an instance of > frmMDI and storing its reference in a "withevents" variable called frm and > in another section, you're using frmMDI.Show (using the form's name directly > instead of the object variable you've setup WithEvents) > > -- > Ken Halter - MS-MVP-VB - http://www.vbsight.com > DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm > Please keep all discussions in the groups.. > > > "Bala" <B***@discussions.microsoft.com> wrote in message You can start an ActiveX exe and treat it as stand-alone... one of the news:34AB2C40-F128-4A0C-8266-1D7221904A21@microsoft.com... > For the test purpose I used the end statment (when execute like stand > alone). > and the raisevent end will work when i work as activex EXE. > > So is it no other way to work this program as stand alone and also activex > exe? > > Thanks > bala easiest ways is to make it start in Sub Main. In Sub Main, have some code that looks like.... If App.StartMode = vbSModeStandalone Then 'do your "Stand Alone" stuff here End If -- Ken Halter - MS-MVP-VB - http://www.vbsight.com DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm Please keep all discussions in the groups.. Thanks a million!. You are the genius!.
thanks bala Show quoteHide quote "Ken Halter" wrote: > "Bala" <B***@discussions.microsoft.com> wrote in message > news:34AB2C40-F128-4A0C-8266-1D7221904A21@microsoft.com... > > For the test purpose I used the end statment (when execute like stand > > alone). > > and the raisevent end will work when i work as activex EXE. > > > > So is it no other way to work this program as stand alone and also activex > > exe? > > > > Thanks > > bala > > You can start an ActiveX exe and treat it as stand-alone... one of the > easiest ways is to make it start in Sub Main. > > In Sub Main, have some code that looks like.... > > If App.StartMode = vbSModeStandalone Then > 'do your "Stand Alone" stuff here > End If > > -- > Ken Halter - MS-MVP-VB - http://www.vbsight.com > DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm > Please keep all discussions in the groups.. > > > Hi
and I set my clsmain instancing propery as globalmultiuse. Is that Ok? thanks bala Show quoteHide quote "Ken Halter" wrote: > "Bala" <B***@discussions.microsoft.com> wrote in message > news:34AB2C40-F128-4A0C-8266-1D7221904A21@microsoft.com... > > For the test purpose I used the end statment (when execute like stand > > alone). > > and the raisevent end will work when i work as activex EXE. > > > > So is it no other way to work this program as stand alone and also activex > > exe? > > > > Thanks > > bala > > You can start an ActiveX exe and treat it as stand-alone... one of the > easiest ways is to make it start in Sub Main. > > In Sub Main, have some code that looks like.... > > If App.StartMode = vbSModeStandalone Then > 'do your "Stand Alone" stuff here > End If > > -- > Ken Halter - MS-MVP-VB - http://www.vbsight.com > DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm > Please keep all discussions in the groups.. > > > On Wed, 12 Oct 2005 15:04:03 -0700, "=?Utf-8?B?QmFsYQ==?="
<B***@discussions.microsoft.com> wrote: >Hi That ensures that you only have one 'instance' of the AX EXE running,> >and I set my clsmain instancing propery as globalmultiuse. Is that Ok? and that you do not have to 'create' it to call an exposed property in an exposed Class Personally I would opt for MultiUse and explicitly 'create' the AX EXE as it restricts the location of errors if the AX EXE cannot be found. 5 MultiUse. Allows other applications to create objects from the class. One instance of your component can provide any number of objects created in this fashion. 6 GlobalMultiUse. Similar to MultiUse, with one addition: properties and methods of the class can be invoked as if they were simply global functions. It’s not necessary to explicitly create an instance of the class first, because one will automatically be created.
excel versions in Vb 6
Application error "Permission Denied" only under WinXP-SP2 Is there a more elegant way to do this? Compile, Save, Exit, ReStart, big trouble VB6 Variable Name as String format number again Problem connecting to remote MySQL DB from VB6 Dependency walker and custom ocx. Lexical analysis How many ORs can you have in ADODB |
|||||||||||||||||||||||