|
You could trap the Ctrl-g as shown, set a flag.
Trap Ctrl-d, and if the flag is set, do your thing.
If any other key is pressed, reset the flag.
Facts do not cease to exist just because they are ignored
Aldous Huxley (1894 - 1963)
|
|
|
|
|
this was my origional idea, but i don't understand how i can trap both the ctrl and the g at the same time. in OnChar, the variable nChar is only one value, correct? unless i'm mistake, how can i look for 2 keys at the same time?
*.*
cin >> knowledge;
|
|
|
|
|
keegan wrote:
how can i look for 2 keys at the same time?
You can't, unless they are keys like Ctrl, Shift, and Alt, which can be pressed simultaneously.
In your character-detection code:
if (Ctrl+g was pressed)
set flag = T
else
{
if (d was pressed)
{
if (flag equals T)
}
else
set flag = F
} Make sense?
|
|
|
|
|
Hi all can any one provide me with a code that recognizes clicks and double clicks in Journal record Hooks
take care
regards
Basim
|
|
|
|
|
I am having touble developing a MFC project to switch images on tool bar buttons. First I can not get the following code to display predefined bitmap images in the toolbar.
The desired result of this code is, of course, to produce the desired images on the tool bar and then have the images switch as the tool bar button is toggled... the toggling code will be implimented in an OnUpdateUI handler which is another part of this project.
The updating code will look something like this...
void CMainFrame::OnUpdateSwitch_134(CCmdUI* pCmdUI)
{
m_bSwitch134 = !m_bSwitch134;
if( m_bSwitch134)
SwitchToolBar.OnChangeButton( IDB_ON, 1, RGB(0,0,0));
else
SwitchToolBar.OnChangeButton( IDB_OFF, 1, RGB(0,0,0));
}
This code compiles fine but the tool bar is blank...
Would appreciate any comments or help.
Thanks...
Ozzy
CToolBarCtrl SwitchToolBar;
CImageList* m_ptrImageList;
CImageList SwitchImageList;
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
TBBUTTON tb;
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// create CToolBarCtrl toolbar
SwitchToolBar.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|TBSTYLE_FLAT,
CRect(0,0,0,0), this, IDR_TOOLBAR1);
// create ImageList from IDB_SWITCH_IMAGES
SwitchImageList.Create( IDB_SWITCH_IMAGES, 20, 1, RGB(192,0,192));
// get image list pointer
m_ptrImageList = SwitchToolBar.GetImageList();
// set image list for SwitchToolBar
SwitchToolBar.SetImageList( m_ptrImageList );
// assign elements in TBBUTTON structure
tb.iBitmap = 0;
tb.iString = NULL;
tb.fsState = TBSTATE_ENABLED;
tb.fsStyle = TBSTYLE_BUTTON;
tb.idCommand = 0;
// add buttons to list
SwitchToolBar.AddButtons(1, &tb );
return 0;
}
|
|
|
|
|
After insert the JpegLib project into my own project, when compiling it there is one error:
\jpeglib\jmorecfg.h(238) : error C2371: 'boolean' : redefinition; different basic types
\vc98\include\rpcndr.h(173) : see declaration of 'boolean'
in jmorecfg.h, it is defined as bellow:
#ifndef HAVE_BOOLEAN
typedef int boolean;
#endif
while in VC rpcndr.h there is another define:
typedef unsigned char boolean;
if I delete two include file, this problem doesn't appear:
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h>// MFC support for Internet Explorer 4 CommonControls
but these two include files is useful for me ,so I can't delete them
if I don't delete these two include files and add
#define HAVE_BOOLEAN
before
#include "jpglib.h"
the redefinition error doesn't appear also, but the Jpeg image can't display correctly, so I need help。
swandream
|
|
|
|
|
I remember having this problem with the INT32 defintion. I just deleted the entire redefinition in the jpeg library source code and it worked fine.
|
|
|
|
|
thanks, I have solved this problem, I always put the MFC include files in "stdafx.h" now I put them into other files which needing them, then the problem is solved, thanks for your reply.
swandream
|
|
|
|
|
Ok here is the image so you can see the problems related to the questions:
Image
1- I use this to draw the Check in the menu
DrawFrameControl(lpdis->hDC,&rcCheck,DFC_MENU,DFCS_MENUCHECK | DFCS_TRANSPARENT);
But as you can see I can't have the background color the same as the side bar.
2 - The Submenu Arrow is always drawn, is there a way to prevent windows from drawing it and I would use the same function as the check mark for that too.
3 - The menu Window has a sort of border which match's windows colors, Is there a way that I could paint this border another color to make the menu look like a flat one.
Using Win32 API, no MFC ATL or WTL.
Using Visual Studio .NET 2003, Windows XP SP1
If you need more code or other stuff to help, just say so.
Thank You for any replies
David
|
|
|
|
|
Hi all..
I'm having quite an annoying problem. Every time I use DeleteAllItems() on a tree view in my application, all items I try to add to that tree view afterwards don't show up!
I've made a little MFC example displaying the problem:
http://www.blacksmith-studios.dk/tree_testing.rar
Please read the Readme.txt file before checking out the actual program
I really hope you guys have some qualified answers, since I cannot understand why this ain't working properly!
Huge thanks in advance!
Søren Dreijer
|
|
|
|
|
Dear All:
I am a jackeroo with the visual c++ programming. And i come from china. I have worked for one year. I am work hard, and i long for improving my ability of visual c++ programming. But I don't know how to do it, may sometimes i will have some problems . I long for friends who have more wisdom with visual c++ programming . I wish to make some friends in here.
May we make a friends? I wish....
My ICQ is 227328184 or MSN: michaelwan007@hotmail.com;P
|
|
|
|
|
Let's get great improvements, hand in hand.
Tomorrow will be better and better!
|
|
|
|
|
Thanks,my friends. I am glad to meet you.
|
|
|
|
|
Hi Welcome ...
(I'm sorry, I had to look it up )
jackeroo : a young male management trainee on a sheep or cattle station
http://www.wordreference.com/english/definition.asp?en=jackeroo
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
Hi Sir:
I am glad to meet you. Can you tell me your ICQ or MSN number? May be we will have a talk if we have free time. Thanks
|
|
|
|
|
Grr, yet another simple problem has me floundering at the CP god's feet. I have some radio buttons, and a combobox. If the radio buttons are not checked, the combobox is greyed out. I'm using the line
GetDlgItem( IDC_CAL_TRANSDUCER )->EnableWindow(m_bitControls[bool_cal_xducer]);
to do this. My problem lies with re-enabling it. I have my OnBnClicked() thingamajobber, but i have no idea what to put in there to re-enable it. I've tried a ton of different functions, but they either completely hide the combobox or just don't do anything.
any help?
*.*
cin >> knowledge;
|
|
|
|
|
Doesn't EnableWindow(true) work?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
argh, i new it was something simple! thanks.
*.*
cin >> knowledge;
|
|
|
|
|
You're welcome!
modified 12-Sep-18 21:01pm.
|
|
|
|
|
keegan wrote:
I'm using the line
GetDlgItem( IDC_... )->EnableWindow(...)
Instead of GetDlgItem, use a control-variable. Classwizard can make that for you if you tell it to make your variable of type CComboBox (or whatever your control is).
As for enabling:
m_ComboBoxCtrl.EnableWindow(true);
does not work?
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
yeah i'm using a control variable, i just wrote it like that so it would be a little more clear what i was trying to do
*.*
cin >> knowledge;
|
|
|
|
|
or use ON_UPDATE_COMMAND_UI to get the CCmdUI* pCmdUI.
You could call
pCmdUI->Enable(true) to enable it.
This is applicable to all UI component which response to CCmdUI
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I would like to have a "MDI" application that displays a bunch of reports in separate windows within a main frame. I would like to define each report using a dialog resource. This is what I have tried:
1. Create a dialog resource for each report and use classwizard to generate a class for each. The dialogs have the WS_CHILD style.
2. Create a menu resource which will allow selection of each report.
3. Have cwinnapp::initinstance create a CFrameWnd and add the menu to it.
4. When the user selects one of the reports from the menu then display the associated report dialog modelessly with the main cframewnd as the parent.
This sort of works. The problem is that the modeless dialog never gets the focus (even when I click on it). Is there a way to fix this or is there a better way to do this?
|
|
|
|
|
What are you using to create the dialog? are you using
m_your_dialog.Create();
m_your_dialog.ShowWindow(SW_SHOW);
This is how i create my modaless diags, and it brings them into focus automatically.
*.*
cin >> knowledge;
|
|
|
|
|
I have tried that, no luck.
My current code is:
if(rpt_cpu_category == NULL) {
rpt_cpu_category = new dlg_rpt_cpu_category;
rpt_cpu_category->Create("RPT_CPU_CATEGORY",this);
}
rpt_cpu_category->BringWindowToTop();
rpt_cpu_category->SetActiveWindow();
rpt_cpu_category->UpdateWindow();
"RPT_CPU_CATEGORY" is the name of the dialog resource.
The last 3 lines are redundant as they seem to have no effect, they were just my latest effort to try and get the dlg to take the focus. I have also tried using setfocus() (no luck).
BT
|
|
|
|