|
In order to accept "enter" key in Single Line Edit Box of
of My Dialog I am using
UINT CQSmartEditCtrl::OnGetDlgCode()
{
UINT code = CEdit::OnGetDlgCode();
code |= DLGC_WANTMESSAGE;
return code;
}// OnGetDlgCode
and then I process return Key Like this...
void CQSmartEditCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
if(nChar == ReturnKey ) // Return Key
{
((CQKernelMainDlg*)GetParent())->OnQGoto();
}
CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
}
everything works fine but DLGC_WANTMESSAGE is making edit box to get
tab and Esc keys also. Which makes dialog not to exit on escape or change
focus on Tab.
How to Handle this situation?
Bad judgement gives Good experience;
Good judgement comes with Bad experience
|
|
|
|
|
How do you display text on the screen that isn't on a form. An good example
of what I'm looking for is the volume control feature on some keyboards.
When you change the volume, a volume indicator is display on the screen.
Does everyone have any suggestions.
|
|
|
|
|
CWindowDC dc(NULL);
dc.SetBkMode(OPAQUE);
dc.SetTextColor(COLORREF())
dc.SetBkColor(COLORREF());
dc.TextOut(x,y,string);
I don't know how refresh the screen again though.....
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hi all,
I am an experienced programmer in C, VB, PB and done lot of wotk in Oracle etc... I know C++ concepts and synax tough i didn't do much programming in C++.
I started doing VC++ nad was confused using MFC, after some time I came to a conclusion that before doing MFC , I really need to undersand and program Windows using WIN32 API. Am I correct? Is there any books/ material which can teach both. ie starting from WinAPI and taking that o MFC??
|
|
|
|
|
I think you're wrong. I learned MFC first and found it to be a safety blanket, which insulated me from all the things I had to learn when I started to do some Win32 programs. I must admit, I nearly gave up when I first tried to understand the whole Doc/View/where does everything go part of it all, you may prefer to write some dialog based stuff first, and even then it's a little bit of a paradigm shift. I found 'MFC programming with Visual C++ Unleashed' to be a good book, I admit I haven't seen the Microsoft title ( although I own Petzhold, THE Win32 book ). Of course, the fact we are talking means you've already found the *best* resource, a place where you can download existing projects to experiment with and people you can ask if you get stuck.
LEarning Win32 first would be like learning C, then C++. I think it's a bad idea for the same reasons Stroustrup says it's a bad idea to learn C first. It's more complex, and there are more opportunites to shoot yourself in the foot.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I have to agree with Christian. Although knowledge of WIN32 has proved helpful when programming some MFC implementations, the MFC library is basically a large wrapper class for the WIN32 Architecture and makes almost everything much easier.
|
|
|
|
|
well i agree with them both win32 is very tough and impossible to comprehend sometimes .besides u said u r a C programmer i recommend u this "very beginners" book.. sams teach yourself VC++ in 21 days u'll get started right away from the first chapter and also its is soooo easy to understand the language also the other thing that could help is the most famous MSDN i admit that with that library i learned 80% of what i could do with VC++ also it has that thousands or millions of topics that u could read and learn but as a start choose the most easy thing coz u know one of my friends read petzoldas a begining in win32 programming he is now a great VB programmer with no VC experience
have fun.........
|
|
|
|
|
Whew. I read that as it is written and I am out of breath. Am I the only one who finds posts with 'words' like 'u', 'r', and 'h8' draining to read ? Oh, and lets not forget making our vowels a310u....
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I'm with you Christian. I decided not to reply to posts containing multiple exclamation marks, 'u', 'r' and the like. The people who use these features must be ^g^g^g^g^g^g ^g^g^g^g^g^g
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thank you all for your suggessions. Its very valuable, I will again take a shot at going MFC directly. By the way, I am planning to purchase "Programming Windows with MFC (MS Press)", if any one has idea about how is the book?
|
|
|
|
|
When I try to Import data from text file, using DTS Wizard, there appears a protection error message. What that means. Is there something that I have to do before all. I'm using Desktop Edition (MsSQL Server7) under Win98. Any help will be usefull!!!
|
|
|
|
|
How is the text of the messaage?
Carlos Antollini.
|
|
|
|
|
It's something like "mms ... error". It appears after one of the last dialogs in the DTS Wizard, when I choose the "Run Immediatly" checkbox, click 'Next", and o-o-ps!! I'm afraid that I have missed to install something, because when I try to work with another database with ADO and Visual C, nothing happends. I can'd add nothing.
Something else: I made an installation under Windows2000 and everything is fine. But I still need to use Win98. Any sugestions!
|
|
|
|
|
Hi,
I like to know how can i rotate counterClockwise using VC++ codes.
is there any specific function that could get the rotation degree and do the job???
Thanks
Ehsan Behboudi
|
|
|
|
|
What are you hoping to rotate ? GDI+ will let you rotate a graphics object ( equivelant to a CDC ), or a shape before drawing it.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
okay,
here's the deal,
I have a point(CPoint), and i can draw a line witha specifies length to the left of the line.
So, I like to be able to rotate Counterclockwise, and draw another line every n(user defined)
degrees.
is that possible?
Thanks
Ehsan Behboudi
|
|
|
|
|
You could *possibly* put a circle into a path, flatten it and iterate the points, but I'd just use trig myself. X = sin theta, Y = cos theta, from memory.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
As opposed to thinking of it as a circle, think of it one quadrant at a time. This requires that you have a fixed diameter (easiest to base on logical pixels). Then you can easily write a function to get the point for a given degree.
void GetPoint(CDC* pDC, LPRECT lpBoundingRect, int nDegree, CPoint& pt)
{
CRect bounds = lpBoundingRect;
int xRadius = pDC->GetDeviceCaps(LOGPIXELSX),
yRadius = pDC->GetDeviceCaps(LOGPIXLESY),
xPt = 0,
yPt = 0;
CPoint ptCenterPoint = bounds.CenterPoint();
double offset = (nDegree/360) * 4; //Since we are working with 1/4 of a circle,
//90 degrees is the entire quadrant
if((nDegree > 0) && (nDegree < 90))
{
//Quadrant 1
xPt = ptCenterPoint.x - (int)(offset * xRadius);
yPt = (xRadius * xRadius) + ((xPt - ptCenterPoint.x) * (xPt - ptCenterPoint.x));
yPt = (int)sqrt(yPt);
}
else if(nDegree == 90) //right angle
{
xPt = ptCenterPoint.x - xRadius;
yPt = ptCenterPoint.y;
}
else if((nDegree > 90) && (nDegree < 180))
...
pt.x = xPt;
pt.y = yPt;
}
|
|
|
|
|
Any ideas how to use ShellExecute for printing n copies of a document (say .pdf) ?
Thanks in advance
Mike
|
|
|
|
|
|
I know that i have to use "print" as the verb parameter...
But how can i tell ShellExecute (or the document's associated application) to print N copies ???
|
|
|
|
|
If your program supports passing number of copies in its command line, you can try to use lpParameters in calls to ShellExecute. If not, you're out of luck - unless you want to call ShellExecute multiple times.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hello,
I'm using Chris Maunder's excellent CSystemTray class to add an icon to the system tray for my application, and it is working great. Now I would like to set it up so that when the user minimizes the window (using the minimize button), it minimizes to the tray icon - not the taskbar icon. I followed the examples in Chris's article using a popup menu for the tray icon with Minimize and Maximize commands, and using CSystemTray::MinimiseToTray, etc. which worked fine, but I want to override the action of the minimize and restore _buttons_ (and, of course, the Minimize and Restore commands in the Windows (system) menu).
I tried snooping around MSDN for any info on SC_MINIMIZE, CWnd::OnSysCommand(), etc. but I haven't been able to come up with the magic formula yet! (Oh, it's an SDI app, if that makes a difference.) Does anyone kow how to do this?
Thanks!
-km-
|
|
|
|
|
|
I'm trying to use _findfirst and _findnext to find files with a certain extension in a given directory. THe files I'm trying to "find" are in the format "file.ext1.ext1".
_findfirst and _findfirsti64 don't find these files. Anyone got any hints? BTW, this has to work on Win9x and WinNT.
|
|
|
|