 |
|
|
I checked in the .zip folder, and MsgBoxCheck.dll is not there. I'm wanting to use this from a VB6 app. I presume that, once I have the MsgBoxCheck.dll file, that's doable?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Mike
This is a handy little class. Any chance you could add a parameter that lets you set the default button.
For example, I am using the "Yes/No" buttons and the default button is the "Yes" button. I would like to have a parameter that allows me to set the "No" button as the default button...
You can contact me at howartthou@hotmail.com.
Regards SuperCoder!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi, I checked this sample in Vista and the checkbox isn't rendered right. Has anyone come up with a solution to this?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Yes this does seem to be a "Vista Problem". Try the latest service pack...
You can contact me at howartthou@hotmail.com.
Regards SuperCoder!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hello Mike,
I just want to know if there's a license attached on the usage of the dll file. Can I use it freely on the project I'm developing. What are the limitations?
The only negative thing I've noted is the checkbox size. I think it is not set to AutoSize as it catches mouse events until the right end of the form. This could lead to accidental checking of the checkbox.
Anyway, you've done a great job.
Cheers.
Rolly
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
It is soeasy to implement this is VB2005. Just add reference to MsgBoxCheck.dll (To do this, double click on "My Project" then click on "References" tab, click "Add" button then browse to the folder location of MsgBoxCheck.dll. Click on it then hit "OK".
After adding the reference create a button then put the code below on the click event.
Dim dlg As MsgBoxCheck.MessageBox = New MsgBoxCheck.MessageBox() Dim dr As DialogResult = dlg.Show("Software\PricklySoft\TestMsgBoxCheck", "DontShowAgain", System.Windows.Forms.DialogResult.OK, "Don't ask me this again", "Now is the time for all good men to check this message box", "Hello", MessageBoxButtons.OK, MessageBoxIcon.Information).
You can find the registry entry at HKEY_CURRENT_USER\Software\PricklySoft\TestMsgBoxCheck
Hope this helps.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
anybody know how to use this from a visual c++ project? is there a .h? I'm not familiar with C# dlls, thanks
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
How can I get the reg path for the creation of these keys and the source code for this custom dll?
|
| Sign In·View Thread·PermaLink | 1.67/5 (2 votes) |
|
|
|
 |
|
|
In .NET we rather stay away from registry. We have configs, UserSettings ...
So I think it would be better if instead of passing registry path I could pass object implementing ICheckStateSaver so I could store check state in registry, database, UserSettings in user scope and so on.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Would you be willing to post the source for WindowsHook.dll and cbthook.dll? The tool works great standalone but inside a project with strongly typed assemblies it will not compile as these two dll's are not strongly type.
Mike
|
| Sign In·View Thread·PermaLink | 4.00/5 (1 vote) |
|
|
|
 |
|
|
Check the MSDN articles referenced in the "Background" section. I believe they have links to download the code.
Thanks, Mike
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
This also worked great in my VB.NET program however I had a couple of problems that were easily resolved but should be mentioned.
1. The msgboxcheck.dll requires two others also included in the zip file, windowshook.dll and cbthook.dll. All three need to be added as references before you can use it. Note for vb.net programmers add this to your global variables section of your code:
Public gbMsgboxCheck = New MsgBoxCheck.MessageBox
2. Another problem was that intellisense didn't work. I think this is because my code is vb.net and the dll is C#. The way around this is to write a function that simply calls gbMsgboxCheck with the proper parameters. This is good because you can setup default parameters. My function is called MsgCheck and looks like this:
MsgCheck("This is the message", "CallingProcedure")
I use the name of the calling procedure or function as my registry section to save the checkbox answer.
Thank you.
Drogil
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
This works ok for an "OK" messagebox.. but imagine this:
You have a yesno messagebox for confirmation of closing an application.
I check "don't ask me this again" but select the "no" button. It doesn't exit the program, but it does set my registry value to true..so the 2nd time I click exit, the message box warning doesn't appear..and it should!
Maybe it could be added?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
It´s a good idea,but it doesn´t work on my app, because i use Joaqs.Ui (WinXP visual style), but i´ve learn write/read from registry. In my particular problem i´ve got a class called "myMessageBox" inherit form Windows.Form.Form that has a behaviour similar to MessageBox. Now i´ve added 3 params called "showDontShowAgain","registry","key". So when i want "don´t show again" behavior i just construct like this:
myMessageBox("UpText","ErrorText","MoreInfoTex",true,registry,key);
for example.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I had the same problem - I needed a YesNo messagebox, but it needed to reappear if No was selected - even if the checkbox was checked. I worked around the problem by catching the dialogresult and using a conditional statement, I simply deleted the key that was produced (if the checkbox was checked). This effectivly made it impossible to make a key when No was selected.
I'm pretty new to VS2005 (and programming in general for that matter), so it may be a "hack" workaround - but it works!
(i.e.) DialogResult dr = ckMB.Show(strKey, "Answer", DialogResult.Yes, "Don't ask me this again", "This action will reset the color ramp and any changes will be lost.\nAre you sure you want to continue?","Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.No) { Registry.CurrentUser.DeleteSubKey(strKey,false); ... }
Blazetopher
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
One extension to this would be a "Don't ask again" box that always selects the same option that was first selected. That way you could have a yes/no message box that, once the user has answered once, will always stay the same.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
With a small modification to the Show method, this can be achieved. Simply, instead of storing a true/false value in the registry, store the DialogResult value corresponding to the button selected by user. And if the checkbox is not checked, don't store anything.
This is the new Show method. Note that I have removed the "DialogResult dr" input parameter, so the same must be done on all the overloads of the method.
public DialogResult Show(string strKey, string strValue, string strCheck, string strText, string strTitle, MessageBoxButtons buttons, MessageBoxIcon icon) { DialogResult dr; RegistryKey regKey = Registry.CurrentUser.CreateSubKey(strKey); int? savedValue=regKey.GetValue(strValue) as int?; if(savedValue!=null) return (DialogResult)savedValue; m_strCheck = strCheck; m_cbt.Install(); dr = System.Windows.Forms.MessageBox.Show(strText, strTitle, buttons, icon); m_cbt.Uninstall();
if(m_bCheck) regKey.SetValue(strValue, (int)dr); return dr; }
Also, I would suggest to make the Show methos static, as in the original MessageBox class.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
*Clap* I was just about to write this! All the ones I looked at either faked a message box, in which case you lose the benefits of using a proper message box, like icons that are the right style for the OS etc. or they just do a really bad job of hooking into the real message box and placing the checkbox in ugly positions, or they dont bother tracking the checked state properly.
Well done, your code caters for everything, does it properly, is elegant and is neat.
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |