Visual C++ :: Identify Which Of Two Subclassed Controls The Mouse Is Over?
Feb 11, 2013
I have a dialog app with two separate static controls. Both controls have been subclassed from CStatic derived class to implement drag and drop and double clicking. The class works just fine, but I cannot figure out which of the controls is being double clicked or dragged and dropped onto because I only have the code below operating. I need some method in the derived class to determine which control is being manipulated.
Code:
// header file
#pragma once
#ifndef __AFXWIN_H__
[Code]....
View 3 Replies
ADVERTISEMENT
May 27, 2013
I'm turning mad with a little problem with Visual Studio 2008 and MFC. I'm working on a project actually and I'm trying to create an SDI Application. Right, now I want to add a dockable DialogBar. Well, the first time I added it with the resource view, I can create the bar without problems. But... I want to add some controls like a couple of ListBox, buttons and so on. The program doesn't allows me to create member variables for these controls. The option appears in grey.
Searching a little, I found that it's mandatory to create a new class derived from CDialogBar and "enhance" it with the Message handler and so on. I've been reading some tutorials and it didn't work for me.
View 14 Replies
View Related
Jan 31, 2013
there is a way to iterate through the controls on a webpage. For instance, I tried EnumChildWindows using the parent window of the browser, but I haven't had any luck - it returns nothing. s where I can start researching how to find the child controls?
I'm using Visual Studio 2010, programming in C++.
View 6 Replies
View Related
Apr 8, 2013
If it is possible, I'd like to know how to intercept messages sent to controls on a dialog. I'm working on a large application with a large number of dialogs, each with a number of controls on the dialog. I need to be able to intercept messages sent to these controls so that I can determine if the controls really need to take action on these messages. I could subclass each control and override the specific event handlers but due to the volume of controls in the application this could take a very long time, will introduce risk if controls are missed, and will increase maintenance costs. What I want to do is create a class which is derived from CDialog and each of the dialogs in the application would then be derived from this new dialog class. The new dialog class would intercept messages sent to any control on the dialog and if the dialog decides that the control should do something then the dialog will pass the message on to the control.
example:
CExistingDialog is derived from CNewDialog is derived from CDialog
CExistingDialog has a number of controls. When the code in CExistingDialog calls CWnd::EnableWindow on one of these controls I want CNewDialog to intercept the message, determine what should be done with the message, and then pass it on to the control.
I'm not very familiar with the messaging framework. I've tried overriding a few of the methods of CNewDialog but none of them ever receive the message to enable the window. I assume this is because the message is sent directly to the child window (the control).
Is there any way to intercept these messages? I don't know much about hooks either but is this a possible option?
View 8 Replies
View Related
Sep 11, 2013
I have a SDI application that uses a CFormView class to create a window and this window has 2 buttons and 2 edit boxes.
I can resize this window, like minimize and maximize, but the controls all stay at the same place.
I know that it's possible to move the controls based on window size.
But what i want to do is, as the window is expanded the controls and it's text content to grow proportionally and same when the window is shrinked.
Is that possible to do? i.e., increase/decrease size of controls and texts per window size.
View 2 Replies
View Related
Dec 5, 2012
I have migrated my MFC application from Visual Studio 6 to VS2010. But the UI controls still looks the same as of old theme. How can i add the manifest file now to get the UI controls to be displayed as of the current OS theme. i.e. Win7 look if the application is run on windows 7.
View 1 Replies
View Related
Jun 6, 2013
I have created an exam environment for our schools, it comprises of 3 files; a .kix file that says if they are in the examination group run a .vbs file. The .vbs file kills the explorer.exe task so they don't have any taskbar or desktop shortcuts and then opens a .hta file.
The .hta file is a user interface that has icons for apps like Win Word that executes the application when you click on it. There is also a log off button.
Looking for some code that stops the students from being able to close, minimise and resize the window. Looking for code that can lock this down so they literally can't do anything except click the icons inside the window.
View 3 Replies
View Related
Dec 19, 2012
I need make a CBitmap or a streamdata from a System.Windows.Controls::Image(rendered out put)in a SDI mfc application (supporting clr). Here is my codes:
Code:
using namespace System;
using namespace System::IO;
using namespace System::Collections::Generic;
using namespace System::Windows;
using namespace System::Windows::Controls;
[Code] .....
By this codes i can read datastream from bitmapSource but in this way somthing goes wrong in most of GIF animations. After debug i found out i need 3 more things too decode a gif animation - (x,y) position and size of each frame and disposal method for each one - finally i just found a way to draw tru images on a form window by this codes:
Code:
System::Windows::Window^ mainWindow;
mainWindow = gcnew System::Windows::Window();
mainWindow->Title = "GIF Imaging Sample";
//ScrollViewer^ mySV = gcnew ScrollViewer();
array<System::Byte>^ pixels = gcnew array<System::Byte>(bitmapSource->PixelHeight * Stride);
[Code] ...
When i change
Code: bitmapSource = decoder->Frames[0];
to
Code: bitmapSource = decoder->Frames[01];
frame[1] has drawn perfectly on window(i think some how Image class takes care about - (x,y) position and size of each frame and disposal method for each one ),so im wonder if how can i make a CBitmap or a data stream from System.Windows.Controls::Image class to use in mfc app.
View 2 Replies
View Related
Feb 3, 2014
I have to rearrange my controls in a controlbar based on the new size resulting from dock/undocking of the bars or resizing of the mainframe.
Is there a message I can use? How to determine the new height when docked?
I tried to use its OnSize-function. The problem with it is to get the new height. When the function is called, the height I get from GetWindowRect is the old height.
Is there a better function than OnSize() ?
View 3 Replies
View Related
Apr 6, 2015
I've created a dialog based MFC app which input from user to create that many dynamic controls(Used checkbox to be created dynamically).
After user input that many checkboxes controls are created but if try to click again then not able to delete previous controls and again new no. of controls.
Code snippet to add controls on user input.
RECT rctA;
rctA.top = 51;
rctA.bottom = 80;
CString temp;
m_Edit.GetWindowText(temp);
int noOfControls = _tstoi(temp);
[Code] ....
View 1 Replies
View Related
Jan 5, 2013
I used onctlcolor() method to set the background color for the controls & Dialog. I run my application, working good but after 15 mins the below error occured,
Application Error:
The Required Resource Was --------> Shown message box
Program Error:
First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x001274f8.
First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x001259d0.
First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x00123ea8.
First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x00122380.
First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x00120858.
Warning: Uncaught exception in WindowProc (returning 0).
what is the reason for that? How can i prevent my project from this problem.
View 12 Replies
View Related
Sep 16, 2014
I can't get tooltips to show up for the windows I want in my CFormView derived class. I have copied the code from the MSDN entry on EnableToolTips(). But only two windows respond with a tooltip:
CONTROL "Tree1",IDC_TESTPLANS,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_EDITLABELS | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,1,36,85,91
CONTROL "Tab1",IDC_TABCMD,"SysTabControl32",0x0,101,0,239,181
Other windows do not respond. For these windows my function designed to catch the TTN_NEEDTEXTW and TTN_NEEDTEXTA messages is not called. Windows such as
LISTBOX IDC_TESTPLANNAMES,0,119,48,40,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "",IDC_BTN_COPY,105,177,24,24,BS_ICON
Why wouldn't the messages be sent for those windows? I'm using the code
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, &CCntlrView::OnTtnNeedText)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, &CCntlrView::OnTtnNeedText)
(CCntrlView is the name of my class derived from CFormView.) And as I pointed out, I'm using the code straight from the example given in MSDN for CWnd::EnableToolTips(), with the only difference being that all my controls are created in the rc file as shown above.
View 12 Replies
View Related
Jul 10, 2013
I forget how to know when mouse is over controls in dialog.. I want to show a message in status bar when mouse over each control...
View 1 Replies
View Related
Jan 14, 2015
When I click the mouse, the program doesn't seem to record the coordinates. So the if statements are never executed. One thing I noticed was that when the do while loop is running and the left mouse button is not pressed then X and Y of dwMousePosition are both 0. But then if I press the left mouse button then the coordinates become x = 1 and y = 0.
I am on Windows 7, 64 bit, using Visual Studio Express 2013 for Windows Desktop
Code:
#include <iostream>
#include <windows.h>
#include <string>
#include <new>
#include <stdio.h>
using namespace std;
INPUT_RECORD ir[128];
[Code] ....
View 1 Replies
View Related
Feb 11, 2014
I have the following problem:
My mainframe-window in a MDI-app has a CDialogbar.
Every time the mouse moves over a control in this dialogbar the status bar is updated by a text.
The app craps the text from the resource strings that has the same ID than the dialogbar-control, randomly.
I do not want this. How can I avoid this?
View 14 Replies
View Related
Apr 22, 2013
I am currently starting to attempt to make a program that can move my cursor to certain colors on my monitor. The problem is this seems like it will be 10x harder than I first thought.
View 4 Replies
View Related
Oct 18, 2014
For a ribbon bar with edit controls (CMFCRibbonEdit) I want to handle the mouse scroll events for the edit controls. That is, when the user clicks and then scrolls on the edit it will navigate a predefined list of strings. I want to capture the scroll event in order to update the edit text step by step.
This kind of behavior is implemented by the Spin Edit; I don't want to use the spin edit control since it only uses a list of integers and the spin buttons are too small.
Is there a way to catch the mouse scroll event for the CMFCRibbonEdit control? How to approach message handling for the ribbon (other messages than the COMMAND allowed by the ribbon designer). I'm using VS2010 on Windows 7 and the ribbon was designed with the ribbon designer?
View 4 Replies
View Related
Jun 17, 2013
I have a main CWnd class called CMainWnd which is created like this:
Code:
DWORD dwStyle = WS_VISIBLE | WS_BORDER | WS_CLIPCHILDREN ;
...
CWnd::Create(AfxRegisterWndClass(CS_DBLCLKS), L"", dwStyle, rect, parent, NULL, NULL);
And I draw smaller windows on this main window with a CWnd-dervied class called CClientWnd, which is created like this:
Code:
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER;
...
CWnd::Create(AfxRegisterWndClass(CS_DBLCLKS), L"", dwStyle, rect, parent, NULL, NULL);
In the main window I draw lots of background stuff using a memoryDC and BitBlt(). In the child window, I actually am not drawing anything, I just created it to have events like mouse over, etc. In the child window when the mouse is over the window I bring up a pop-up window. This works unless my mouse is over any parts where something is drawn in the main window, then the popup just flickers constantly. Why is the main window affecting my mouse over events if I am not handling any such events for it?
View 1 Replies
View Related
Jun 11, 2013
I have a dialog control where I am using a slider control. I have handled the notification messages sent by the slider control. When user clicks on the slider, the slider moves in steps. I want to bring the slider directly to the position where user has clicked the mouse. The slider thumb should directly move to the clicked position instead of in steps.
View 2 Replies
View Related
Aug 10, 2013
I am writing a program to map keyboard and mouse to an xbox 360 controller with win32 and xinput. I have everything going fine but when im trying to control the mouse with the thumbsticks I get problems with the movement if my program has the focus it moves fine but when I put another window in focus the movement is over sensitive here is the code I am using
Code:
if(_controllerState.Gamepad.sThumbRX >= XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE) {
GetCursorPos(&mousepos);
profile->Buttons[6]->input.type = INPUT_MOUSE;
[Code] .....
I have tried everything to fix it.
View 1 Replies
View Related
Apr 23, 2015
In a SDI app, I constraint the mouse to move only an horizontal direction, if "Shift" key is pressed ... here is the code:
Code:
void CTestMouseView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) {
// TODO: Add your message handler code here and/or call default
if(GetKeyState(VK_SHIFT) < 0) {
CRect rect;
GetWindowRect(&rect);
GetCursorPos(&m_point);
[Code] ....
Nothing complicated, and it works well ... except one thing: when I press the shift key and the mouse is moving by SetCursorPos, is moving pretty slow ... why ? I can not figure out why ! For testing, I attached the test project ...
View 13 Replies
View Related
Apr 28, 2013
I have this homework where i am implementing a code which does error checking
so basically i have 3 variables and i assigned them as integer. so my error check is asking that if i type a value for instance 1.2 it should output "X"...
View 19 Replies
View Related
Apr 10, 2013
#include<stdio.h>
#define TRUE 1
int formOddInt(int n);
[Code]....
View 5 Replies
View Related
Oct 15, 2014
I wanna write a class for polynomials, but there are some bugs in my code. I want to identify a polynomial with two arrays of the same length, one that contains the exponents of the nonzero monomials, and the other that contains the coefficients itself.
for example: (shematically)
3x^2 +5x^100 shoud be identified by array1=(2,100) and array2=(3,5)
the size of that polynomial should be Dim=2.
it should be possible to change the size dynamically.
Code:
#ifndef poly
#define poly
#include<cassert>
class poly {
[Code] ....
PROBLEM1 the destructor isnt working:
virtual ~poly() {delete [] start;delete [] koef;} //destruktor
Error: This declaration has no Storage class or typ specifier.
Error: Expected an identifier.
PROBLEM2 the constructor isnt working:
poly::poly(int x=0)
Error: Expected an identifier
Error: Expected a )
Error: Expected a ;.
I dont know what the computer want to tell me??
View 6 Replies
View Related
Apr 16, 2013
I want to implement some "debugger like" tool (very limited one, just identify at running time the current stack trace, and print messages from the user) on some code that the user wrote. what I get from the user is a function name (in the beginning of it's declaration), and when the user want to print some message he uses some print macro I should implement.
My target is printing the stack call, and all the messages that the user wrote, in the right place on the running place.
By what c++ feature can know on running time that a specific function code has ended??
Its easy to push a function to some vector when it called (since I get its name from the user), but when it ends and return to the function called it...
View 14 Replies
View Related
Jan 21, 2013
We know that function pointer for virtual function are stored in a vtable.When we have multiple function pointer entry in vtable and we call one of the virtual function then how the corresponding or correct function pointer is retrived from Vtable? Who do this stuff? In assembly code i can not see any code or logic to detrmine the correct function pointer.
View 4 Replies
View Related