|
Alvaro,
With some help from Joseph Newcomer I have at last come to the end of this problem.
The event handler for BM_SETCHECK, OnCetCheck did not include both parameters (WPARAM and LPARAM). I'm not quite sure why, but the exclusion of this unused parameter was causing all the problems.
Thanks for all your help.
Derek Lakin.
Salamander Software Ltd.
|
|
|
|
|
Hello,
I want to make a dialog based application that requires the user to enter a username and password to enter.
So in the constructor of the Dialog box class of my application I create a child dialog login box. What I want to do is that if the user presses Cancel on the child login box, then the Application ends.
So to do this do I need to call the OnCancel method of the parent dialog box?
if yes then how do I call it?
Is there a better way to do this?
Thanks,
Mike.
|
|
|
|
|
You need to get the value that returns the Dialog.
In DoModal returns the Identificator of the button that the user presed.
For Ok returns IDOK for Cancel returns IDCANCEL.
You must to put this function in the OnInitDialog()....
Is easy....
Best Regards!!!!
Carlos Antollini.
|
|
|
|
|
You should do that in OnInitDialog() instead, because at that time the first dialog is created but not yet shown.
BOOL CMainDialog::OnInitDialog()
{
CPasswordDialog pwdDlg;
if ( IDCANCEL == pwdDlg.DoModal() )
EndDialog(IDCANCEL);
...
}
--Mike--
http://home.inreach.com/mdunn/
#include "witty_sig.h"
your with and
|
|
|
|
|
Shall I create the child dialog box in the constructor of the Main Dialog box or in the OnInitDialog?
When I created it in the OnInitDialog then after I closed the Main Dialog Box I could still see the image of the child dialog box (not the box though).
This does not happen when I create the child dialog box in the constructor of the Main Dialog Box.
Any explanations?
|
|
|
|
|
Hello.
Printing again. The problem is how to position printer in order to get somehow precise output. For example: How to draw a frame which is equally distant from the edges of a page?, or how to draw division lines: vertical and horizontal in such a way that they divide an a4 page into two parts (more or less equal parts)?
At this time beeing I obtained less precise results (still,something is wrong) while using GetDeviceCaps & PHYSICALWIDTH(HEIGHT), PHYSICALOFFSETX(Y), but it produces different outputs (more or less accurate), depending on a printer (hp 1220 and 690).
PS. I have also used the pInfo->m_rectDraw rect but, it didn't print out the boundaries (the rectangle was to large to fit the printable area).
PLEASE, anyone able to help ?
|
|
|
|
|
It will be different depending on the selected printer and the resolution selected on it. You size to the printers parameters. Using GetDeviceCaps gives you all you need to calculate your graphic size or text formating.
HORZSIZE Width, in millimeters, of the physical screen.
VERTSIZE Height, in millimeters, of the physical screen.
NUMFONTS Number of device-specific fonts. Use printer matched fonts if possible (though most are good anyway).
ASPECTX Relative width of a device pixel used for line drawing.
ASPECTY Relative height of a device pixel used for line drawing.
ASPECTXY Diagonal width of the device pixel used for line drawing
PHYSICALWIDTH For printing devices: the width of the physical page, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper has a physical width value of 5100 device units. Note that the physical page is almost always greater than the printable area of the page, and never smaller.
PHYSICALHEIGHT For printing devices: the height of the physical page, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper has a physical height value of 6600 device units. Note that the physical page is almost always greater than the printable area of the page, and never smaller.
PHYSICALOFFSETX For printing devices: the distance from the left edge of the physical page to the left edge of the printable area, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper, that cannot print on the leftmost 0.25" of paper, has a horizontal physical offset of 150 device units.
PHYSICALOFFSETY For printing devices: the distance from the top edge of the physical page to the top edge of the printable area, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper, that cannot print on the topmost 0.5" of paper, has a vertical physical offset of 300 device units
If your using the CPrintDialog then LPDEVMODE GetDevMode( ) will get you all the information you want in one go.
But the point is, that you must scale to printed page in much the same way as you do for the screen and each of its modes.
Experiment with the DEVMODE structure, what you will find is that you can scale text/graphics by the pel size, so that with a function such as
(xpos-ypos in mm or points)
PrintMyTextOnPaperAndBanLongFunctionNamesToo(xpos,ypos,LPCTSTR Text)
You can get accurate printing to 1/10th mm
We do it for the joy of seeing the users struggle.
|
|
|
|
|
the control won't show up when I execute my program in other computer..
why ??
|
|
|
|
|
Is the ocx in that computer?
Is the ocx registered in that computer?
(When the ocx is not in the computer, o is missing some componnent, or the ocx is not registered, the componnet not appear)
Best Regards
Carlos Antollini.
|
|
|
|
|
please answer the question:
how can i move control with mouse on the dialog but without drag&drop?
|
|
|
|
|
First capture the notifications from the mouse on the desired control, then move the control to the position of the mouse using MoveWindow.
To redraw the movement of the control while the mouse is moving capture the WM_MOUSEMOVE and move the control accordingly.
See:
CWnd::MoveWindow
WM_MOUSEMOVE
WM_LBUTTONDOWN
WM_LBUTTONUP
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
How do I go about displaying Windows Explorer style forlder view without control panel, printers and recycle bin, but only to include drives (hard disks, floppy disks and CD roms) and directories with correct icons. Is there a system property does assosiates icons to device types?
Please help,
Tushar
|
|
|
|
|
Hello,
Sorry if this is a repleat type question.
I have been using this site to learn more about WTL and there is very useful information included. I am trying to develop a FormView type application that has a toolbar + statusbar + dialog type form view. When I create such an application with WTL app-wiz, I do not get scroolbars the way MCF app-wiz does and therefore if I resize the eventual application, I cannot scroll which you can imagine causes a problem.
Next question, it is possible to display menus in MCF application with icons, like WTL apps do? I do not want to incorporate large amounts of code into my app that is not tested. This way I would not have to use/learn WTL.
Please help,
Tushar
|
|
|
|
|
After i compiled my project in the release version and execute my program in other computer, there is an erros msg says "An unsupported operations was attempted".
I think the one causing it is my MFC 2.0 GridControl
What can I do ???
|
|
|
|
|
I don't know where the gridcontrol resides (comctr32?), but it seem like
you either don't have the module on the testcomputer, or it is not registred. Check version for whatever module gridcontrol resides in, and try to (re)register it using regsvr32.
/moliate
|
|
|
|
|
How to get the manufacturer/model of a given cd-rom drive letter?
I know how to get this from registry (HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\Scsi) but how to associate a given drive letter and a given scsi port? But if I can associte this information, how about other types of cdrom's (SCSI/EIDE)?
Any help would be apreciated!
Thanks in advance!
Rui Lopes
|
|
|
|
|
I want to print from a document that it contain
text,the text is more than one page,how and where
I should initialaze it and write code for it?
|
|
|
|
|
the code as follow:
bool CDBOperate::CanLoginToDB(CString username,CString userpassword)
{
if(username.GetLength()<=0||userpassword.GetLength()<=0)
return false;
if(!m_db.IsOpen())
ConnectToDB();//this function use to open database
char *sqltext="select * from user";
CDaoRecordset rs(&m_db);
try
{
rs.Open(AFX_DAO_USE_DEFAULT_TYPE,sqltext,0);
}
catch(CDaoException* e)
{
e->Delete();
return false;
}
rs.m_strFilter="user="+username+" and password="+userpassword;
int i=rs.GetRecordCount();
if(i<=0)
{
rs.Close();
//delete rs;
return false;
}
rs.Close();
//delete rs;
return true;
}
but each time I can't get reocrd from datbase(user.mdb).
In fact ,there are 3 record in the database.
|
|
|
|
|
Your problem is in the Filter...
See the following
rs.m_strFilter="user="+username+" and password="+userpassword;
This must be
rs.m_strFilter="user=\""+username+"\" and password=\""+userpassword + " \"";
You forgot the quotes in your sentence.
The Filter is the where in a SQL sentences. User and userpassword fields are char, is for this that the value that are you looking for must be between quotes.
Best Regards....
Puff Today is Monday....
Carlos Antollini.
|
|
|
|
|
I tried it,but I can't get record too.
I don't know why!
help!!
|
|
|
|
|
GetRecordCount() typically doesn't know how many records you have until you're iterated over all of the records. My loops typically look like:
while (!rs.IsEOF())
{
...
rs.MoveNext();
}
Joel Lucsy (jjlucsy@concentric.net)
|
|
|
|
|
Hi all,
I'm trying to create some exported functions in a DLL; these functions are called from my main application(the main application is a console application). When a user type 'X' and enter, I want launch my Doc/View usign a DLL.
Therefore I've to create a window supporting MFC doc/view architecture.
Problem is that I don't know how create this window????
Thks for you help,
HES
|
|
|
|
|
You could look at this http://www.codeproject.com/docview/docviewfromdll.asp
Cathy
|
|
|
|
|
Is there a simple method to draw anti-alias'ed circles or lines? For example, if I use the code:
pdc->Ellipse( ARect );
It draw an ellipse. Is there a simple method to define a pen type that will perform anti-aliasing for me?
Thanks in advance..
|
|
|
|
|
Use the new GDI+.
Search for GDI+ or GDI plus on CodeProject
Bys,
Rui Lopes
|
|
|
|