|
Thanks for your helps,
Your helps is useful for me, always
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
The article you reference tells you what to do.
"For an example of a kernel mode Windows NT device driver that allows user mode applications to access hardware ports, refer to the GENPORT sample provided with the Microsoft Windows NT Device Driver Kit (DDK)."
--
Where are we going? And why am I in this handbasket?
|
|
|
|
|
code :
void CreateConnetion(){
try{m_db.Open("xxxxx.MDB",FALSE,TRUE); }
catch(CDAOException *e){ .... }
}
void Open(CString Sql){
CloseQuery();
m_pRecordset = new CDaoRecordset(&m_db);
try{m_pRecordset->Open(dbOpenDynaset,Sql,dbReadOnly);}
catch (CDaoException *e) {
...
}
...
}
void CloseConnection(){
CloseQuery();
if (m_db.IsOpen()){
m_db.Close();
}
}
void CloseQuery(){
if (m_pRecordset->IsOpen()){
m_pRecordset->Close();
}
delete m_pRecordset;
}
.
Each time when I call CreateConnection and Open("SELECT * from [table]") the memory size increase. After time when i call CloseConnection the memory size doesnt decrease and app needs 5 MB (before creating connection had 4 MB).
{{i use this code :
CreateConnection();
Open();
CloseConnection();
}}
Is is alright ?
Wizard_01
|
|
|
|
|
Hi all,
I have a class (MyFunctions) with a function in that, i defined it as protected ...
I have 3 other classes, i wanna use of my function in MyFunctions class in thease classes !
How can i do that ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Protected functions can only be used by instances of the class or derived classes. To make a member function available for use by other classes, declare it public.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks for your reply,
Can you explain to me about friend functions ?
and How can i use of that ?
Other question,
What is this distructure:
virtual ~DClassName();
and what is difference with:
~DClassName();
???
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
A friend method (i.e. function) can be shared by specific classes (i.e. friends of the class). You can also declare friend members, and can even make an entire class a friend of other classes. See http://www.cee.hw.ac.uk/~rjp/Coursewww/CPPwww/friend.html for an explanation of C++ friendship.
Using a virtual destructor in class CMyClass ensures that it (the destructor) will be called when an instance of a derived object (eg: CMyDerivedClass : CMyClass) is destructed. Virtual destructors are executed in reverse order - i.e. the derived class destructor is called first, followed by the base class destructor. If you don't use a virtual destructor, destruction will stop in the derived class.
Imho, you should always declare destructors virtual, and design your classes such that anything constructed by a base class is destructed by that base class.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I'm using "PutFile()" and "GetFile()" to transfer files between a client and a FTP server.
How can I retrieve a progress of this operation (maybe a callback), to put the transfer progress in a ProgressBar ?
|
|
|
|
|
Windows XP has extremly annoying AutoPlay feature. For my application I need to turn it off completely for all drives. I already made next actions:
1) Set "Take no action" for all drives and all content types (Drive Properties - AutoPlay)
2) Handle QueryCancelAutoPlay registered Windows message and reply "No, thanks" for all content types, as described in http://msdn.microsoft.com/msdnmag/issues/01/11/autoplay/autoplay.asp
3) Set DWORD value AutoPlay to 0 in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom
4) Set DWORD value AutoPlay to 0 in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk
However, there is still one case when Windows XP opens Explorer for DVD disk. In some place in my program I format DVD RAM disk using format command-line utility (I run it using CreateProcess). After disk is formatted XP opens Explorer window for it. May be there are some other things to do with this (except using Windows 2000, NT etc.)?
|
|
|
|
|
Hi, i have a problem, there are a lot of interesting activex controls - but they are loaded dynamicaly (or not?) so i'm not sure if all the users will have them - can you help me - are there some activex controls that are installed on every win machine ? For example there is "Microsoft Forms Checkbox" (or socalled) is it available on every win-box ?
thanks a lot for explanation
john
|
|
|
|
|
Hi, All !!!
=======
why doesn't it work ???
void qwewDlg::OnButton1()
{
CPaintDC dc(this);
dc.Rectangle(20,20,200,200);
}
Is it because I must draw everything under WM_PAINT ???
Why ??
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
did u read the docs for the CPaintDC stuff?
maybe there are't any dc's available when u make the call?
why would you want to do direct drawing out of the OnPaint code anyways? there are times when it makes sense but they are generally very few and far between afaik
---
"every year we invent better idiot proof systems and every year they invent better idiots ... and the linux zealots still aren't being sterilized"
|
|
|
|
|
Maybe I'm just wondering ?
Maybe I wanna try things ?
Maybe I'm just curious ???
Maybe blah blah blah ?????
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
You can't create a paint DC outside of WM_PAINT.
In this case, just use a CClientDC. (I think, it has been a while since I have used MFC)
void qwewDlg::OnButton1()
{
CClientDC dc(this);
dc.Rectangle(20,20,200,200);}
}
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Thanks
It works.
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
One more thing...
this works:
void qwewDlg::OnButton1()
{
CClientDC dc(this);
dc.Rectangle(20,20,200,200);
}
but this doesn't work:
void qwewDlg::OnButton1()
{
CClientDC dc(GetDesktopWindow());
dc.Rectangle(20,20,200,200);
}
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
|
Sagiv wrote:
Is it because I must draw everything under WM_PAINT ???
Yes. Imho, the right approach is to:- Maintain a list of objects drawn by your program. When the user clicks Button1, create a new "MyRectangle" object and add it to your list. Then call Invalidate(). This will instruct Windows to send your window a WM_PAINT message.
- In your OnPaint() handler, walk the list of objects and draw each one.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Dear all,
Can I use "typedef" with "class" ? (For some reason, I want to use "class" CA instead of "struct"..so..)
I mean, if I wrote the following things:
class CA
{
// omit
};
typedef CA* LPA;
I always got compile error like this:
error C2040: 'LPA': 'class CA' differs in levels of indirection from 'void ** '
How can I correct this error ? Anybody help me ?
Thanks a lot !
|
|
|
|
|
In my original program, I wrote:
class CRGBImage
{
// omit
};
typedef CRGBImage* PHANDLE;
So, I always got a compile error...
But, when I modified this line "typedef CRGBImage* PHANDLE;"
to:
typedef CRGBImage* PRINTHANDLE;
Then, everything is OK !!
Is PHANDLE a "reserved word" for MFC or Win32 SDK ?
|
|
|
|
|
Well, since HANDLE is a Win32 type, I'd expect PHANDLE (and LPHANDLE) to be typedef'ed.
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
True. A search for PHANDLE in Edit/Find and Replace/Find in Files with include directories setting gives
WinNT.h(288):typedef HANDLE *PHANDLE;
FaxDev.h(190):typedef BOOL (WINAPI *PFAXDEVSTARTJOB) (HLINE,DWORD,PHANDLE,HANDLE,ULONG_PTR);
|
|
|
|
|
How can a person use ASP pages and VBScript in a client side application, instead of just using html pages?
Nothing is impossible, It's merely a question of figuring out HOW?
|
|
|
|
|
|
I have a dll that launches a window from it. I do not want people to see the window it launches, instead I want the paint functions to be redirected to a Static box that I will place in my application. Does anyone know what I should look up or have any idea how this can be accomplished? Any help is appreciated!!!
Nothing is impossible, It's merely a question of figuring out HOW?
|
|
|
|