|
So is the #include "resource.h" line missing/misplaced (as I mentioned in my original reply)?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
#include "resource.h" is set in the main dialog *.h file
like this;
// NetEye.h : main header file for the NETEYE application
//
#if !defined(AFX_NETEYE_H__B769970B_B16E_4786_8362_1DEB876E5438__INCLUDED_)
#define AFX_NETEYE_H__B769970B_B16E_4786_8362_1DEB876E5438__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CNetEyeApp:
// See NetEye.cpp for the implementation of this class
I don't have it in the dialog *.h file that makes the error.
|
|
|
|
|
Larsson wrote:
I don't have it in the dialog *.h file that makes the error.
Try adding it.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
He he he ,
Well it works thank !)
|
|
|
|
|
i have this class :
using System;<br />
using System.Windows.Forms ;<br />
using System.Data.SqlTypes ;<br />
using System.Data ;<br />
using System.ComponentModel;<br />
<br />
namespace WindowsApplication1<br />
{<br />
public class DateTextBox : TextBox<br />
{<br />
<br />
public DataSet1 myDataSet ;<br />
<br />
private SqlDateTime m_dateValue ;<br />
[Bindable(true)]<br />
public SqlDateTime DateValue<br />
{<br />
get{return m_dateValue;}<br />
set{m_dateValue=value ;}<br />
}<br />
<br />
public DateTextBox()<br />
{<br />
}<br />
}<br />
}
when i want to bind DateValue property of above class to SqlDateTime like this :
dateTextBox1.DataBindings.Add("DateValue",dataSet11.stud,"date1") ;
this runtime error display :
An unhandled exception of type 'System.InvalidCastException' occurred in mscorlib.dll
Additional information: Invalid cast from System.DBNull to System.Data.SqlTypes.SqlDateTime.
please help ,please.
|
|
|
|
|
TehMedic wrote:
Additional information: Invalid cast from System.DBNull to System.Data.SqlTypes.SqlDateTime.
Based on that error message my first guess would be you have NULL values in your table which cannot be cast to SqlDateTime values.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
yes.
when i add a new line, default value in all of fields of table will be DBNull value.
|
|
|
|
|
I am writing an app that has a property sheet and a few property pages. All of the property pages have a list control in them. The app scans through log files and adds the lines found to one of the various property pages list controls. The problem I have is that the app crashes if I havent actually clicked the tab to call initdialog. Yet if I try and do a create in the main applications initdialog then it crashes as well.
Here is basically what I have
m_pPropertySheet = new CPropertySheet("Some sheet");
m_pSomePage = new CSomePage();
m_pPropertySheet->AddPage(m_pSomePage);
m_pPropertySheet->Create(this,WS_CHILD,NULL);
m_pPropertySheet->ShowWindow(TRUE);
if I try create on m_pSomePage then it crashes later on as I try to view it so I am confused at how to initialize it and the list control before someone clicks it which then forces the initdialog to finally be called.
|
|
|
|
|
What's the difference between Multi-threaded and Multi-threaded DLL?
Also, in VS.Net, I can set the project properties to multi-threaded,
C/C++ -> Code Generation -> Runtime Library: multi-threaded.
If I set it there, am I creating an application that is multi-threaded?
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
I have to assume you are talking about the CRT linkage specification.
If it doesn't say dll then you are statically linking to the CRT library.
If it does say dll then you are dynamically linking to the CRT dll.
If it says multi-threaded then you are linking to a thread safe version. This version will allow you to have two threads call a CRT function that is not normally thread safe due to global state information e.g. strtok. The thread safe version allocates thread local state memory for these functions, but obviously introduces more overhead.
Alex Ngai wrote:
If I set it there, am I creating an application that is multi-threaded?
No. If you create more than one thread then you are creating a multi-threaded application. If you do this you will likely want to link against a mutli-threaded CRT.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hi CMK,
I still don't understand what is the difference between
multi-threaded and multi-threaded DLL.
Okay, it is a win 32 project, which contains 4 more projects
inside that project. Those 4 projects each create an DLL file
that is going to be used by an executable created by that project.
So, the big picture is like this:
project.exe, a.dll, b.dll, c.dll, d.dll
You said that if it doesn't say multi-threaded DLL, then I
am statically linking to the CRT library. And if it does say dll
then I'm dynamically linking to the CRT dll.
What does that mean?
In a project like I mentioned above, should I set all four DLL files
to multi-threaded DLL?
Another un-related question:
In your profile, you said you've been using C++ since 89, and you
said there was no STL, exceptions or template. Could you tell me,
were they parts of C++ specification back then? Or just no
compilers supported yet?
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
For your situation you will likely want to use the multi-threaded dll for each of your 5 projects. If you use a non-dll option then each module (exe and each dll) will have been statically linked to the CRT library.
Each module is unaware of the others and therefore initializes its own CRT state. For example, each will initialize a heap to be used by alloc/free. So, if a.dll alloc()'s some memory that memory will come from a.dll's CRT heap. If you then call free() on the memory in project.exe you will get an error as project.exe is trying to free in its CRT heap. This is also true for one module using fopen() and another trying to use the handle - boom.
If you specified that you want all modules to link to the CRT dll then the dll is only initialized once and all your modules will use the same heap. Memory allocated by one can be freed by another.
Unless i have a specific reason to do otherwise i generally link to the CRT multi-threaded dll.
Alex Ngai wrote:
In a project like I mentioned above, should I set all four DLL files
to multi-threaded DLL?
And project.exe as well. ALL have to link to the CRT dll. Having just one that is statically linked will create another CRT state, with the aformentioned problems.
Alex Ngai wrote:
... there was no STL, exceptions or template. Could you tell me,
were they parts of C++ specification back then? Or just no
compilers supported yet?
I don't remember there being STL at all. Exceptions and templates had prelim spec's (if i remember right) but i don't remember any compilers supporting them (Borland, Watcom, Zortec).
... did a quick check (http://computing.unn.ac.uk/staff/cgar1/cpptext/node4.html)
- AT&T C++ translator 1.0 released to the public in late 1985.
- Commercial compilers began to appear in 1988, Zortec and GNU
- C++ moved into the mainstream of programming languages with Release 2.0 in June 1989
Major manufactures provide C++ products for their platforms. Borland release a Turbo C++ Compiler.
- ANSI C++ Committee formed in late 1989.
They approved templates and exception handling.
- In late 1991 template implementations were provided by Borland and by AT&T/USL Cfront Release 3.0. Others soon followed.
- At the moment (1993) no implementations supporting exception handling are available.
So, i was more or less right. It also explains why i sometimes use templates, but never exceptions - template support was added early enough that i hadn't become too set in my ways.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
CMK wrote:
And project.exe as well. ALL have to link to the CRT dll. Having just one that is statically linked will create another CRT state, with the aformentioned problems.
Alex_Ngai replies:
That means I should set all of them to Multi-threaded DLL? However,
project.exe is not an DLL, should I set it to Multi-threaded DLL?
As you mentioned CRT, could you explain a little bit about CRT? Is
it something specific to .Net platform? I'm creating Win 32 application,
using Platform SDK, am I also using CRT? Note, I'm not creating .Net
Win application, so it is written in Win 32 API, not in managed C++.
Am I still utilitizing the CRT?
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
Alex Ngai wrote:
That means I should set all of them to Multi-threaded DLL? However,
project.exe is not an DLL, should I set it to Multi-threaded DLL?
Yes. What you are specifying, for each project exe or dll, is how you want to access the CRT functions.
CRT stands for C RunTime library. As Peter mentions, it is where all the standard C functions are e.g. fopen(), malloc(), free(), strcmp(), ... If you use any of these C functions then you will need to link to the CRT. It is possible to use similar functions provided by Win32 and not use any CRT function, in which case this whole conversation is moot.
All the mutli-threaded issues arise because it wasn't an issue when C was being developed and so the CRT functions weren't developed to support MT programming. To get them to support MT requires a bit of a hack - hence these linking options.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hi CMK,
Thanks for your reply. I also notice that setting
multi-threaded DLL would create smaller-size file
than multi-threaded. Could you explain why?
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
Alex Ngai wrote:
Thanks for your reply. I also notice that setting
multi-threaded DLL would create smaller-size file
than multi-threaded. Could you explain why?
The code for every function you call has to exist somewhere. When you statically link to the CRT you 'pull' in those C functions you use and make them part of your exe. When you dynamically link to the CRT those C functions stay in crtdll.dll.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hi CMK,
If those C functions stay in crtdll.dll, do the client users need
to have the crtdll.dll to run? Is it built in Windows? If the client
users do not have any compilers installed, will they be able to run?
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
Alex Ngai wrote:
If those C functions stay in crtdll.dll, do the client users need
to have the crtdll.dll to run? Is it built in Windows?
It is part of the operating system.
Alex Ngai wrote:
If the client
users do not have any compilers installed, will they be able to run?
Yes.
This is all fairly basic stuff. I would strongly suggest that you get some good books on C and C++ and first learn the languages before moving on to windows programming.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
There are two "flags" how to include run time libraries:
a) link to Single-Threaded, or Multi-Threaded libs
b) link to the .lib version (no runtime dependencies) or the .dll version (requires VC Runtime DLL's)
These two options can be combined freely, so "Multithreaded" is Multithreaded-Libs, and "Multithreaded-DLL" is, well, Multithreaded DLL's.
Note however, that the Lib vs. DLL settings of MFC must match the runtime library.
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
Hi Peter,
What do you mean? Multithreaded-Libs, and Multithreaded-DLL?
I'm not linking to a .lib, I'm talking about the project
properties setting, where in C/C++, Code Generation, there is
a setting of Single-threaded, multi-threaded, and multi-threaded
DLL.
By the way, if I'm linking to .lib, I'm utilitizing the runtime
dependencies, am I right? Sorry, I'm really just started in Windows
programming, you have to forgive my lack of knowledge.
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
You are (almost) always linking to a library: the C/C++ Runtime Library.
This library implements all the functions from the C/C++ standard library, such as strlen, malloc, etc. They come in two flavors: threadsafew or not, and a static library or as DLL.
Alex Ngai wrote:
you have to forgive my lack of knowledge
No need to apologize for trying to understand
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
I have a project that was originally built in Visual Studio C++ 6.0. I have since upgraded to Visual Studio .NET and am encountering a link problem. The project is a (non-ATL generated)COM server that also employs templates that is built across 2 projects. The base class("PluginServ") implements the DllCanUnloadNow, DllGetClassObject, DllRegisterServer, and DllUnregisterServer. The .def file is in the aggregated class ("DerivedPlugin") project and declares the above exports.
The link error is the following:
------ Build started: Project: DerivedPlugInServ, Configuration: Debug Win32 ------
Linking...
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
DerivedPlugInServ.def : error LNK2001: unresolved external symbol DllRegisterServer
DerivedPlugInServ.def : error LNK2001: unresolved external symbol DllUnregisterServer
.\Debug/VPF.lib : fatal error LNK1120: 2 unresolved externals
LINK : fatal error LNK1141: failure during build of exports file
Build log was saved at "file://c:\projects\src\DerivedPlugInServ\Debug\BuildLog.htm"
DerivedPlugInServ- 4 error(s), 1 warning(s)
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped"
Anyone have any ideas as to how I may resolve this link error? I have looked online and have not come across a solution.
Thank you!
|
|
|
|
|
Jnewg5 wrote:
The base class("PluginServ") implements the DllCanUnloadNow, DllGetClassObject, DllRegisterServer, and DllUnregisterServer.
So your definition of DllRegisterServer is PluginServ::DllRegisterServer , ie. it resides inside a class? These functions must be global, ie. not in a class, and they must be defined as __declspec(dllexport) . Other than that, you'll have to give a bit more information.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
I need to implement code that detects a RegistryChangeEvent, but I haven't been able to figure out how to do this. Any ideas?
Royce
|
|
|
|
|
DO you want to know which changes were made in which key or just you want to know that something is changed?
The first is really difficult the second is easy... (I have the code for the second... I can post)
Well... I am a beginner ...
|
|
|
|
|