|
|
Hi,
What is the difference between BOOL and bool??
Best Regards,
A.Ilamparithi
|
|
|
|
|
This topic is already discussed.
Quick info:
BOOL is a int ( integer value from 0 to 65535 )
bool is a boolean ( true false )
but BOOL can be used as bool ( BOOL bBoolean = TRUE or BOOL bBoolean = FALSE )
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
BOOL goes back to the days when bool was not part of the C++ standard.
It is typedef'ed as an int, where FALSE is 0.
bool, however is inherently c++. Although BOOL and bool may be used interchangeably, you should be very aware of the dangers involved in mixing these two types.
There were a few discussions about this on the lounge a while ago I think. There may be an FAQ article about this as well. Have a search on it. It is worth knowing.
I Dream of Absolute Zero
|
|
|
|
|
If I remember it corectly it's: "enum and #define" - bool is a enum and the classic BOOL is #define'd
Regards,
Michael Mogensen, mm it-consult dk.
><((((º> ·.¸¸.· ><((((º> ·.¸¸.· ><((((º>
|
|
|
|
|
Hi
I create an application which able to print any documents.
This bit of my code
...
//Create printer DC m_prtDC
...
//All fine ,now create compatible DC (m_extDC)
//with one ,which has same size
...
//All fine, set neccessary font size and print text
//into m_extDC
...
//Now try to print this text
m_prtDC.StartDoc(LPCTSTR("MyDoc"));
m_prtDC.StartPage();
//Copy from dc, where allocated my text to printer dc
//2400 & 3600 my printer DC size
m_prtDC.BitBlt(0,0,2400,3600,&m_extDC,0,0,SRCCOPY);
m_prtDC.EndPage();
m_prtDC.EndDoc();
When my printed text (printed with TextOut() fun)not enought big all printed fine.But when m_extDC hold a lot of text ,printer wan't to printed one.I watch what priner are prepared to printing (respected sensor are flick), but from any time error sensor are switched on, and all halt.At that
all invoked routines returned sucessfull.
Where is my fault, and how i can to solve it.
Thank.
|
|
|
|
|
BitBlt() is usually not supported or incorrectly supported on most printer drivers (DC). If your printing in MFC make use of the standard MFC printing architecture. If not, take alook at Chris Maunders article "Printing wiuthout the Doc/view architecture" in the printing section. Also my article "Printing tips n Tricks from the Trenches" should be of use.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
hi ,
i have a dialog based application having a class for example CDialog. in the on button click event iam loading another dialog as follows:
m_pModeless= new dlg;
Then after getting the safeHwnd :
m_pModeless->Create(......);
where dlg is the class of the new dialog and m_pModeless has been declared in the header file as dlg *m_pModeless.
Now i want to access the member variables from this child window to the main window i.e from one class to the other.
I'am a bit confused of how to go about it ... please help.
Thanking you.
Satadru.
|
|
|
|
|
I assume you are attempting one of the following procedures:
1. Accessing the newly created dialog from the button click event
2. Accessing the class running the button event from the newly created dialog
For case #1, the answer is simple: you already have a pointer to the class, and it is properly initialized by using new . You can use this pointer to alter the data members as you see fit.
For case #2, you need to specify the calling class as the parent of the newly created dialog. For modeless dialog creation, the calling convention would be CDialog::Create( UINT uiTemplateID, CWnd* pParent ) . Specifying the this keyword into the parent pointer would designate the calling class as the parent of the newly created modeless dialog.
Further in case #2, you can access the parent window by using GetParent method, which will return a pointer to the parent class's CWnd . Because you have derived from CDialog , and because CDialog is derived from CWnd , you can use the pointer returned by GetParent and cast it down to the appropriate class.
Understanding this, here is a code fragment, which will do the casting operation. Remember that if you put this casting operation into a function inside the newly created dialog, you must include the header file of the parent dialog into the implementation file. Otherwise the casting operation is unable to determine the type of the variable. In here, we assume that the parent class (which handles the button click), is called CParentDialog and the child dialog (newly created one) is called CChildDialog .
#include "ParentDialog.h"<DIV>
...<DIV>
CParentDialog* pParentDialog = DYNAMIC_DOWNCAST( CParentDialog, GetParent() );<DIV>
pParentDialog->SomeMethod( someParams );
pParentDialog->SomeData = SomeValue; This functionality comes directly from the way MFC is designed. Have a look at the inheritance map (hiearchy chart). In C++, it is always possible to cast a pointer from the base class to the derived class, and in MFC, the most useful operation is DYNAMIC_DOWNCAST , because it will verify that the casting operation is succesfull, or return NULL if it is not.
When you create new window classes (Windows, dialogs, controls), you always derive from an existing base class (CWnd, CDialog, CButton/CEdit etc). Thus, if you create a new CButton, the derivance chart would be CWnd->CButton->CYourButton. If this button was a parent of another control (unlikely, but possible), then you could use the GetParent method to return a pointer to the above-mentioned CWnd class. Then, a cast operation from CWnd -> CYourButton would be completely valid.
I hope this will help you now, and that my extended rambling furthered your understanding of the MFC framework
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
hi thanks for your help ;
but theres a problem:-
inspite of including the header file of the main dialog viz CMainDlg its still giving me an error saying:
'classCMainDlg': is not a member of 'CMainDlg'
Could you please tell me why is this happening.
thanking you,
Satadru
|
|
|
|
|
What is this 'viz' ? "Which is" ?
The error you are describing is related to the CMainDlg itself. You are referring to a member classCMainDlg somewhere in your code, and this member is not declared in the header file of the class. See the header file of CMainDlg for details, especially check the line where the error is.
The case #2 I posted back in my previous message did not tell you to add any member to the parent (CMainDlg) class. If you added members there, then you have done something wrong yourself.
In conclusion: this error has nothing to do with the method I described. It is happening because a) you have done something wrong yourself or b) have not understood my description properly.
I would ask you to post the line where this error is happening and the context where it is in. I believe that it might be in the line where you create the modeless dialog box. Remember, that the 'this' pointer always points to the current object that is executing a method. For example, if you had an object of a class created, returning 'this' from a function would return the address of the object.
Check your code and post the line where the error is happening. You probably have just mistyped something.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
hi ,
i have tried it out ..but the same problem exixts... i cudn't figure out where its going wrong ..can i have your email id so that i'll attach a small code snippet which is posing me the problem.
I gratefuly appreciate your kind gesture.
Thanking you.
Satadru.
|
|
|
|
|
Just paste the code here, and I will analyse it promptly. I prefer not to give my e-mail address away on public forums, they tend to end up to mischiveous hands
Besides, if your code had something so important that you couldn't post it here, how could you send it on e-mail either ?
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi
You should pass a pointer on the main window on constuctor of child dlg.
//Forward declaration
class CMainDlg;
class CChildDlg : public CDialog{
CChildDlg(CMainDlg* p_main_dlg):CDialog(...){
this->p_main_dlg = p_main_dlg;
//Now throught this->p_main_dlg you can get
//allother public members of main dlg
}
private:
CMainDlg* p_main_dlg;
};
class CMainDlg : public CDialog{
...
paublic:
int var;
void CraeteChild(){
CChildDlg dlg(this);
dlg.DoModal();
}
};
|
|
|
|
|
I need to develop a simulator of a device which when connected to the system detects its driver. I came to know this can be done by develop a Fake USB port. Is it possible by this method ? IS there any other method to do this ?Plz any one help me regarding this...
Thank you.
|
|
|
|
|
search for virtual port on google, and then check out VSPD the best one available.
My God is more powerfull Than Your God.
|
|
|
|
|
|
Virtual serial port dirver.
My God is more powerfull Than Your God.
|
|
|
|
|
Is virtual port and virtual device same?
|
|
|
|
|
You said you want usp port, this software gives you face usb port, i dont know how how exactly you are going to use it. but still this software is worth trying out.
My God is more powerfull Than Your God.
|
|
|
|
|
What I want to do is the following: (1) create a GraphicsPath; (2) create a second GraphicsPath, (3) create a Region for each path using the constructor Region(GraphicsPath*); (4) intersect these two regions getting a Region* for the intersection. Now the question: how to construct a GraphicsPath around this intersection region ? If there would be something like GraphicsPath(Region*) I wouldn't ask this question
|
|
|
|
|
Hi, how in Gods name, do i get the doman or workgroup name to wich my computer belongs to?
i cant use GetComputerNameEx() cause the app must also run on W9x machines.
ibe searched google, the msdn (online and my cd) and found nothing!
i cant belive something so apparently simple would be so hard to find!
the only thing i can think of right now, is to do the whole WNetopenEnum() / WNetEnumResource() stuff, look for my computer name, check from wich container i got it, etc.
Theres GOT to be an easier way! Please help
Thanks!
|
|
|
|
|
Hi,
Get the Local host name and use Netbios call to get Domain name. Iam not sure whether Netbios will return Workgroup name... Anyway, check out it...
It will be helpful!!
Best Regards,
A.Ilamparithi
|
|
|
|
|
Try Q155698, howto: retrieve current user and domain names on Windows 95 and 98.
However, it requires use of 16-bit code, so you need to use thunks. The article points you at other articles, explaining how this can be done.
Steve S
|
|
|
|
|
My application must do something when its main window is minimized.What message is sended when a window is minimized?
Thank you!
Yeetang
|
|
|
|