outlookbar

This forum is for programmers who have questions about the source code.
Post Reply
jaynahar
Posts: 40
Joined: Wed Apr 23, 2014 6:35 am

outlookbar

Post by jaynahar » Mon Jun 22, 2015 1:44 am

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

jaynahar
Posts: 40
Joined: Wed Apr 23, 2014 6:35 am

Re: outlookbar

Post by jaynahar » Mon Jun 22, 2015 4:06 am

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".

User avatar
jsalmon
Posts: 1551
Joined: Tue Nov 30, 2010 12:33 pm
Contact:

Re: outlookbar

Post by jsalmon » Mon Jun 22, 2015 9:22 am

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);
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com

jaynahar
Posts: 40
Joined: Wed Apr 23, 2014 6:35 am

Re: outlookbar

Post by jaynahar » Tue Jun 23, 2015 7:01 am

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.

User avatar
jsalmon
Posts: 1551
Joined: Tue Nov 30, 2010 12:33 pm
Contact:

Re: outlookbar

Post by jsalmon » Tue Jun 23, 2015 9:12 am

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>
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com

jaynahar
Posts: 40
Joined: Wed Apr 23, 2014 6:35 am

Re: outlookbar

Post by jaynahar » Wed Jun 24, 2015 6:15 am

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

User avatar
dgraffeo
Posts: 147
Joined: Wed Sep 24, 2014 3:19 pm

Re: outlookbar

Post by dgraffeo » Wed Jun 24, 2015 7:50 am

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.
"To understand what recursion is, you must first understand recursion."

David Graffeo
Open Dental Software
http://www.opendental.com

User avatar
dgraffeo
Posts: 147
Joined: Wed Sep 24, 2014 3:19 pm

Re: outlookbar

Post by dgraffeo » Wed Jun 24, 2015 7:53 am

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.
"To understand what recursion is, you must first understand recursion."

David Graffeo
Open Dental Software
http://www.opendental.com

User avatar
jsalmon
Posts: 1551
Joined: Tue Nov 30, 2010 12:33 pm
Contact:

Re: outlookbar

Post by jsalmon » Fri Jun 26, 2015 9:33 am

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;
	}
}
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com

jaynahar
Posts: 40
Joined: Wed Apr 23, 2014 6:35 am

Re: outlookbar

Post by jaynahar » Tue Jun 30, 2015 10:12 pm

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.

User avatar
dgraffeo
Posts: 147
Joined: Wed Sep 24, 2014 3:19 pm

Re: outlookbar

Post by dgraffeo » Wed Jul 01, 2015 7:52 am

What error are you getting? If you have an appointment that's been inserted into the database already, the AptNum will not be 0.
"To understand what recursion is, you must first understand recursion."

David Graffeo
Open Dental Software
http://www.opendental.com

User avatar
jsalmon
Posts: 1551
Joined: Tue Nov 30, 2010 12:33 pm
Contact:

Re: outlookbar

Post by jsalmon » Wed Jul 01, 2015 8:17 am

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;
	}
}
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com

Post Reply