|
I want to write a program to login win98 !
But before User can login I must block win98 explorer.exe !
How can I do it ?
Thanks everybody !
Bob
|
|
|
|
|
I want to write a program to login win98 !
But before User can login I must block win98 explorer.exe !
How can I do it ?
Thanks everybody !
Hong Bob
|
|
|
|
|
Hi,
I want to know how can I save all the contents of a CListCtrl and how Reload it when the program restart?
plz reply here : mpblaze@iquebec.com
BLaZe
|
|
|
|
|
You'll have to iterate through using GetItemText(. . .) to retrieve each one. Just like you did to set the individual items
and subitems when you initialized it.
Hope this helps.
Best Regards
|
|
|
|
|
PLease can you send me a little source with only these 2 function
- Write CListCtrl to a file
- Read CListCtrl from the file
plz if you have time
TIA
BLaZe
|
|
|
|
|
i am developing a MS-PAINT like application and i have a class derived from
CScrollView
Now everything works fine as long as i draw Lines /Rectangles etc. but when
i want to enter Text , i am unable to do so directly on the screen , i want
to display a blinking cursor when the user enters the text within a
specified region
(just the way text is entered in MS-PAINT)
someone please help me
--mayank
===========;)
|
|
|
|
|
Good luck. You need to display a caret, move it, disply the text you enter, etc., etc., etc.
At the end of the day, their way sucks anyhow. I thought of doing something similar, excepting that I'd make the box moveable, but why would you ? You type a bit, resize your box, type a bit, decide it's not in the right position, delete the box, start again..... My paint program does it with a modeless dialog - you can select font, select pitch, select text effects, and enter text into a RichEdit, then the text becomes a tool that you can move about, and click to stamp it where-ever you like, as often as you like. It's intuitive and easy to use, unlike Paint *or* Paint Shop Pro ( the last version I used was 5, but I *never* figured out the text tool ).
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Does every call to CString::GetBuffer() have to be matched to a CString::ReleaseBuffer() call? In particular, when a GetBuffer() call is used as a parameter to a function i.e.
nRet = SQLTables( hStmt, NULL, SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS,
(unsigned char *)strType.GetBuffer( 0 ), SQL_NTS );
strType.ReleaseBuffer(); // Necessary
What effect will not calling ReleaseBuffer() in the above example have? Memory leak or just problems with other CString member calls prior to ReleaseBuffer() being called?
Thanks!
|
|
|
|
|
When you call GetBuffer(), you are responsible for managing the character buffer. Calling ReleaseBuffer() tells CString that it can take over memory management again. If you don't call ReleaseBuffer() but do call some method that would normally make CString reallocate and grow the buffer, it'll likely fail.
Also, the MFC docs on CString::GetBuffer() say this:
If you use the pointer returned by GetBuffer to change the string contents, you must call ReleaseBuffer before using any other CString member functions.
--Mike--
http://home.inreach.com/mdunn/
All your base are belong to ME~!
|
|
|
|
|
you can get more info on this in CP Article.
http://www.codeproject.com/string/cstringmgmt.asp
|
|
|
|
|
Does anybody know if there is a common or wellknown behaviour why an
MFC-Application works flawlessly in DEBUG-Mode and suddenly when compiled
in RELEASE-Mode throws the unhandled exception 0x00000005:Access violation???
Manfred
---
Programming is knowing...
|
|
|
|
|
We're working through a couple of similar bugs here right now, and this URL
http://codeguru.earthweb.com/debug/ReleaseMode.shtml
is full of good advice. One other thing you can do is change TRACE to OutputDebugString, and you'll get tracing in release mode.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Thanks Chris - it's once again YOU to help me (try to) out of a problem.
OnPaint() is working now as it is supposed to...
Also thanks to all the other Gurus: 'Funky' Erik (Funkenbusch) and Lauren (I like the
colours of your homepage)...
The unhandled exception 0x00000005:Access Violation occurs in a WIN callback-function.
When I open some MIDI-Input with
midiInOpen(&hMidiIn, CurInDevice, (DWORD)MyCallback, NULL, CALLBACK_FUNCTION); The 3rd parameter is the address of a callback-function which is called by the
Midi-Device-Driver everytime a MIDI-Event has arrived its input.
The callback works as follows:
void CALLBACK MyCallback(HMIDIIN hMidiIn, UINT wMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
{
int iResult;
switch(wMsg)
{
case MIM_DATA:
{
iResult = Zones->PostMessage(WM_MIDIEVENT);
ASSERT(iResult);
break;
}
case MIM_MOREDATA: break;
case MIM_OPEN: break;
case MIM_CLOSE: break;
default:
ASSERT(0);
} So the callback only posts a userdefined message
#define WM_MIDIEVENT WM_USER+100 to my Dialog. The MessageMapEntry
ON_MESSAGE(WM_MIDIEVENT, OnMidiEvent) is for now just a stub - doing nothing...
void CZones::OnMidiEvent()
{
} When the first MIDI-Event arrives everything works fine, but as soon as the second
event drops in I may not move the mouse over the System-Menu or click the Dialog or move
over a checkbox in the dialog. As long as I don't move the mouse I can play as many notes
as I want...
BTW: When the Dialog is minimized everything works flawlessly too. But I only have to
right-click into the task-bar.....EHHHHHH
No context-menu for maximizing or closing - just my unhandled exception 0x00000005:ACCESS-VIOLATION
Any Ideas on that ?
The exception appears on two machines exactly at the same address.
In DEBUG-MODE everything works brilliant, no latency (MIDI-delays) no MIDI-drones (sounding
till you shut down your system) - no really professional...
Manfred
---
Programming is knowing...
|
|
|
|
|
I followed your advice, Chris - and went to your CodeGuru link.
http://codeguru.earthweb.com/debug/ReleaseMode.shtml
There was one comment by Kelly Beyer: 'Incorrect Message Map Function Signatures'
which referred to a MSDN-KnowledgeBase article.
http://support.microsoft.com/support/kb/articles/Q195/0/32.ASP
So I changed the handler macro of my User-defined message from
afx_msg void OnMyMessage(void); to
afx_msg LRESULT OnMyMessage(WPARAM, LPARAM);
And my handler-function from
void MyDialog::OnMyMessage(void); to
LRESULT MyDialog::OnMyMessage(WPARAM, LPARAM);
And now it works.
In all my books showing how to write User-defined messages it is done the wrong way.
No explanation that the signatures have to be exactly like the ones above. They all
used 'void' instead - and as, when being a beginner, you seldomly switch to release-mode
you never realize that there is a little bug in your application. And when you do
it once than you'll never find out when this bug silently came into your app.
Though it's hard to put the blame on a User-defined message that worked for months in DEBUG-MODE.
Believe me: You would take everything else under consideration before this...
But at least I think it is a very bad behaviour that the compilor doesn't give you
at least a warning when working in DEBUG-MODE (I'm only working in 'Warning-Level 4').
I would never have found the bug in my app without that articles on the net.
There is one little question still bugging me as I got a little paranoid now.
Do you think that this is the real solution to my problem or is it just a temporary
workaround that is hiding another surprise for me now for the future???
Does it sound like 'there must be something else' to you ???
Thanks again for your help - this time a hit, not only a try...
Manfred
---
Programming is knowing...(and having better friends than the MicroSofties)
|
|
|
|
|
Yes, i believe it. This bug used to catch me all the time. Now i've learned to always do ON_MESSAGE handlers the LRESULT way.
there is a "ON_MESSAGE_VOID" message handler, but i've never used it and i don't know if it will help. (from Afxpriv.h)
#define ON_MESSAGE_VOID(message, memberFxn) \
{ message, 0, 0, 0, AfxSig_vv, \
(AFX_PMSG)(AFX_PMSGW)(void (AFX_MSG_CALL CWnd::*)(void))&memberFxn },
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
hey guys,
Is there a performance issue in using a CStatic::SetBitmap() to display Bitmaps? I mean it is so much easier that messing around with device contexts ans BitBlt's. I suspect there is a penalty because life is never easy. BTW, I am having massive resource issues using this method for displaying a lot of bitmaps. Am i correct in assuming this?
thanx for any input you may have
"DWORD my man!"
|
|
|
|
|
Hi
I'm trying to use the system image list through CImageList::Attach, buth without success. I can see in CImageLists' destructor that the attatched imagelist is destroyed when the CImageList object is destroyed. This isn't very appropriate, since 98 can't handle this. It results in an environment without icons. However, on 2k, everything is fine. Anyone knows how to solve this?
|
|
|
|
|
You're forgetting to detach your CImageList object from the system image list before the object is destroyed.
--Mike--
http://home.inreach.com/mdunn/
All your base are belong to ME~!
|
|
|
|
|
No, I'm not. If you look in ~CImageList, you will see that the imagelist is automatically detached. If you look in CImageList::Detach(), you will also see that the imagelist is destroyed when detaching, conclusion: shouldn't detach.
|
|
|
|
|
If you look in CImageList::Detach(), you will also see that the imagelist is destroyed when detaching
That is incorrect. Here's Detach():
HIMAGELIST CImageList::Detach()
{
HIMAGELIST hImageList = m_hImageList;
if (hImageList != NULL)
{
CHandleMap* pMap = afxMapHIMAGELIST();
if (pMap != NULL)
pMap->RemoveHandle(m_hImageList);
}
m_hImageList = NULL;
return hImageList;
}
There's no call to ImageList_Destroy() there. Compare with CImageList::DeleteImageList(), which is called from the CImageList destructor and does call ImageList_Destroy().
--Mike--
http://home.inreach.com/mdunn/
All your base are belong to ME~!
|
|
|
|
|
now, I can create button at run time, then I have some function for each button when it clicked. How can I get the message ???
I catch it at PreTransletMessage(), like so :
BOOL CTestDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message = BM_CLICK)
{
MessageBox("Y");
}
return CDialog::PreTranslateMessage(pMsg);
}
but, seem not correct ???? plx tell me , thanks ....
Regards
Vistac ...
|
|
|
|
|
Hello, the codegurus around the world.;)
First of all, even though you creates the button at run time,
you can use Message Map to catch the button click message as long as
we know ID of the button, I think.
Second, if we use PreTranslateMessage function, we can check the current input focus
control or which control sends the message to the parent.
That is, if (pMsg->hwnd == GetDlgItem(ID_BUTTON)->GetSafeHwnd( )) works since
the button clicked must send the message to the parent.
or if (pMsg->hwnd == GetDlgItem(ID_BUTTON)->m_hWnd)....
The button clicked have the current input foucs.
so, if (GetFocus() == GetDlgItem (ID_BUTTON))....
However, I didn't check my old code, so...?
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Hello, the codegurus around the world.;)
I make a simple test.
BOOL CButtonDlg::PreTranslateMessage(MSG* pMsg)
{
if ((pMsg->message == WM_LBUTTONDOWN && pMsg->hwnd == GetDlgItem(IDC_BUTTON1)->GetSafeHwnd())
|| pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN &&
pMsg->hwnd == GetDlgItem(IDC_BUTTON1)->GetSafeHwnd())
TRACE ("Click or push the button");
return CDialog::PreTranslateMessage(pMsg);
}
</br>
These codes pick up the message if we click the button by PreTranslateMessage.
However, if we use MessageBox rather than TRACE, I got the strange behavior.
Window message stream is more difficult than I expect..
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
I would override OnCommand virtual function
CTestDlg::OnCommand(WPARAM wParam, LPARAM lParam)
{
if (HIWORD(wParam) == BN_CLICKED)
{
if (LOWORD(wParam) == myButtonID)
{
MessageBox("Y");
return TRUE;
}
}
return CDialog::OnCommand(wParam, lParam);
}
---
Multitasking: Screwing up several things at once.
|
|
|
|
|
Does anyone know where I can find GOOD DirectX 8 (C++) information, books, tutorials, etc. that go beyond spinning a cube in space ?
Thanks,
Thierry
|
|
|
|
|