Page 1 of 1
outlookbar
Posted: Mon Jun 22, 2015 1:44 am
by jaynahar
Hi All,
I am developing a plugin and from this plugin i want to click on any particular button of outlookbar control like family, account etc.
I am passing the patient number and then trying to click it programatically but its giving the error of out of memory.
Please help me how can i click on the particular button of outlook bar programmatically.
Regards
Jay nahar
Re: outlookbar
Posted: Mon Jun 22, 2015 4:06 am
by jaynahar
I am using the below code:
ContrAccount ContrAccount2 = (OpenDental.ContrAccount)od.Controls["ContrAccount"];
ContrAccount2.InitializeOnStartup();
ContrAccount2.Visible = true;
formopendental.ActiveControl = ContrAccount2;
ContrAccount2.ModuleSelected(PatNum);
before this code i am closing all the modules. When we are running the above code then line "ContrAccount2.Visible = true;" is giving the error of "out of memory".
Re: outlookbar
Posted: Mon Jun 22, 2015 9:22 am
by jsalmon
It looks like you're just trying to "go to the account module". If that is your goal, you should be able to use our public GoToModule class:
Code: Select all
OpenDental.GotoModule.GotoAccount(PatNum);
Re: outlookbar
Posted: Tue Jun 23, 2015 7:01 am
by jaynahar
Thanks for reply.
But getting another error I have triad to -"OpenDental.GotoModule.GotoAccount(PatNum)" is working fine, if patient is already selected but if we just launch open dental(no patient select) and than i have called "OpenDental.GotoModule.GotoAccount(PatNum)" from button click then getting error-
Only Account tab(means directly open GotoModule tab)-
System.ComponentModel.Win32Exception: Error creating window handle.
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.ButtonBase.OnVisibleChanged(EventArgs e)
please help me..
Thank in advanced.
Re: outlookbar
Posted: Tue Jun 23, 2015 9:12 am
by jsalmon
Not having a patient selected should be fine. It should work if you pass it a PatNum of zero. Is that not working?
Code: Select all
///<summary>Goes directly to an Account. Sometimes, patient is selected some other way instead of being passed in here, so OK to pass in a patNum of zero.</summary>
Re: outlookbar
Posted: Wed Jun 24, 2015 6:15 am
by jaynahar
Hi,
Thank you for your response.
We are passing the patnum as zero but still its not working.
Can you please provide the sample example.
Regards
Jay Nahar
Re: outlookbar
Posted: Wed Jun 24, 2015 7:50 am
by dgraffeo
Often that error occurs due to a memory leak in the program. Perhaps the way you're calling the function (or where you're calling it) is causing the program to create many copies of a single type of window in some sort of loop. The way to tell that is when you launch the program look at task manager for the process. Then when your code gets called, does the memory usage of the program start continually going up? The Windows limit for new window handles is 10,000. If the code is creating more than 10,000 handles for some reason (getting called repeatedly and making new windows maybe) then it will cause this error.
At any rate, it definitely is a memory leak/memory problem with too many windows being created.
Re: outlookbar
Posted: Wed Jun 24, 2015 7:53 am
by dgraffeo
Another tip in order to see what you need in the Task Manager, (This is for Windows 7), go to the Task Manager -> Processes tab. Then click on View menu button on the top of the window and click on Select Columns. Check the boxes for USER Objects and GDI Objects. If OpenDental.exe starts blowing up USER or GDI Objects then you know what's taking up all of the handles.
Re: outlookbar
Posted: Fri Jun 26, 2015 9:33 am
by jsalmon
jaynahar wrote:We are passing the patnum as zero but still its not working.
Can you please provide the sample example.
You must be doing something else that is causing the UE to occur. The following example works just fine for me:
Code: Select all
public override bool HookAddCode(object sender,string hookName,params object[] parameters) {//required method
switch(hookName){
case "FormOpenDental.Load_end":
//At this point, Open Dental has loaded with the Appts module selected and no patient.
//This plugin will automatically start with the Account module selected.
OpenDental.GotoModule.GotoAccount(0);
return true;
default:
return false;
}
}
Re: outlookbar
Posted: Tue Jun 30, 2015 10:12 pm
by jaynahar
Thanks for reply.
Its Working fine, but in Appointment Module need to pass two parameter Date-time and AptNo. so my question is how to pass aptno if not available any appointment.
I have try to pass current date-time and 0 aptno, but getting error.
Please help me.
Thanks in Advanced.
Re: outlookbar
Posted: Wed Jul 01, 2015 7:52 am
by dgraffeo
What error are you getting? If you have an appointment that's been inserted into the database already, the AptNum will not be 0.
Re: outlookbar
Posted: Wed Jul 01, 2015 8:17 am
by jsalmon
Once again, what you said works just fine for me:
Code: Select all
public override bool HookAddCode(object sender,string hookName,params object[] parameters) {//required method
switch(hookName) {
case "FormOpenDental.Load_end":
//At this point, Open Dental has loaded with the Appts module selected and no patient.
//This plugin will automatically start with the Account module selected.
OpenDental.GotoModule.GotoAccount(0);
Thread.Sleep(1000);//Just shows that we actually switched to the Account module for an entire second.
//Now that the account is showing, simply go back to the Appts module for today's date.
//If the user does not want to change the date that was being viewed, pass DateTime.MinValue which will not change the date being viewed.
OpenDental.GotoModule.GotoAppointment(DateTime.Today,0);
return true;
default:
return false;
}
}