Visual C++ :: How To Get Rid Of Not Responding Message
Jul 30, 2014
I have a simple dialog based app that performs some time consuming file manipulations. The activating method contains the customary
Code:
CWaitCursor wait;
The hour glass initially appears, than after a few seconds, the dialog title bar indicates 'not responding'.
This is misleading to users as it suggests the application has ceased to function when, in fact, it's working just fine. I would like very much to eliminate this 'not responding' message but havn't a clue how to do it. Have any of you dealt with this problem, if so, how?
Is it possible to edit the message map at startup instead of just having it set at compile time?
I'm reading some values from an XML file at startup. The menu options will be determined from what I find in there. But I need to assign those menu options to the message map.
You place a breakpoint at one of locations within the message loop. But I want the breakpoint to trigger when I click on the application window, for example. But I can't, it went so fast so long as I switch from VS to the application program, the breakpoint is hitted again, then the application is frozen again. I don't know how to setup a conditional breakpoint.
I'm looking for a resource (possibly CPP) for which I could do the following on a windows and linux machine:
1) type a string message into a GUI control (or some other input that can be accessed by the resource).
2) run a resource script that puts the message through a hash function (or a custom hash function) and outputs the hash string.
3) have a reverse function available in order to decrypt the message in an input fashion just like step #1.
what open-source resource might be the best for this? Right now I am imagining typing a message into a text file, saving the file to a hard drive location, running a script on it replacing the old file with a new file that just has a hash string in it, then using that hash string for the encoded message.
I'm currently making a math program in c++ windows form application. I'm trying to make it so where the user presses the number button I such as 1 button to display a 1 in my textbox.
Is there a way I can do message processing between a Win32 application and Javascript using some Windows CallBack function or using Send or Post message?
I have a problem in a c++ project. I have created a .dll file and hooked to an .exe
I want this .dll to make a ping or to send a message like hello somewhere, and IF ping or message doesn't receive an answer that's means the user has suspended-terminated this dll from the exe then the exe will close. How can i do that?
I have a DLL developed using pure VC++ (all unmanaged code that doesn't use .NET framework). This DLL will be deployed in different client PCs within a network and will act like an agent.
Now I have establish a communication between this DLL and a WCF web service, that will be deployed in a server PC. The Service will first get a list of PCs either name or IP Address within a network using LDAP (Active Directory) and once, we get the PCs, I have to establish a communication between the web service and the agents that reside in these client PCs,
1)I took an integer 2)I try to convert it into binary by storing the remainder by dividing it in 2, in an integer array size of 8(array1) 3)But the digits are in the reverse order, so I reverse them(array 2) 4)When the number is less like 40 or 20 there are no 8 digits/bits 5)So further manipulation of bits i need to pad some other value(say its 2)in the beginning of the array where you will have continuous zero bits.
I want to pad another bit apart from 1 and 0 until you find one. for example say the content of array2 will be 00010111 then i need it to be 22210111.But my method is not working and make the program non responsive.
I'm trying to write a program that passes Windows messages back and forth from another program that controls a laboratory instrument. I was able to write a program that successfully passes instructions, as evidenced by the instrument doing what I tell it. However, I am having trouble getting a return status from the instrument. The manual instructs the following:
// demo code, etc. // send message to the instrument operating software here... SendMessage(hwnd, WM_COPYDATA, tag, (LPARAM) &cd)
Either a completion message or return data is returned. Remote commands ReturnStatus, ReturnTiming, and ReturnData return data. In either case, data is received through an asynchronous windows message inside Win32 COPYDATASTRUCT type data packet.For example, a typical OnCopyData window callback is shown below, where the string data retrieved is finally stored into a Microsoft CString object. Note the use of variable replyTag, discussed above, which is used to isolate the correct windows message returned.
BOOL CUserDlg::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* cd) { …. if (cd->dwData == replyTag) { /* String pointing to status */ CString retStatus = (char*) cd->lpData; } …. }
I can't tell if my problem is in generating the replyTag, getting the HWND to my own console window, or the actual receiving part of the code.
When setting the replyTag, the manual instructs: UINT replyTag = RegisterWindowMessage(“SOFTMaxProReplyMsg”);. However, I have to put an "L" in front of the string or I get a data type error (can't convert const char* to LPCWSTR).
When setting a HWND for myself, the manual instructs: HWND MyWnd = GetSafeHwnd().
That produces an error because GetSafeHwnd is a function of the Cwnd class, and I don't have a Cwnd. I have replaced it with HWND MyWnd = GetConsoleWindow();
When listening for the reply message, the manual instructs what I quoted above. However, I again don't have a Cwnd. I therefore simply used
The above if statement always evaluates false, and the cd.lpdata contains the message that I had sent out instead of a reply message. How to get a reply using my console application. Here is the full code of my function:
Code: #include "stdafx.h" #include<iostream> #include<vector> #include<string> #include<afxwin.h> using namespace std; void SendCommand(string command) { // Get tags to identify the receiving and sending messages
I've created a new dialog in my MFC dialog based application. the new dialog contains 5 control buttons. The following happens and I don't understand why?
1. click on buttonX. (result ok, OnBnClicked message is sent) 2. click on on any place of the application, but not on the dialog.(removing focus from dialog) 3. click again on buttonX (FAILED, OnBnClicked message is NOT sent). but if instead I click on any other button in the dialog (result ok, OnBnClicked message is sent).
And when I do:
1. ... 2. ... 3. click on the dialog area just to set focus on the dialog again 4. click again on buttonX. (result ok, OnBnClicked message is sent) **I need to do step 3 only if I want to click again on the buttonX! why?? I think it related to SetFocus() but I m not sure how.
I've tried different style like, tool windows, overlapped, popup. it happens in all the cases.
Code: class CToolsDlg : public CBDialog { DECLARE_DYNAMIC(CToolsDlg) public: CToolsDlg(CWnd* pParent = NULL); // standard constructor virtual ~CToolsDlg(); CToolTipCtrl m_ToolsTips;
This is a problem I have been having with every program I write since I started using SDL 2. Whenever I compile my code and run my program, everything works perfectly fine until at some point (usually after 3-8 minutes of running), the program will stop responding completely and I will have to exit out of the console to close it. The code I believe is relevant is:
void MainLoop() { InitLoop(); while ( !QuitMain )
[Code].....
If I change SDL_PollEvent(&Event) to SDL_WaitEventTimeout(&Event,100), then the problem goes away (I did that and had the program running for about an hour without it stop responding before I decided that it solved the problem), so I believe that the problem has something to do with event handling. Also, it might be noteworthy to mention that when I use SDL_WaitEventTimeout with the second parameter being a small number (because 100 milliseconds is a long time to wait and makes the program run at like 8 FPS), the problem returns.
I want to know how to respond to a request made by a mobile application (preferably Android) through a desktop software. So for example if there is a button on the mobile app named 'do something and a user clicks it, I want the desktop software to respond to that request and 'do something
So what I was thinking was to upload a file to a server when the button on the app is clicked and add a timer to the desktop software to connect to the server and read the file and respond accordingly.
Is this how it is usually done or am I going about this the wrong way? Im developing the app in C# (Xamarin) and the desktop software in C# as well.
I have finally got around to developing C++ & MFC using Visual Studio 2012, to build a full GUI Windows application (not sure if I have made the right choice). Though admittedly in two months time I do have a dialog window at my beck and call.
Now I have discovered a flaw (suspect) partially caused by the design of this program not all following the same principles, nor written by the same people and long predates me. Let describe the situation.
I have a dialog I have created as a class which has a combo box. The list of items are populate during the OnInitDialog() function just fine, except if the file where the detail is not yet read from that combo box would not have any items other than the default. This is to be expected in the use of the program, so fine.
However, if the dialog (modeless) was already open and active, when the user went up to and selected the menu command (main window) to read that file that CPtrList data structure that held that data would not populate that Combo box on my dialog.
So what I would like when I am done reading the files contents is to detect if my dialog is opened and if so send it a message to Activate (force a call to OnActivate()). I have gone to the event list for the dialog and exposed this event handler from the resource editor just fine.
So nState is an Unsigned Int of the current state of the thread/window (not sure)?
CWnd* pWndOther is the CWnd of my other Window that wants my dialog to activate I think which is the main application since it was on the a menu that this function was called to read the file.
I am writing a program to auto login in a web site. Before making next attempt I have to wait for some time like some 10 seconds(it is configurable). But during waiting UI should not freeze. I wrote code something like this. Here event m_hEvent[1]) will be set by another thread after 10 seconds.The problem is UI still freezes some times!
while(1) { //m_hEvent[1] will be set by another thread after 10 seconds dwRet = MsgWaitForMultipleObjects(1, &m_hEvent[1], FALSE, dwMilliseconds, QS_ALLINPUT); ResetEvent(m_hEvent[1]);
I'm getting an error message that I can't seem to fix. The error clearly states that during the link aspect of the debugging and build there is an error that says that the stdio.h file is either missing, invalid or corrupt. When I try to program using any of the other headers I'm getting the same error. The files are there I can see them in the include folder, so I'm asking what can I do to fix all these headers and beware I am a beginner at programming and using any kind of compiler.
This is the error I receive. 1>------ Build started: Project: hello, Configuration: Debug Win32 ------ 1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped =========
This is the compiler I am required to use for an online course and all instruction is given for the Microsoft visual 2010 express edition. Also the only file I think that's being referenced is the #include <stdio.h>.
I'm trying to parallelize bottom's up merge sort algorithm. Firstly, i must have working procedural code.
I rember I had my code working last week but I made some changes ( probably to arguments passed to sort function ), i run my program several times without rebuilding it so i though it's still working.
Now i came back to my code and my program terminates without any message which confuses me. I debbuged merge function and it seems to work well, at the end i have sorted array.
#include <iostream> #include <stdlib.h> //used for random numbers #include <time.h> #include <string> using namespace std; int main() { int bridgeWidth ; //set bridge width to any number