Thank you very much for taking time read my question. Regards, Mahesh Mahesh
Amarelia
Posts
-
How to get notificaion when laptop switches from power to battery? -
How to get notificaion when laptop switches from power to battery?Hi I have wrote one dialog based MFC application which i run on Windows 2000 Professional. In this application i capture different windows messges. I want to do certaing things when the power cable is removed from laptop and it automatically switches to battery status. And again I want to get notification when power becomes available. For this I use WM_POWERBROADCAST message. I have written one function as LRESULT OnMessagePowerBroadcast(WPARAM wParam, LPARAM lParam); Declared in my header file. And applied as LRESULT MyClass::OnMessagePowerBroadcast(WPARAM wParam, LPARAM lParam) { MessageBox("WM_POWERBROADCAST"); return 0; } BEGIN_MESSAGE_MAP(MyClass, CDialog) ON_MESSAGE(WM_POWERBROADCAST, OnMessagePowerBroadcast) END_MESSAGE_MAP() Here I get notification whenever my laptop switches from power to battery. But the problem is : It shows me message box even when power get in. for this I use wParam and compare it with the given values, and I get PBT_APMPOWERSTATUSCHANGE all the time. How to distinguish that Power is in or power is out? Right now it gives me same message as ( "WM_POWERBROADCAST")even when power is in and when it's out. Any idea how to distinguish it? Regards, Mahesh
-
Hide my application from Task ManagerHello friends I have developed a dialog based MFC application in which I did not show any dialog. My application show an icon in system tray only. Also my application runs on Windows 2000 Professional. But when I open Task Manager it shows my application in process list as "myapp.exe" I want to hide that from Task Manager. Also I don't want to use any extra DLL file to do it. How to do that? Thankx in advance Mahesh
-
Not able to use Skype API using Windows Service?Hi I have one Windows Service made in Visual C++, which runs on Windows 2000 Professional. My this service runs one more MFC exe when I start my service. My Dialogbased MFC application uses the Skype API and sends and receives the messages using give functions. It's working completely fine when I run my MFC application directly. But when I try to run my application using windows service that I have developed, it doesn't receive or send any message. Still my other functions (i.e functions other than Skype) works fine. So what seems to be the problem? Any idea how to overcome this? Thankx and regards in advance Mahesh
-
GetWindowTextA() function not working in Visual Studio 2005?Hi I am using Visual Studio 2005. I have developed my project in VC++ which is a dialog based MFC application. Here on the Button Click event of one dialog i need to get the value inserted in one edit box. for that I have declared variable also and i use GetWindowTextA() functions for that and it throw assertions. Showsing NULL value in hWnd... I don't know why this happens........any idea? The same code works fine in Visual Studio 6.0 My Code looks like this : ========================= void CPswdWnd::OnBnClickedButton1() { // TODO: Add your control notification handler code here char sCurPswd[512]=""; m_Pswd.GetWindowTextA(sCurPswd,strlen(sCurPswd)); //Here it give assertion } My Variables are declared by righ clicking the Editbox and then "Add Variables" and then i have made the variable as "Control". Any idea? Thankx in advance Mahesh
-
How to implement multi-threading in C++Hi, I need to implement the multi-threading using C++(Not VC++). What are the options available fot it. Thanks in advance. Regards Mahesh
-
Which event occurs when user presses Ctrl+Alt+Del and then "Lock Computer"?Hi Gavin Thaknx a lot for u'r kind support. But this works in Windows Server 2003 and Windows VISTA only. I need solution for Windows 2000 Professional. Is there any such another functions or something like that? Mahesh
-
Which event occurs when user presses Ctrl+Alt+Del and then "Lock Computer"?Hi David... Thankx a lot for giving some time to my problem Isn't there any such message which we receive when it locks computer by pressing "Lock Computer" button. Like we receive "WM_QUERYENDSESSION" when it goes logoff event or shutdown event. Mahesh
-
Which event occurs when user presses Ctrl+Alt+Del and then "Lock Computer"?Hi I have a dialog based MFC application in which I want to handle an event which occurs when user presses Ctrl+Alt+Del and from Windows Security dialog it select "Lock Computer" button and it locks the computer. I want to know which event occurs and how to trap this event? Any help would be strongly appreciated. Mahesh
-
How to know programmatically if network cable is connected or not?Hi Thankx thankx thankx thankx........I can't describe it in words... Any way have a nice time Mahesh
-
How to know programmatically if network cable is connected or not?Hi Thankx a lot to you too...... U'r quote also helped me a lot. Mahesh
-
How to know programmatically if network cable is connected or not?Hi David Thankx a lot for spending time to look at my questions. With tons of thankx and regards, Mahesh
-
How to know programmatically if network cable is connected or not?Hello Friends I am back again with a question. I have a dialog based MFC application in which I want to know whether my network cable is connected to my network card or not? Which function is best for this and how to use it? Or any other idea to do this? Regards, Mahesh
-
How to show a dialog in other desktop?Hi... I have tried that but it return's false value. Whats seems to be the reason? Mahesh
-
Problem in showing the dialog form in different desktop created using CreateDesktop()?Hi Rage First of all my heart felt thankx that you give some time to look into my question. No CMyDlg is not my main dialog. It's another dialog whose any instance is yet not created. You can say it's another child dialog. Even if it's possible to show another instance of the same dialog in other desktop then also I will be little bit happy. Yes my all SomethingDesktop functions execute perfectly and give TRUE value. Anything else you want to know...I'll be glad to answer u'r questions... Hope to see some positive answers Mahesh
-
Problem in showing the dialog form in different desktop created using CreateDesktop()?Hi Friends Yesterday also I have posted the same question but I didn't get any reply. :( I have my dialog based application which shows one form and it contains one button. When I press the button I create new desktop and then use switch to the new desktop. Now I want to show one more dialog form in this newly created desktop. But I am unable to do it. is there a way to do same? Or is there a way to give parent window or attaching it to other desktop? I am pating my little code here so that you can have exact idea what I am doing. //My CPP file HDESK hOriginalThread; HDESK hOriginalInput; HDESK hNewDesktop; // Save original ... hOriginalThread = GetThreadDesktop(GetCurrentThreadId()); hOriginalInput = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP); // Create a new Desktop and switch to it hNewDesktop = CreateDesktop("MYDesktop", NULL, NULL, 0, GENERIC_ALL, NULL); SetThreadDesktop(hNewDesktop); SwitchDesktop(hNewDesktop); // Here I want to show my new dialog form CMyDlg objDlg; objDlg.DoModal(); or objDlg.ShowWindow(SW_SHOW); // Restore original ... SwitchDesktop(hOriginalInput); SetThreadDesktop(hOriginalThread); // Close the Desktop CloseDesktop(hNewDesktop); return 0; Any idea how to achieve... Regards Mahesh
-
How to show a dialog in other desktop?Dear Friends I have created a dialog based MFC application. Here I have one form say "MyForm", showing on my current desktop when I run my application. I have two button on this form called "NewDesktop" and "OldDesktop". Now when I press "NewDesktop" I use CreateDesktop() functions and then SwitchDesktop() so It creates new desktop and shows the new desktop. But now it hides my previous application and my form. Now I want to show my form(MyForm) in this new desktop. I don't know how to do that? Any help please? With many many thankx and regards in advance Mahesh
-
How to know programatically that Windows has logged in/Logged Off/Shut Down occured etc?Hello Friends In my dialoged based MFC programm I need to handle and set certain registry values before windows gets shut down and also immediately after Windows loggs in(i.e immediately after user presses Ctrl+Alt+Del and enterys passwords). I read that it sends some message WM_QUERYENDSESSION or something like that but don't know how to trap that message or how to achieve this? Any such example or any idea please. Thankx and regards in advance. Mahesh
-
How to read .Doc, pdf, .xls etc file?Hi, Thanks for the reply, I do it the following way... CStdioFile fileToRead; char * StringBlock = new char[64000]; fileToRead.Open(sCurrPath, CFile::modeRead | CFile::typeBinary, &feError); nBytesRead = fileToRead.Read((unsigned short *)StringBlock, 60000); The value of nBytesRead = 60000 after the last statement executes, but the StringBlock contains only few junk characters only. May be it encounters NULL or something like that which truncates it to only few chars. According to this the function reads the file correctly but the problem is in storing the data. I want to read maximum data possible at one go for the sake of my app's speed . Please give appropriate solution. Best regards and Thanks, Mahesh
-
How to Create CSV file from MS Office files and vis-a-versa?Hi, How to convert a .doc,.xls,.pdf etc..file to a CSV file format and then covert it back to .doc,.xls,.pdf file format. Is there any utility/program available that can be directly integrated into my application for this job? Or Is there any support provided in MFC for the same? Any Code snippet or function...please help. your time and help is much appreciated. Thanks & Best Regards, Mahesh