|
Hello,
I get this error when my app is starting app
I have many dialog windows in a tab that loads and
I have tryed many things but I dont get it to word.
Is there a smart person that now what I can do to make this go away?
Here is the error I get;
ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
|
|
|
|
|
Larsson wrote:
Is there a smart person that now what I can do to make this go away?
Here is the error I get;
ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
In what function is that line of code? What file?
Make the debugger stop at that line when the assertion fails, and check the call stack to see what is being done that caused the assertion. Just as a wild guess, I suspect you are trying to access some control in a dialog before the dialog has been initialized (like trying to initialize a control in the dialog's constructor rather than in OnInitDialog).
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
No this is the first thing I do!
m_FunkDlg = new CFunkDlg;
m_FunkDlg->Create(CFunkDlg::IDD, &m_tabctrl);
m_tabctrl.AddTab(m_FunkDlg, "Set function", 2);
So I dont now what can hapend!
|
|
|
|
|
You are calling (either directly or indirectly) a method on a CWnd object or derived class. The implementation of that method expects to either be attached to some window (IsWindow(m_hWnd) ) or to be a COM object wrapper (m_pCtrlSite!=NULL ). The assertion is failing because at the time of that call, neither of those conditions is true.
Again, run it under the debugger. When you get the assertion message, click "Retry" or "Break" (I don't remember the exact button caption) so as to stop the debugger at the line where the assertion was written. Take note of what function the assertion is in. Take note of the call stack and see where the call to that function is coming from, back to some of your code. That should give you some hint of what is wrong. If you are unsure, post again, but provide some more information.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I am using C/C++, Visual Studio 6.0
I hsve created a Dialog-based app. I have several Dialog boxes each with it's own Class. When I have done this, VS nicely creates an OnInitDialog() function for each Class.
Somehow, on the last Dialog Box / Class that I created, the OnInitDialog() function did not show up.
Any help on creating an OnInitDialog(0 function would be greatly appreciated
Many thanks,
Robert
|
|
|
|
|
Robert Palma Jr. wrote:
Somehow, on the last Dialog Box / Class that I created, the OnInitDialog() function did not show up.
Any help on creating an OnInitDialog(0 function would be greatly appreciated
How about copying and adapting what you have in the other dialogs?
This is what you need:
1. Declare OnInitDialog as a member of your dialog class. Add it in the dialog header file (the .h file). It's something like this:
virtual BOOL OnInitDialog();
2. Provide an implementation for YourDialog::OnInitDialog(). Add it to your dialog implementation file (the .cpp file). Something like this:
BOOL YourDialog::OnInitDialog()
{
CDialog::OnInitDialog();
return TRUE;
}
That should be enough.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Many thanks Jose
|
|
|
|
|
More comfortably, use Class wizard and then select the class you created then add windows message WM_INITDIALOG. This will add the OnInitDialog() function in your class.
Work hard and a bit of luck is KEY to SUCCESS.
|
|
|
|
|
Many thanks Neelesh
|
|
|
|
|
Hallo,
my problem is that I have to read some data (that i generate by rand())and display it in the dialog with a gradient dots or circle(like if the value is low -white and high -red medium-gradient mixed color).
I made a group box and drawn a white rectangle back ground. But i dont know how to repeatedly put ellipses or dots in that space(with gradient).
I hope u people understand my query.
Please help me in this regard.
mfg,
kingsly.
|
|
|
|
|
If you use GDI+, you can create a gradient brush. Otherwise, SetPixel will do - just change the color gradually. A conversion to HLS will allow you to make the color brighter in a more logical way.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi all,
how can I add data to each MS Chart series during runtime?
Thanks in advance,
Marc Soleda
p.d: what happens with MS Chart?? I can't find documentation...
|
|
|
|
|
Hi everybody
I copied this example from a book on game MFC and it`s give me an error in the liking phase
Linking...
test.obj : error LNK2001: unresolved external symbol __imp__MessageBoxA@16
Debug/test.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
i know is probably something tedious
tks
B
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hprevinstance,LPSTR lpcmdline,int ncmdshow)
{
// call message box api with NULL for parent window handle
MessageBox(NULL, "THERE CAN BE ONLY ONE!!!","MY FIRST WINDOWS PROGRAM",MB_OK | MB_ICONEXCLAMATION);
// exit program
return(0);
}
|
|
|
|
|
The error means the compiler can't find the actual code for the function MessageBox. If you do a quick search for MessageBox on www.msdn.com you will see that to use this function you need:
Header Declared in Winuser.h, include Windows.h
Import library User32.lib
So you included Windows.h somewhere (otherwise you'd get a compile error) and in Project ->Settings -> Link you write in User32.lib.
Try that, I think it should work.
|
|
|
|
|
Hi ,
I have made a multithreaded application , Problem is that I want to know how many threads are right now in my application. As user can create as many threads as he wants, on every user request it creates a new instance of mythreadclass , which is inherited from CWinThread . And how to delete these threads when application finishes .
Thanks
ZINC !
HELLO
|
|
|
|
|
The CreateToolhelp32Snapshot function takes a snapshot of the specified processes in the system, as well as the heaps, modules, and threads used by these processes.
TH32CS_SNAPTHREAD - Includes all threads in the system in the snapshot. To enumerate the threads, see Thread32First . To identify the threads that belong to a specific process, compare its process identifier to the th32OwnerProcessID member of the THREADENTRY32 structure when enumerating the threads.
Use GetCurrentProcessId to get the process id for your program.
|
|
|
|
|
I am learning to use Visual Studio to write C++ programs. The last exercise I did from the book resulted in the message "error C2146: syntax error : missing ';' before identifier 'HwndMSWheel'". What am I doing wrong?
Help!!!
|
|
|
|
|
It's hard to guess from the info you provide. Post a code snippet and someone will probably be able to tell you what's wrong in it.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
This was an exercise to learn to create an application window. Here is the code, a very short program.
// EX13_01.CPP
// An elementary MFC program
#include <afxwin.h> // For the class library
// Application class definition
class COurApp:public CWinApp
{
public:
virtual BOOL InitInstance();
};
//Window class definition
class COurWnd:public CFrameWnd
{
public:
// Class constructor
COurWnd()
{
Create(o, "Our Dumb MFC Application");
}
};
// Function to create an instance of the main window
BOOL COurApp::InitInstance(void)
{
// Construct a window object in the free store
m_pMainWnd = new COurWnd;
m_pMainWnd->ShowWindow(m_nCmdShow); // .. and display it
return TRUE;
}
// Application object definition at global scope
COurApp AnApplication; // Define an application object
|
|
|
|
|
Anonymous wrote:
This was an exercise to learn to create an application window. Here is the code, a very short program.
But this isn't the file in which you were getting a compilation error, is it? You said the error was "error C2146: syntax error : missing ';' before identifier 'HwndMSWheel'" and I can't see HwndMSWheel anywhere in the code you posted...
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
How about:
COurWnd::COurWnd()
{
}
BOOL COurApp::InitInstance(void)
{
COurWnd *pMainWnd = new COurWnd;
m_pMainWnd = pMainWnd;
pMainWnd->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW, NULL, NULL);
pMainWnd->ShowWindow(m_nCmdShow);
pMainWnd->UpdateWindow();
return TRUE;
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi there...
I've been trying to print some graphics done with gdi+..
ForExample:
Graphics graphics(pDC->m_hDC);<br />
graphics.FillRectangle(&(SolidBrush(Color(255,2,90,50))),10,10,400,300);<br />
graphics.FillEllipse(&(SolidBrush(Color(100,255,255,100))),10,10,300,300);
On my screen it looks exactly like want it to...but when i'm trying to print it on our
HP1050C Plotter the alpha transparent areas were opaque..
Does anyone know this problem??
|
|
|
|
|
Probably a driver issue. Try drawing to a memory bitmap, then blitting this to the printer DC (assuming the printer driver supports blitting).
---------------------------------------- the ocean is full because everyone's crying
|
|
|
|
|
Yes, it's probably a driver issue...
But this just a little demo i wrote... actual i tested it for our GIS-Software...
and there i can't just draw it into a membitmap...the memory would blow up^^
btw. pls. excuse my bad english...)
|
|
|
|
|
Hi all,
I am using MS flex grid to show my application data. There is a point when I need to Input from the user so that I can proceed the working. What I am doing is I have placed an edit box control at design time. Then I get pointer to it using GetDlgItem. and then I am calling SetWindowPos function to display it on a specific cell of the grid. But the edit box do not get displayed.
My code looks like:
CEdit *m_pEditValue = (CEdit*) GetDlgItem(IDC_EDIT_VALUE);
m_pEditValue->SetWindowText("Displayed");
m_pEditValue->SetWindowPos(&wndTop,m_flexgrid.GetCellLeft(),m_flexgrid.GetCellTop(),m_flexgrid.GetCellWidth(),m_flexgrid.GetCellHeight(),SWP_SHOWWINDOW);
The program does not give any error but It does not show the edit box. I think it is behind the grid and that means &wndTop is not making it a topmost window.
Any suggestion please ?
Thanx in advance.
Ritu Kwatra
|
|
|
|