|
Thank you and sorry for the delay in answering but a wife, three kids and a dog keep life busy.
Filippo
|
|
|
|
|
I'm right there with ya, but in lieu of a third kid, I've got a 10-acre farm! We've a cat, too, but he is low maintenance.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
I have some trouble initialising a CComboBox (IDC_COMBO, Control, m_Combo) in a Modeless dialog (IDD_MODE) called by a menu item via OnModelss Function.
in my appView.cpp i added the following code
void CAppView::OnModeless()
{
CModeless* dlg = new CModeless();
dlg->Create(dlg->IDD,NULL);
dlg->ShowWindow(SW_SHOWNORMAL);
}
// Modeless.h : Header
#if !defined(AFX_MODELESS_H__520EAA74_A5F9_4AEC_AA59_F87866452E43__INCLUDED_)
#define AFX_MODELESS_H__520EAA74_A5F9_4AEC_AA59_F87866452E43__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// CModeless.h : Header
//
/////////////////////////////////////////////////////////////////////////////
// Dialogfeld CModeless
class CModeless : public CDialog
{
DECLARE_DYNAMIC(CModeless)
public:
public:
CModeless(CWnd* pParent = NULL);
BOOL Create(UINT nID, CWnd* pWnd)
{ return CDialog::Create(nID,pWnd); }
void PostNcDestroy()
{ delete this; }
void OnCancel()
{ DestroyWindow(); }
///////////////////////////////////////////
virtual ~CModeless();
//{{AFX_DATA(CModeless)
enum { IDD = IDD_MODE };
CComboBox m_Combo;
//}}AFX_DATA
//{{AFX_VIRTUAL(CModeless)
protected:
virtual void DoDataExchange(CDataExchange* pDX);
//}}AFX_VIRTUAL
protected:
//{{AFX_MSG(CModeless)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
#endif // AFX_MODELESS_H__520EAA74_A5F9_4AEC_AA59_F87866452E43__INCLUDED_
// Modeless.cpp//
#include "stdafx.h"
#include "App.h"
#include "CModeless.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC(CModeless, CDialog)
CModeless::CModeless(CWnd* pParent /*=NULL*/)
: CDialog(CModeless::IDD, pParent)
{
//{{AFX_DATA_INIT(CModeless)
//}}AFX_DATA_INIT
}
void CModeless::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CModeless)
DDX_Control(pDX, IDC_COMBO, m_Combo);
//}}AFX_DATA_MAP
}
CModeless::~CModeless()
{
}
BEGIN_MESSAGE_MAP(CModeless, CDialog)
//{{AFX_MSG_MAP(CModeless)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
BOOL CModeless::OnInitDialog()
{
CDialog::OnInitDialog();
m_Combo.AddString("1"); !!!!!!!!!!!!!! HERE I get a Debug Assertion Failed error
m_Combo.AddString("2"); winctrl1.cpp, line 186
m_Combo.AddString("3");
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
}
Does anyone have a suggestion??
Thanks and Regards
Filippo
|
|
|
|
|
Is there a way to detect when Windows raises a Warning Message? For example, let's say an app has memory error and it raises an assertion message. Can this message's handle be grabbed then a response to the message be passed along? Thanks.
|
|
|
|
|
Have you looked at the ASSERT() macro? When an assertion is fired (exceptions are raised), it simply produces a message box with the filename and line number of the offending statement. No WM_xxx message has been sent/posted such that anything could be grabbed intercepted.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
But assertion still creates a window. Shouldn't we be able to grab it's handle and programatically click the OK button. How about using a FindWindow and then use the returned handle to SendMessage(..., BUTTON_CLK)? I'm not sure. That's why I'm posting the question.
|
|
|
|
|
Anonymous wrote:
But assertion still creates a window.
Right.
Anonymous wrote:
Shouldn't we be able to grab it's handle and programatically click the OK button.
Only if the dialog were modeless. Since it is a modal dialog, your application's message pump is blocked until that window is dismissed.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
YEah you are right Mr David (as usual),but still there are some way out to stop assert window, let find it!!!!!
-----------------------------
"I Think It will Work"
Formerly Known As "Alok The Programmer" at CP
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
I followed the rest of the thread, and I think you're missing the point about the message. The message is there to tell you about a serious error in your application. You need to diagnose the problem and either prevent it from happening, correct it and continue, or notify the user and exit gracefully.
Automatically detecting the message box and closing it is not the way to deal with the problem.
Software Zen: delete this;
|
|
|
|
|
hi,
anybody know how to add OWC chart And Pivot Table (OWC10) to Cpropertysheet.Examples And Links will be Appreciated.
by
baijumax
|
|
|
|
|
Hello i´m stuck with a problem
I have a simple struct
struct Square
{
int Inboard;
};
struct Square Sq[8][8];
and then i use a inbedded for loop to set the value to Inboard
for(i=0;i<8;i++)
{
for(j=0;j<8;j++)
{
Sq[i][j].Inboard=1;
}
}
It works, but in the same time as it puts a value in Sq[i][j].Inboard it also put in a value in Sq[i+1][j-8].Inboard
why is that??
znize
|
|
|
|
|
Let us say that i is 2 and j is 3. That means that [i][j] is accessing the (2*8)+3 or 19th element in the array. (Remember that multi-dim arrays are really just one long array). Now if you access [i+1][j-8] that means you are accessing ((2+1)*8+3-8 which is (3*8)-5 which is 24-5 or the 19th element again.
It isn't storing two values, you are looking at the same value.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thanx for your replay....
then i have to solve my problem different!
Thanks a lot!
Johan
|
|
|
|
|
znize wrote:
then i have to solve my problem different!
If you are simply initializing the whole structure to 1, memset() would be a far better solution.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
How can you use memset to initialize integers to a value where all four bytes are not the same value?
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
...all four bytes...
Oops, my bad. I overlooked that "minor" requirement.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Eeeeek! memset is not the way to initialize anything to a value, other than clearing buffer contents to zero.
Software Zen: delete this;
|
|
|
|
|
Hi all
For opening a Database I used CoInitialize in my Service. This creates a hidden window "OleMainThreadWndClass".
Now the problem is whenever I try to logoff or restart windows is not able to proceed because of running OleMainThreadWndClass window.
This issue is only present in NT. If I run the service disabling "interact with desktop" there is no problem.
How can overcome this.? What could be the problem ?
Thanks in advance
Regards
Shiraz
btw: I cannot close the database while logoffs becaouse it is a service and it should keep running.
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Hi I'm using GDI+ for a C++ application which is a great library. But this library sooo powerfull is not able to do a simple thing I need to do
I have a picture 1 x 10 px that I want to stretch to a very flat 100 x 10 px. As result I have a wonderful alpha gradient which is not what I want. Of course I tried to change the interpolation mode to InterpolationModeNearestNeighbor which give me a better result but still not perfect since and - I don't why - the area painted is not completly filled.
There is the very simple code :
// Load in some initialisation function
// a 1 x 100 picture sized
m_pBitmap1 = Bitmap::FromFile( csFilename.AllocSysString() );
// Then in onpaint method
CPaintDC dc(this);
Graphics graphics(dc.m_hDC);
graphics.SetInterpolationMode( InterpolationModeNearestNeighbor );
graphics.DrawImage(m_pBitmap1, 0, 0, 100, m_pBitmap1->GetHeight());
Can somebody provide me some explainations or even better... a solution ?
Thanks
|
|
|
|
|
Maybe I am missing something, but why not just use the GDI function StretchBlt . It does not do any of the funky gradient stuff you don't want. Use Graphics::GetHDC to get the HDC handle, and then call Graphics::ReleaseHDC when you are done. It is a very simple way to mix GDI and GDI+ in the same drawing routine.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Actually, if the stretch blt mode is HALFTONE (anti-aliasing), the image will indeed be alpha blended. Very annoying when you don't want it turning your image into a gradient, but do want a bit of smoothing on the edges. Take a look at SetStretchBltMode if you're curious.
Chris Richardson
|
|
|
|
|
I haven't tought to mix GDI and GDI+, that's definitely a good idea..
Thank you for the explanations about the anti-aliasing processing.
thanks, thanks, thanks
|
|
|
|
|
Hi,
is there a way to get a pointer to controls on a dialog, when
I don´t know the IDC_... of those controls.
I only have a pointer to the window on wich the controls are such as:
HWND *hWnd;
hWnd = GetForegroundWindwow() ...
Can someone show me a solution ?
Thanks, John
|
|
|
|
|
EnumChildWindows - The EnumChildWindows function enumerates the child windows that belong to the specified parent window by passing the handle to each child window, in turn, to an application-defined callback function. EnumChildWindows continues until the last child window is enumerated or the callback function returns FALSE.
|
|
|
|
|
In my main program, I am trying to create a Dialog, where along with the CFileDialog, I should also be able to have my active X. The trouble, I have is that the dialog doesn't show up ance I add the activeX. Without the Active X, It works O.K. Any suggestions would be appreciated.
I am following the example from David J. Kruglinski's Programming Microsoft Visual C++
Thanks in advance
|
|
|
|