|
If you Invalidate() a window it will try to redraw itself at the next opportunity.
Because your 'invisible' static control is hidden for a while it is automatically Invalidate()ed. So when it comes to draw it again, it still thinks it is Invalidate()ed. If you Validate() your static control rather than creating a DC from the window, it will also work.
HOWEVER, why did you not just create the window without WS_VISIBLE set?
|
|
|
|
|
ah thx for the good explanation, I remember from my Win32 experience.
Mythago wrote:
HOWEVER, why did you not just create the window without WS_VISIBLE set?
I remake a splitter control, the splitter itself _can_ be "invisible". If I set the WS_VISIBLE style I can't get mouse messages and stuff anymore.
|
|
|
|
|
btw, one more question: Is there a easier MFC solution to validate a client rect than calling CPaintDC dc(this); ? Or does it already provide the mininum solution?
|
|
|
|
|
Yes you can use ValidateRect(NULL) surprisingly...;)
|
|
|
|
|
Mythago wrote:
Yes you can use ValidateRect(NULL) surprisingly...
my hero
M
|
|
|
|
|
hi
i am writng my own printsetup dailog box in mfc. i selected all properties and when i give print the printer is not signaling . i am providing my code below please correct where the mistake. if my code is wrong please give guidence how can i send data to printer. my intention is not displaying windows printdialog box. what are the functionality we did on printdialog we can carry on our dialogbox. It's urgent. please help
thank you
void CMyPrintSetup::OnButPrint()
{
// TODO: Add your control notification handler code here
unsigned char temp[32];
DEVMODE *devout,*devin;
DWORD dwNeeded,dwRet;
DEVMODE* pDevMode;
/**********************getting printer handle**********************/
if(!OpenPrinter(printername,&hprinter,NULL)) //for getting handle for printer
MessageBox("Printer can't be opened","emazines",MB_OK);
/*******get the size of the buffer for specified printer****************/
dwNeeded=DocumentProperties(NULL,hprinter,printername,NULL,NULL,0);
pDevMode=(DEVMODE*)malloc(dwNeeded);
/**get the default DEVMODE for the printer and modify if your needs*********/
dwRet=DocumentProperties
(NULL,hprinter,printername,pDevMode,NULL,DM_OUT_BUFFER);
if (dwRet != IDOK)
{
/* If failure, cleanup and return failure. */
free(pDevMode);
ClosePrinter(hprinter);
}
pDevMode->dmOrientation=m_orientation;
pDevMode->dmCopies=m_copies;
/***********set the new values to printer****************/
dwRet=DocumentProperties
(NULL,hprinter,printername,pDevMode,pDevMode,DM_IN_BUFFER|DM_OUT_BUFFER);
if(dwRet!=IDOK)
{
MessageBox("properties initialization error","emazines",MB_OK);
}
/*********************** code for printing *************************/
CDC dc; //creating a DC object
AfxMessageBox(printername);
HDC hdc=CreateDC(NULL,printername,NULL,NULL);
dc.Attach(hdc);
dc.Rectangle(100,100,200,200);
dc.TextOut(50,50,"Emazines Software Private Limited");
dc.DeleteDC();
/*********************End of the code for printing*********************/
CDialog::OnOK();//for closing window
}
|
|
|
|
|
Use:
dc.Startpage();
//print stuff
dc.EndPage();
|
|
|
|
|
CDC dc; //creating a DC object
AfxMessageBox(printername);
HDC hdc=CreateDC(NULL,printername,NULL,NULL);
dc.Attach(hdc);
dc.StartDoc();
dc.StartPage();
dc.Rectangle(100,100,200,200);
dc.TextOut(50,50,"Emazines Software Private Limited");
dc.EndPage();
dc.EndDoc();
dc.DeleteDC();
Roger Allen
Sonork 100.10016
I have a terminal disease. Its called life!
|
|
|
|
|
create several wizard property-pages on a property-sheet which is child of a dialog-box.
problem comes out:
if press a button of any property-page to display a message box or dialog box, whole app process is at dead-lock.
if the button does only functionalities without displaying messge-box or dialog-box, it is OK.
did u have the problem also and how do u fix it?
thx.
includeh10
|
|
|
|
|
Hi,
I have created an OCX using VC++ 6.0. This OCX is applying in my Borland Delphi 5.0's application. However, I was encountered a problem of showing this OCX component icon in Delphi which I imported from VC++ ActiveX Control. I was coded the LoadBitmap in Create function as follows:
BOOL CTesting::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
CBitmap bmp;
bmp.LoadBitmap(IDB_OCXBMP);
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
When I drag this component from my Delphi on the Form, it will not show what was my picture created in VC++. It shows empty instead!!!
Any comments or solutions, please reply me as soon as possible.
Cheers. Thanks.
Regards,
Miao Miao
|
|
|
|
|
I've notice that evertime I delete a function (in a dialog based app) that I loose the CFileNameDlg Class from the Class View tab. I don't get it back again until I use class wizard to add a new function. Anyone got anythoughts on this (I've had this happen to me to often).
---------------------------------------------
The greenest grass is NOT on the other side of the fence, its the grass you take care of. Have you watered your lawn lately?
- Just remember when you point a finger at someone else, you are only one finger away from making a fist to hit them with!
|
|
|
|
|
You need to delete the class view information to make the compiler rebuild it. I forget the extension tho.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Okay.. I'll look into that, two other questions ...
did you get the email I sent? didn't want to think I forgot about that
also... off the top of your head, how do I either stop the IDOK command in a dialog (I need to confimn that the user actually wanted to click it) or how do I send the IDOK message (keep getting "protected errors"... any thoughts?
---------------------------------------------
The greenest grass is NOT on the other side of the fence, its the grass you take care of. Have you watered your lawn lately?
- Just remember when you point a finger at someone else, you are only one finger away from making a fist to hit them with!
|
|
|
|
|
Mel Feik wrote:
did you get the email I sent? didn't want to think I forgot about that
Yes, I got it, no worries.
I dunno how to send IDOK, but I'm not sure what you mean by stop it - how would you get it unless someone clicked it ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Delete the *.ncb file.
The VC 6.0 had this irritating bug...
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
last reply is a real reply, others are noising.
i am wandering why the guy is always making noising everywhere? feel lonely? show off with poor knowledge?
the guy replied on my poster with:
HAHAHHAHAHHAHAHHAHHAHAHHA.
u go to hospital now!
includeh10
|
|
|
|
|
I'm working a program on oracle db. Using ado, i access the oracle db. Tree,ORADC and MS FlexGrid control are used. When i double click the tree control,my FlexGrid should update and display the query dynamicly.When i double click the tree,my FlexGrid can NOT update at all.
I already get the filter from tree and Oradc.SetDataSource() then Oradc.Update(). Why my FlexGrid can not update?
Which step should be done?
Thanks.
sages
|
|
|
|
|
Hi all
I want to display MessageBox with "Disconnect" ,"Exit" and "Cancel"
buttons....how di I?can any one help me regarding this with code
example??
ThomasKennedyBose
|
|
|
|
|
yes... but you need to define your own message box (dialog box) which is pretty simple and staight forward...
In the resources view, right click on the Dialog icon and select Insert Dialog. The right click on IDD_DIALOG1 in Resoure View and select Proerties. Use this window as you normally would (change the IDD_DIALOG1 to something more useful to you). You can use the properties window to chant the Caption to one of your own. Now just double click on the dialog resource and add what ever controls you would like to use.
You will also need to add a class for the dialog. Use Insert|New Class from menu, if you are using MFC select MFC Class as Class Type, etc.... Give it a name like CYourNameDlg and select CDialog as the base class. YOu should also see that the ID is the name you chose. Thats about it, its ready to go.
---------------------------------------------
The greenest grass is NOT on the other side of the fence, its the grass you take care of. Have you watered your lawn lately?
- Just remember when you point a finger at someone else, you are only one finger away from making a fist to hit them with!
|
|
|
|
|
You can use the MessageBoxIndirect API.
For example look this article
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Hi,
Who can solve these...
1. How can I explicitly use a *.dll file without manually move it under my *.exe file's folder?
2. As my VC++6.0 installed on a Chinese version Win2k Server, font of codes in IDE is Fixedsys, I want to adopt font Verdana instead, but no such option show in the downlist of font(Tools->options->Format). tell me how to achieve this.
Thank u in advance.
Extreme programming. Do the No.1
|
|
|
|
|
Hi,
Three questions in all.
1. How can I explicitly use a *.dll file without manually move it under my *.exe file's folder?
2. As my VC++6.0 installed on a Chinese version OS, codes in IDE is Fixedsys, I want use Verdana instead, but no such option in the down list of font. tell me how to achieve this.
3. I try to load classes in a *.dll file, while what's wrong here.
--------------------Configuration: HydroExe - Win32 Debug--------------------
Linking...
HydroExeDlg.obj : error LNK2005: "unsigned int tid" (?tid@@3IA) already defined in HydroExe.obj
HydroExeDlg.obj : error LNK2005: "class CSerialComm SerialComm" (?SerialComm@@3VCSerialComm@@A) already defined in HydroExe.obj
HydroExeDlg.obj : error LNK2005: "class CDecoder Decoder" (?Decoder@@3VCDecoder@@A) already defined in HydroExe.obj
Debug/HydroExe.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
HydroExe.exe - 3 error(s), 1 warning(s)
------------------------------------------------------------------------------
Thank u in advance!
Extreme programming. Do the No.1
|
|
|
|
|
stevenson wrote:
1. How can I explicitly use a *.dll file without manually move it under my *.exe file's folder?
Well, if you put it somewhere in your PATH , Windows will find it. However, it is highly frowned upon to put things in system directories (Like C:\Windows\System or C:\Winnt\System32.)
stevenson wrote:
3. I try to load classes in a *.dll file, while what's wrong here.
Hmmm. Are you defining the class as an Export from your DLL? Is this MFC? If so, you can qualify your class (in the header) with:
class AFX_EXT_CLASS CSerialComm
If not, you can #define your own export macro (add MYPROJ_EXPORTS to your Preprocessor settings in your build settings):
#ifdef MYPROJ_EXPORTS
#define MY_EXPORT __declspec(dllexport)
#else
#define MY_EXPORT __declspec(dllimport)
#endif
"The greatest danger to humanity is humanity without an open mind." - Ian Mariano
http://www.ian-space.com/
|
|
|
|
|
i want to display Character(like u) in an edit box of hwnd h with the help of postmessage method.
can any body tell its correct parameters.
because i just know where to put my hwnd.
but i dont know what to put in place of these parameters.
1- UINT Msg, // message
2- WPARAM wParam, // first message parameter
3- LPARAM lParam // second message parameter
BOOL PostMessage(
HWND hWnd, // handle to destination window
UINT Msg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
r00d0034@yahoo.com
|
|
|
|
|
::SendMessage(hTestWnd, WM_CHAR, (WPARAM) 'u', (LPARAM) 0);
I don't see why PostMessage would be any different.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|