|
I see.
Thank you.
Regards,
|
|
|
|
|
How can I translate the keyboard character to the current keyboard layout string? In the method CWnd::OnKeyDown I would like to translate the input character to the non English character - e.g. German. Maybe it is not possible to do it in the OnKeyDown method and I have use rather another method/mechanism, but I don't know which one. Unfotunately the given method always returns me the English character even I switched the keyboard layout to another language.
Thanks,
Abyss
|
|
|
|
|
Hi
I think LoadKeyboardLayaut function is helpful for you , you most give yor languge code to this function it change keyboard language.
LoadKeyboardLayaut(_T("00000409"),KLF_ACTIVATE);
LoadKeyboardLayaut(_T("00000429"),KLF_ACTIVATE);
Iman Ghasrfakhri
|
|
|
|
|
Hi,
I didn't know this method, but based on MSDN it loads the keyboard layout. I have to play with this maybe it will automatically translates the character to the local character...
However user can switch to another languages. How can I catch this event? Or will Windows automatically handle this situation? It only requires to have the keyboard layout loaded to the application?
Thanks for your help,
Abyss
|
|
|
|
|
Hi,
I am developing an application with several components in it. The main application will have a GUI and there are several components like BHO, MS Office Addins, Clipboard trackers etc. I have a problem here.
These components should communicate with the main application by some means. It has to pass some events or some values to the main application. I will be creating both the components and the main application and I would like to know, the best method to connect the components to the main application.
I have pretty good exposure to COM and Windows programming.
Also Is it possible to create a Singleton Automation server ?
Thanks and Regards
Jugs
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Jagadeesh VN wrote:
communicate with the main application
Define "communicate" and the needs of the "communication process".
Are we talking about COM components? Will access methods do (get/set)?
Jagadeesh VN wrote:
connect the components to the main application
Define "connect".
Is this "connect" in the sense ::CoCreateInstance or is it referring to the "communication process" above?
Jagadeesh VN wrote:
Singleton Automation server
This feels like you want some kind of COM server that will act as a switchboard for the "communication process". Right or wrong?
The best way, IMO, is to register the server in the ROT and use monikers to be sure that there is only one switchboard alive.
But perhaps this is overkill. How about callback interfaces or connection points if we are talking about COM components?
--
Roger
|
|
|
|
|
Hi Roger,
Thanks for the reply.
"Define "communicate" and the needs of the "communication process".
Are we talking about COM components? Will access methods do (get/set)?"
I have a BHO and some MS office addins, which will be continously monitoring some of the events like BeforeNavigate (BHO), OnOpenNewDocument(Addin), ONCloseDocument(Addin), etc.
I have a GUI application, where all these events should be reported consistently. I was thinking of implementing the GUI application as a Singleton Automation Server using DECLARE_CLASSFACTORY_SINGLETON macro. Then the monitoring components will create an instance of this automation server and since it is implemented using singleton pattern, the monitors will be able to connect and bind to the same instance of the GUI. Then they can use EventSinks or some other interface methods to communicate with the GUI.
Also Since I am using DECLARE_CLASSFACTORY_SINGLETON, I belive the Service Control Manager will check the Running Object Table and will return the currently active instance to all the clients. Can you please confirm this.
Once again Thanks for posting a reply.
Regards
Jugs
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Hi Jugs,
OK, so you have some COM servers (BHOs, MsOffice AddIns etc) and some clients (IE, MsOffice apps) that creates these servers.
And... you are talking about a new COM server (the GUI app) where the earlier mentioned servers are clients, right? Let me know if I'm way off
And... you need EventSinks in your BHOs and AddIns... Why?
Don't we have a design problem here? Who is the client/consumer and who is the server/provider?
Do you actually intend to control your clients from the GUI app server? If not; what is the purpose of the event sinks?
I don't know what you want to do with your GUI app, which means that your design may be relevant even if I find it suspicious.
Isn't the GUI app some kind of a logging application?
If so; how about using a UDP port in your GUI app (localhost) and send logging packets to that port from each server?
Each server may try to start the GUI app, but the GUI app makes sure that it is the only instance running.
Or you could write a service that write logging packets to a file readable from a GUI app.
Or some other kind of inter-process communication (WM_COPYDATA?), take your pick.
Hope you find some relevans in the above
--
Roger
-- modified at 10:34 Wednesday 5th October, 2005
|
|
|
|
|
I'm using an access database with VC6. My program has been working well until now. I get the message 'Unrecognized database format' and then the path. I presume that I have a corrupt database and I have tried to repair it but I just get the same message. Does anybody have any suggest how I can repair it, view or extract the data. I did have the same problem about a month ago, but I was able to repair it. Can anybody suggest why this is happening
==
I used CDaoDatabase to extract tables list in .mdb file
Plz Help . It is very Urgent
Praveen :C
|
|
|
|
|
parims wrote:
but I was able to repair it.
So you where able to successfully repair the db right? Did you follow up with a compact db?
Question do you have blob (i.e. “memo”, “OLE Object”) columns? Those are the biggest reason I have seen a db get corrupted. If possible change the design to eliminate those types of columns or create your own row locking mechanism so people can’t access the same row at the same time.
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
I think you problem is that you are using ACCESS 2000 or newer (that means Jet Engine 4.x). Then you need to trigger the use of DAO 3.6 instead of DAO 3.5 which is the default of the MFC DAO classes in VS6.
If you use MFC in a shared DLL, you can easily resolve this problem by putting the line:
AfxGetModuleState()->m_dwVersion = 0x0601;
into your code before you call AfxDaoInit().
Hope this helps
MS
|
|
|
|
|
Forgot all about the version issues. Good one...
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
Hi,
I am sure that i am clicking inside the checkbox of a particular tree item. But still sometimes the handle to the item is coming as null.
This is what i am doing...
::GetCursorPos(&point);
::ScreenToClient(m_tvItems.m_hWnd, &point);
hItem = m_tvItems.HitTest(point,&uFlags);
But why NULL??
What are the possibilities?
Thanks
-- modified at 1:29 Wednesday 5th October, 2005
|
|
|
|
|
Hi,
In WinDbg we can attach a process and set the breakpoint as "bp module!function",
how we set a similar breakpoint in Visual studio 6? The same format doesnt work in Edit->Breakpoints dialog box. Does anyone know about this?
Thanks!
|
|
|
|
|
Hi all,
I'm new to multithreading and I'm using the code provided by "Vijay Mathew Pandyalakal" (http://www.codeproject.com/threads/SynchronizedThreadNoMfc.asp) to create my own thread class. What I need to do is this. I have a thread class and I want it to access a structure which is defined in main area, which is used by the main program as well.
int main()
{
MyStructure *myStructure = new MyStructure;
myStructure->myValue = 2; //myValue is an integer member in MyStructure
MyThread * myThread = new MyThread(myStructure);// MyThread has an integer
// pointer
try
{
myThread->start();
// here I hope to add my code that will change myValue in
// myStructure. This should be detected by myThread via myThreadValue
// since both myValue in myStructrue and myThreadval in myThread refer to
// the same memory area (I hope ).
.
. refer
}
However this doesn't work. Is there a correct way to do this?
Can Vijay or some one else help me on this?
Thanks in advance ,
stkl
-- modified at 0:29 Wednesday 5th October, 2005
|
|
|
|
|
I didn't read the article you provided but I suppose its just describe a class to encapsulate the thread. Now concerning your problem: this is really simple, you just need to change the value and that's it . As you said, both pointers point to the same memory adress, so if you make change in your main thread, the modifications will be accessible in the other thread.
BUT, you will have to protect the data to avoid that both threads try to access it at the same time. Thus, you might look at this link[^] for CRITICAL_SECTION objects (I suppose you don't use MFC from the name of the article you gave). And look at the functions InitializeCriticalSection then EnterCriticalSection and LeaveCriticalSections to try to access your variable (EnterCriticalSection will return only when no other thread as entered the same CRITICAL_SECTION object) and finally DeleteCriticalSection to release the object.
|
|
|
|
|
Consider using a synchronized smart pointer.
See following link:
http://code.axter.com/sync_ptr.h
The above synchronized smart pointer will automatically lock and unlock access to your data.
Top ten member of C++ Expert Exchange.
http://www.experts-exchange.com/Cplusplus
|
|
|
|
|
Hi Axter,
Thanks a lot for your reply. I used a techinique that I found from http://www.relisoft.com/resource/resource.html and It works very well. The technique is to create an object that has a reference to a critical section object and that enters to critical section in the constructor and leaves in the destructor. Since destructor is automatically called at the end of the scope it makes sure that the memory is released.
Thanks and Regards,
stkl
|
|
|
|
|
Hi Cedric,
Thanks for your quick response . I think this should solve the problem. However still I couldn't try this out. I tried to access a pointer variable from two threads and it worked fine even without using critical sections. However when I tried to use a variable in a structure, it didn’t work. The structure and variable within it both are pointers. I tried to access a member variable of a class as well. Both class and the member variable are defined in the heap. This didn’t work either. I think the reason may be access problems you mentioned. Any way I'll try this out and let you know. Thanks again
stkl
|
|
|
|
|
Hi forum members, I need your help to get the handle of the "all programs" menu of the star menu, when the menu of "all programs" is selected, I am usign CBT HOOKS to get the handles that have the current focus, when the star menu is selected i get the "DV2ControlHost" window class, and I have found those windows classes with Enumchildwindows function:
Shell_TrayWnd
TrayNotifyWnd
TrayClockWClass
SysPager
ToolbarWindow32
ReBarWindow32
TF_FloatingLangBar_WndTitle
CiceroUIWndFrame
WMP9DeskBand
MSTaskSwWClass
Desktop User Pane
DesktopSFTBarHost
SysListView32
Desktop More Programs Pane
The "Desktop More Programs Pane" window class has a child that is a button and its name is "all programs", after that the "all programs" button is pressed , appears the "menu of the programs" but I cannot get the window handle of the "all programs" menu.I have used the getmenu(), getsysmenu() functions and the message WM_SYSCOMMAND message but it didn't work.so, Do you know how to get the "all programs "
Thanks in advance
|
|
|
|
|
Hi
I just want to get a process Id from a Processhandle which has been opened with PROCESS_TERMINATE access . I tried methods like enumerating the processes and NtQueryProcessInformation . All these funtions are failing if the Process has been opened with the PROCESS_TERMINATE access . But if the Process is opened with any other access I am able to get the process id by using the above mentioned methods . I request you to help me in this regard
|
|
|
|
|
Hi,
How can I post string from one application to another?.
NSS
-- modified at 23:40 Tuesday 4th October, 2005
|
|
|
|
|
sthalasayanam wrote:
How can I post string from one application to another?.
Try WM_COPYDATA message. here is an example :-
http://www.codeproject.com/threads/ipc_wmcopy.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Thanks.
Why do we have to use SendMessage() instead of PostMessage() if WM_COPYDATA event is to be posted to another windows.
|
|
|
|
|
sthalasayanam wrote:
Why do we have to use SendMessage() instead of PostMessage() if WM_COPYDATA event is to be posted to another windows.
Actually there is basic difference between PostMessage and SendMessage.. When you Post message using PostMessage... it just post the message in message queue and return immediately... but in case SendMessage i doesn't return till the target program acknowledge it properly... Now i believe you get the point why WM_COPYDATA using SendMessage instead of PostMessage
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|