|
I'm using DAO (CDaoRecordset) on an Access database. I'm using Get/Set FieldValue using an ordinal position. In debug everything is fine. In release mode I get "Data Type Conversion" errors. It's happened on numeric and text fields - I know that the correct type/value is being get/set.
When I change the ordinal to an actual field name everything is fine.
|
|
|
|
|
Hi,
I'm using Dependency Walker 2.1.3790. It lists 5 types of dependencies: Implicit, Delay-load, Forward, Explicit, and System Hook. I want to know how they are related to the 2 types of Dynamic Linking: Load-time and run-time. Does the dependency type indicate which Dynamic Linking type is used?
Thank you for any help.
|
|
|
|
|
The simplest ones to explain are Implicit and Explicit. Implicit is where the binary's Import Address Table lists a particular function exported by a given binary (normally a DLL). This type of dependency is resolved by the loader when loading that binary and causes an error if not present. This is your 'load-time' case.
The Explicit case is where LoadLibrary has been used to load a DLL by the program or one of its DLLs. This can include loading COM DLLs (which you'll see grouped under OLE32.DLL, since that actually does the loading).
Forwarding is an advanced feature where a DLL can simply include a function in a different DLL in its exported function table. On Windows NT-based systems, some functions exported by kernel32.dll are simply forwarded on to ntdll.dll . This allows you to move functionality between DLLs without having to recompile the applications.
Delay-Load is another advanced feature which allows the application to get the benefit of run-time linking while having the convenience of simply calling the functions in code. If the function called is not present at run-time, a Windows SEH exception is raised. IIRC, this feature is used by MFC 6.0 and higher to reduce start-up time.
I'm not entirely sure how the System Hook type occurs.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I started on the below description and code and am trying to see if I can get any further. Does this look right?
lab.h
public class Point
{
friend ostream &operator<<(ostream&, const Point&);
friend istream &operator>>(istream&, Point&);
private:
double x;
double y;
String name;
public
Point();
Point(double a, double b);
Point(const Point& p);
//have to add methods to this class and add the operators +,-,++,--,<,>,==,=, operators
};
//I have to add 2 classes Rectangle and Oval
//Rectangle is to have a point included in it which represents the left corner of the
//Rectangle. It should also have a length and width data member
//create the correct methods and include a method named move which can have 2 forms
//from 1 move(Point p) which says move the current point to (x+p.x, y+p.y, form 2 is move
// (double x, double y) which says make the current point set to this.x,this.y
// have the values of x,y.
// Oval is to have a Point p which is its center and a radius and should also have a move
//which operates the same as the one in Rectangle.
public class Rectangle
{
friend ostream &operator<<(ostream&, const LPoint&);
friend ostream &operator>>(istream&, LPoint&);
private;
double l;
double w;
String name;
public; Move(Point p)
Move(double x, double y)
};
public class Oval
{
friend ostream &operator<<(ostream&, const CPoint&);
friend ostream &operator>>(istream&, CPoint&);
private;
double c;
double r;
String name;
public; Move(Point p)
Move(double x, double y)
};
does this look like it makes any sense?
Thanks
|
|
|
|
|
Hi.
I have a class, CMyClass, and I want to build an array of CMyClass.
Could I write something like this?.
i=0;<br />
CMyClass* myClass = new CMyClass[];<br />
myClass[i] = new CMyClass();
That throw the following error:
error C2582: 'CMyClass' : 'operator =' function is unavailable
I don't want to use some template array.
What I'm doing wrong.
Thank you.
|
|
|
|
|
Try:
CMyClass** myClass = new CMyClass[];
myClass[i] = new CMyClass();
John
|
|
|
|
|
Hi John.
Now throws:
error C2440: 'initializing' : cannot convert from 'class CMyClass *' to 'class CMyClass ** '<br />
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
I don't know what happend.
|
|
|
|
|
Sorry my fault:
CMyClass** myClass = new CMyClass*[NUMBER_TO_ALLOCATE];
myClass[i] = new CMyClass();
John
|
|
|
|
|
you don't need the second line...
all the cells of the tab will be automatically created with the default constructor...
your myClass[i] = new CMyClass(); is so redondant..
regards
TOXCCT >>> GEII power
|
|
|
|
|
No the first line creates an array of pointers to CMyClass and the second line Creates the object instance.
John
|
|
|
|
|
CMyClass* myClass = new CMyClass[]; don't mean nothing... how many bytes will be allocated ??
prefer that :
<font style="color:blue;">#define</font> TAB_SAZE 10 <font style="color:green;">// for example
</font>
<font style="color:blue;">int</font> i=0;
CMyClass* myClass = new CMyClass[TAB_SIZE];
<font style="color:green;"></font> <font style="color:green;">
<font style="color:green;">
</font>
I assume that you have the needed operators written, or that you will...
TOXCCT >>> GEII power
|
|
|
|
|
toxcct wrote:
/* myClass[i] = new CMyClass(); */ // not needed anymore. // each object is now initialized as the default constructor would do...
This was this line that throw the error (and so when you say this is not needed anymore, you'll have to say this CAN'T BE USED !).
In fact when you write:
CMyClass* myClass = new CMyClass[TAB_SIZE];
you are declaring an array of OBJECTS and not an array of pointers to object. So myClass[i] is an object and not a pointer !!
So this is totally wrong to write such a thing: myClass[i] = new CMyClass(); .
Hope this helps
|
|
|
|
|
Hi, i´d like to put and retreive to-from a LPBYTE variable data from a class, like
class A
{
int a;
double b;
LPBYTE GetStream();
} void SetStream(LPBYTE lpData, DWORD dwLen);
...
A class1,class2;
LPBYTE stream = class1.GetStream();
class2.SetStream(stream)
Qhris!
|
|
|
|
|
How does one go about opening a file that is located in the directory of the executable without using any code that is OS-dependent (not microsoft functions)?
(The user could be in a directory different from where the executable is located, and run that executable, which opens a file in the directory where the executable is located.)
Thanks!
|
|
|
|
|
In standard C, I am prertty sure that the argv[0] command line argument to main usually has the full path of the executable file. Strip off the program's file name, you are left with the path to folder where exe is located.
|
|
|
|
|
Okay, "HOW TO: Write an Applciation That Supports Fast User Switching in Windows XP".
Yep, another technically accurate but totally worthless document from Microsoft
Statements like "Block any problematic features' are useless. Well, what could I expect to be problematic? If I blocked the user from switching, the app would work fine.
So, now that I have the session switch notifications in the program and I get WTS_SESSION_LOCK and WTS_SESSION_UNLOCK, what kinds of activity should I PREVENT while the session is locked?
My program is actually returning ACCESS DENIED (GetLastError = 5) on a call to the Rectangle(HDC, int, int, int, int) GDI function!
And of course, they have the classic 'FindWindow' example of locating an existing instance..
Any worthwhile ideas?
|
|
|
|
|
Will UrlDownLoadToFile() works fine when used from a NT Service application running under System account.
As far as i know this function uses IE settings to download URLs. So i am afraid whether Local System account will be able to access IE settings ?
|
|
|
|
|
i am trying to update a record for which i create a new query example:
CDatabase DB;<br />
<br />
<br />
CString sAddress;<br />
sAddress = _T("11 pivot drive st'micheals");<br />
<br />
<br />
CString sSQL<br />
sSQL.Format(_T("Update TableNameHere Set Address='%s'),sAddress);<br />
<br />
DB.Execute(sSQL);
since the string sAddress contains a ' character in it the query wont execute.
do i have to replace ' with \' or is there any other way outta this
thanks
|
|
|
|
|
Modify your routine to escape the ', which consists of doubling them.
Ex:
11 pivot drive st'micheals
becomes
11 pivot drive st''micheals
NOTE: Don't use the " character !
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
I want use Timer in my Service prog,and add this code:
SetTimer(NULL, 0, 1000, Timer2);
Timer2 is a function name in my deifned Class.but when the prog compile,it shows that :error C2664: 'SetTimer' : cannot convert parameter 4 from 'void (struct HWND__ *,unsigned int,unsigned int,unsigned long)' to 'void (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,unsigned long)'
who can tell me:what is my problem?
class CServiceWnd : public CWinThread
{
void CALLBACK Timer2(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime);
int m_Timer2;
..................
}
void CALLBACK CServiceWnd::Timer2(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime)
{
if(Createsocket())
{
KillTimer(NULL,m_Timer2);
}
}
void CServiceWnd::OnClose()
{
...................
m_Timer2=SetTimer(NULL,0, INTERVAl,Timer2);
}
|
|
|
|
|
Your timer callback function should either be a static member function or a global function. If you want to use a nonstatic member function as a calback then you have to jump through a few hoops. See http://www.codeproject.com/cpp/SoloGenericCallBack.asp[^] for details.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Timer32() should not be a member of the CServiceWnd class. That's why it does not match the required prototype. The this pointer is getting in the way.
One solution would be to pass NULL as the third parameter to SetTimer() , and then provide an OnTimer() function of your CServiceWnd class. From there, you can call CreateSocket() , etc.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I got a program running in multiple processes on the same machine and all of them are writing to the same log file.
I want to make sure that they are not trying to write to the log at the same time.
And need some sort of locking or criticalsection type of thing that works over different processes.
Any one got any tips?
|
|
|
|
|
|
You probably want it to be a named mutex unless your log code is in a common dll and you have declared the mutex in a shared section.
John
|
|
|
|