|
I'm having some frustrating issues and I'm hoping that
someone can help me. I have two apps created by VC++6.0
that have an Access database, they are data entry and data
search apps. The code internally is arranged, in the data
entry app, so that it is in edit mode for maybe a 1/10 of a
second as it copies local variables to the dataset and
updates it. However, while the entry app is being used the
data search app (when started up) get an error message that
says 'Couldn't Update; currently locked by user admin on
machine <machine name="">'. Now this just started recently, I
checked the mdb file itself under
[Tools->Options->Advanced] the 'Default Open Mode' is set to
Shared, and the 'Default Record Locking' is set to No
Locks. What would be causing this?? I really appreciate
any help someone might have with this.
|
|
|
|
|
Does anyone have experience with keyboard hooks?
I have created a keyboard hook and it works just fine provided the exe driving the dll displays a dialog box with an edit control and the edit control has focus.
However, if another app has focus, say Notepad.exe, then the keyboard hook never receives the messages.
What I think I need is some way to force the keyboard hook to the top of the message chain.
I would like to start a dialog with anyone that has worked with keyboard hooks before.
Thank you.
PMCGAHAN@UCSWORKS.COM
|
|
|
|
|
Are you using SetWindowsHookEx? If so can I see a snippet of the code you are using?
==================
The original message was:
Does anyone have experience with keyboard hooks?
I have created a keyboard hook and it works just fine provided the exe driving the dll displays a dialog box with an edit control and the edit control has focus.
However, if another app has focus, say Notepad.exe, then the keyboard hook never receives the messages.
What I think I need is some way to force the keyboard hook to the top of the message chain.
I would like to start a dialog with anyone that has worked with keyboard hooks before.
Thank you.
PMCGAHAN@UCSWORKS.COM
|
|
|
|
|
Here is the
ghHook = SetWindowsHookEx(WH_KEYBOARD, &KeyboardProc, ghInstance, NULL);
Since I reported the problem, I believe I have found an answer.
I am using
SendMessage(ghWnd, gnKeyMsg, wParam, lParam);
to get information out of keyhook.
This dll attaches itself to every process in the system. One dll but many memory spaces.
The problem is only the exe that launches the dll sets the value of hgWnd, in all other memory spaces it is NULL.
I think what I need to do is set this value in the registery and read it into each memory space.
What do you think.
Thank you.
==================
The original message was:
Are you using SetWindowsHookEx? If so can I see a snippet of the code you are using?
================== The original message was: Does anyone have experience with keyboard hooks?
I have created a keyboard hook and it works just fine provided the exe driving the dll displays a dialog box with an edit control and the edit control has focus.
However, if another app has focus, say Notepad.exe, then the keyboard hook never receives the messages.
What I think I need is some way to force the keyboard hook to the top of the message chain.
I would like to start a dialog with anyone that has worked with keyboard hooks before.
Thank you.
PMCGAHAN@UCSWORKS.COM
|
|
|
|
|
Hi,
you can use universal message filters and look for keyboard messagers. I tried other ways too, but no one works. I the sample file you can replace ::GetCurrentThreadId() by NULL to have a system-wide filter.
==================
The original message was:
Does anyone have experience with keyboard hooks?
I have created a keyboard hook and it works just fine provided the exe driving the dll displays a dialog box with an edit control and the edit control has focus.
However, if another app has focus, say Notepad.exe, then the keyboard hook never receives the messages.
What I think I need is some way to force the keyboard hook to the top of the message chain.
I would like to start a dialog with anyone that has worked with keyboard hooks before.
Thank you.
PMCGAHAN@UCSWORKS.COM
|
|
|
|
|
Hi!
I need to combine a stored bitmap (>= 256 color) with some graphic elements (e.g. lines, text, ...) and save it as a 256 color bitmap. Do you have any code to reduce the color depth of a bitmap (because this is the real hard thing for me)? Thank you in advance!
Ciao,
Alex
|
|
|
|
|
Hi all,
I have a Dialog based app that creates a Modal Dialog Box
that then creates some modeless dialog's.
What I need to know is when a modeless dialog exits,
I wish it to pass a message back to the Modal Dialog when the modeless dialog Box has been finished
with a EndDialog.
Sorry for this being a simple question. But I have looked through a stack of samples, And couldn't find an example of this being done.
Regardz
Colin Davies
|
|
|
|
|
You could pass a pointer to your modal dialog up to its child modeless dialog. Then place a function in your modal dialog that will allow you to set your message. Then from your modeless dialog you can call that function before you call enddialog.
==================
The original message was:
Hi all, I have a Dialog based app that creates a Modal Dialog Box that then creates some modeless dialog's. What I need to know is when a modeless dialog exits, I wish it to pass a message back to the Modal Dialog when the modeless dialog Box has been finished with a EndDialog.
Sorry for this being a simple question. But I have looked through a stack of samples, And couldn't find an example of this being done.
Regardz
Colin Davies
|
|
|
|
|
Colin,
Do not use EndDialog() with Modeless Dialogboxes. What you need to do is override the OnOK() and OnCancel() methods and call DestroyWindow(). As for passing a message back to the parent dialogbox, all you need to do is have a "MyParent" variable and do the type cast back to the parent class.
Ex: (( CYourClassHere *) MyParent)->VariableOrMethodHere;
** Note ** : This assumes that your dialogs are CWnd based.
- Mike
P.S. - Any other questions - drop me an e-mail or pop a rely to this message ...
==================
The original message was:
Hi all, I have a Dialog based app that creates a Modal Dialog Box that then creates some modeless dialog's. What I need to know is when a modeless dialog exits, I wish it to pass a message back to the Modal Dialog when the modeless dialog Box has been finished with a EndDialog.
Sorry for this being a simple question. But I have looked through a stack of samples, And couldn't find an example of this being done.
Regardz
Colin Davies
|
|
|
|
|
I have a CWnd hosting an ActiveX control. How can I change it's size?
TIA
Peter
|
|
|
|
|
I have a dialog based app with three listboxes. I used AddString("") to add several items to
each string. When I run the program, it allows me to select all the items at one time. I
want the user to only be able to select one item at a time. How do I do this?
Thanks,
Stephanie
|
|
|
|
|
Hi,
If you create list boxes explicitely using create function then make sure that you didn't specify LBS_EXTENDEDSEL or LBS_MULTIPLESEL style.
If you use dialog editor for creating the template for your dialog then you have to display a property dialog for the list box control. On this dialog you have to select the second page "Styles" and in the "Selection" combo box you have to choose "Single" item
Regards,
Andrei Zenkovitch
Dundas Software
==================
The original message was:
I have a dialog based app with three listboxes. I used AddString("") to add several items to each string. When I run the program, it allows me to select all the items at one time. I want the user to only be able to select one item at a time. How do I do this?
Thanks, Stephanie
|
|
|
|
|
I had "Single" selected. It makes the list box gray (instead of white) and won't unselect
item. ie. The default selection is String1. If you click on String2, both are blue. If you
click again on String1, it stays blue. It's impossible to select only one string, unless you
take the default. I'm not sure what's going on.
Stephanie
==================
The original message was:
Hi,
If you create list boxes explicitely using create function then make sure that you didn't specify LBS_EXTENDEDSEL or LBS_MULTIPLESEL style. If you use dialog editor for creating the template for your dialog then you have to display a property dialog for the list box control. On this dialog you have to select the second page "Styles" and in the "Selection" combo box you have to choose "Single" item
Regards, Andrei Zenkovitch Dundas Software ================== The original message was: I have a dialog based app with three listboxes. I used AddString("") to add several items to each string. When I run the program, it allows me to select all the items at one time. I want the user to only be able to select one item at a time. How do I do this?
Thanks, Stephanie
|
|
|
|
|
I just figured out what it was. In an earlier version of the dialog box, I was changing the
color. I don't need that anymore, and when I took out the code, it started working as it
should.
Thanks for your help!
Stephanie
==================
The original message was:
I had "Single" selected. It makes the list box gray (instead of white) and won't unselect item. ie. The default selection is String1. If you click on String2, both are blue. If you click again on String1, it stays blue. It's impossible to select only one string, unless you take the default. I'm not sure what's going on.
Stephanie ================== The original message was: Hi,
If you create list boxes explicitely using create function then make sure that you didn't specify LBS_EXTENDEDSEL or LBS_MULTIPLESEL style. If you use dialog editor for creating the template for your dialog then you have to display a property dialog for the list box control. On this dialog you have to select the second page "Styles" and in the "Selection" combo box you have to choose "Single" item
Regards, Andrei Zenkovitch Dundas Software ================== The original message was: I have a dialog based app with three listboxes. I used AddString("") to add several items to each string. When I run the program, it allows me to select all the items at one time. I want the user to only be able to select one item at a time. How do I do this?
Thanks, Stephanie
|
|
|
|
|
I am using VC5. If you place a Rich Edit (RE) control in a dialog from the controls toolbar and bring up the class wizard the RE control ID is not listed in the list of member variables. Is this correct? How are you supposed to exchange data with the RE control? The object ID for the RE control does appear in the Message Maps tab of the class wizard. Do I write handlers (as required) for the 26 NM_ and EN_ messages listed? Do I manually add a CRichEditCtrl member variable to the dialog class?
Thanks again for any help supplied
Steve
|
|
|
|
|
This is probably due to the fact that the ID is not yet linked with the dialog. If VC5 works the same as VC6 in the resource editor, hit ctrl+w after clicking on the richedit control...it should automatically bring up the RichEdit ID in the box (then, make sure to select the dialog class, if it is not already selected, so that your inserted functions go in the right class).
==================
The original message was:
I am using VC5. If you place a Rich Edit (RE) control in a dialog from the controls toolbar and bring up the class wizard the RE control ID is not listed in the list of member variables. Is this correct? How are you supposed to exchange data with the RE control? The object ID for the RE control does appear in the Message Maps tab of the class wizard. Do I write handlers (as required) for the 26 NM_ and EN_ messages listed? Do I manually add a CRichEditCtrl member variable to the dialog class? Thanks again for any help supplied Steve
|
|
|
|
|
How can I reload explorer.exe through C++?
I need to do this so it rereads the registry.
Thanx.
|
|
|
|
|
I remember seeing how to do this in "Visual C++ Windows Shell Programming" (a cool book BTW). The topic isn't in the index (and I'm not really up for searching through 660+ pages for it) so this is from memory...
I believe you get the HWND of the window with class "Program Manager" and send it a WM_CLOSE. Then re-run Explorer to restart the shell. The only trouble with this is that some of your tray icons will be blown away.
--Mike--
==================
The original message was:
How can I reload explorer.exe through C++? I need to do this so it rereads the registry.
Thanx.
|
|
|
|
|
==================
The original message was:
I remember seeing how to do this in "Visual C++ Windows Shell Programming" (a cool book BTW). The topic isn't in the index (and I'm not really up for searching through 660+ pages for it) so this is from memory...
I believe you get the HWND of the window with class "Program Manager" and send it a WM_CLOSE. Then re-run Explorer to restart the shell. The only trouble with this is that some of your tray icons will be blown away.
--Mike-- ================== The original message was: How can I reload explorer.exe through C++? I need to do this so it rereads the registry.
Thanx.
|
|
|
|
|
Ah, I found it after all!
HWND hwnd = FindWindow( _T("Progman"), NULL );
PostMessage( hwnd, WM_QUIT, 0, 0 );
ShellExecute( NULL, NULL, _T("explorer.exe"), NULL, NULL, SW_SHOW );
|
|
|
|
|
I need to add a text import feature to the file save / load command on a RichEditView MDI application. Any suggestions?
|
|
|
|
|
I'm using VC++5. I find that when I use the resource editor to put a Rich Edit control in a dialog that is used either as part of a property sheet or as a dialog started from a menu option that the DoModal dialog callreturns -1 indicating that the box could not be created. (The same thing happens in VC++6). I searched the help and found no mention of any such limitation - it seems logical to be able to do it as the control is in the toolbar in the resource editor. I guess I must be doing something wrong. Any ideas?
Steve
|
|
|
|
|
Yes, there is a mention in the help files, you must have missed it though, since it is indirect. In order to use a RichEdit control, you must make sure that the RichEdit control DLL is loaded to do this, make sure that before your dialog or property sheet is loaded, you call AfxInitRichEdit()
|
|
|
|
|
Hi Steve,
The problem has to do with the fact that when CDialog tries to create a dialog window from the resource template internally it does by calling ::CreateWindowEx() function. The most important argument in this function is the name of the window class (like "Static" for static control or "Edit" for edit control). It is required that before window is created its window class must be registered. MFC does it internally for common controls but not for rich edit control which implementation resides in different dll. So when you call DoModal() function the internal Windows implementation will fail to create the rich edit control and therefore the creation of the dialog will fail as well.
Now how to fix the problem.
You just have to load the dll that contains rich edit control implementation in your InitInstance() function:
HINSTANCE hRichEdDLL=::LoadLibrary(_T("RICHED32.DLL");
if(g_hRichEdDLL==NULL)
TRACE(_T("Cannot load library to display RichEditTextControl"));
Regards,
Andrei Zenkovitch
Dundas Software
P.S. I assumed you were using MFC. If it is not the case then above mentioned explanations are still valid.
==================
The original message was:
I'm using VC++5. I find that when I use the resource editor to put a Rich Edit control in a dialog that is used either as part of a property sheet or as a dialog started from a menu option that the DoModal dialog callreturns -1 indicating that the box could not be created. (The same thing happens in VC++6). I searched the help and found no mention of any such limitation - it seems logical to be able to do it as the control is in the toolbar in the resource editor. I guess I must be doing something wrong. Any ideas?
Steve
|
|
|
|
|
Andrei,
Thank-you; this seems to explain the other advice I received to include AfxInitRichEdit() in InitInstance.
Steve
==================
The original message was:
Hi Steve,
The problem has to do with the fact that when CDialog tries to create a dialog window from the resource template internally it does by calling ::CreateWindowEx() function. The most important argument in this function is the name of the window class (like "Static" for static control or "Edit" for edit control). It is required that before window is created its window class must be registered. MFC does it internally for common controls but not for rich edit control which implementation resides in different dll. So when you call DoModal() function the internal Windows implementation will fail to create the rich edit control and therefore the creation of the dialog will fail as well.
Now how to fix the problem. You just have to load the dll that contains rich edit control implementation in your InitInstance() function:
HINSTANCE hRichEdDLL=::LoadLibrary(_T("RICHED32.DLL"); if(g_hRichEdDLL==NULL) TRACE(_T("Cannot load library to display RichEditTextControl"));
Regards, Andrei Zenkovitch Dundas Software
P.S. I assumed you were using MFC. If it is not the case then above mentioned explanations are still valid. ================== The original message was: I'm using VC++5. I find that when I use the resource editor to put a Rich Edit control in a dialog that is used either as part of a property sheet or as a dialog started from a menu option that the DoModal dialog callreturns -1 indicating that the box could not be created. (The same thing happens in VC++6). I searched the help and found no mention of any such limitation - it seems logical to be able to do it as the control is in the toolbar in the resource editor. I guess I must be doing something wrong. Any ideas?
Steve
|
|
|
|