|
I would like to add one more thing, when you do overlapped IO, you are responsible for keeping track of the file pointer and other things. When you do normal, or synchronous IO, the file pointer is stored with the HANDLE, or hFile that you create. AFter you read from a file the file pointer will automatically be updated to the end of where you read the data with normal IO, as opposed to you having to update the pointer yourself.
Good Luck.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I'll just add that if you read this file using an ifstream you'd probably find the code a lot simpler as well as safer.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Thankyou )
|
|
|
|
|
use classwizard. find your dialog item, add a handler for BN_CLICKED.
then use CButton::GetCheck to test the checked state
-c
There ain't no second chance
Against the thing with the forty eyes, girl
|
|
|
|
|
But eh thing is i'm not using MFC. I know that i should look for the WM_COMMAND code in the uMsg parameter and the control name IDC_ID3TAG in the wParam, but i don't know how to find out if it's checked or not.
|
|
|
|
|
Here's how:
long nResult = SendMessage (hwndCheckBox, BM_GETCHECK, 0, 0);
bool bChecked = (nResult == BST_CHECKED); /ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi!
Is there a better way to check whether the data in a clipboard has changed instead of checking the content every few seconds with a timer? Perhaps there is a kind of notification?
/edit: I just found the message WM_DRAWCLIPBOARD - is it what I'm searching for?
thanks in advance
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
From MSDN:
The WM_DRAWCLIPBOARD message is sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard.
|
|
|
|
|
how can i be able to display my custom Context Menu when i right-clicked in an EditBox instead of default EditBox context menu (Undo, copy, paste..etc)?
that would be really helpful for me...
Thanks for ur help
Atilla Selem
just listening to you...
|
|
|
|
|
try the edit control section of this site...
or... http://www.codeproject.com/useritems/cmenuedit.asp
-c
I don't care, and you can't make me.
|
|
|
|
|
Hi again,
Did you see Solitaire game(I'm sure you saw that !).
I want to know, how can drag and drop pictures like that ?
Please help me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi,
I had to do the same thing about a year ago for my card game and it works great:
(UltraUno -- http://www.outreach4him.50megs.com/UltraUno/ -- yes, this is a plug! )
I found Chris Maunder's article on bitmap controls very useful, but it looks like the link is broken (not sure who I would notify to fix it):
http://www.codeproject.com/bitmap/bitmappicture.asp
His control is derived from a CStatic, and the way I did the drag and drop stuff is to create one CBitmapPicture controls in the view and use the WM_LBUTTONDOWN to see if the user clicked the bitmap control. I set a flag and then track the WM_MOUSEMOVE messages and move the bitmap around based upon the initial coordinates and the current coordinates. When the WM_LBUTTONUP msg is received, I release the capture on the bitmap control.
If needbe, I can e-mail you a code sample directly...
Chris
|
|
|
|
|
Hello Chris, Thanks aloooooooooooot for your help
I see your game, that was prefect ...
YES, i'm intrested to have your source code.
If possible please send it to hadi_rezaie@yahoo.com
Thx aloooooooooot !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
OK, I'm relatively new to ATL/ActiveX/COM.
We have an MFC application (CView and CDialog usage) built with VC++6 SP5.
I am in the process of creating an ActiveX control (via ATL) that will be used by this application, but I'm having a problem.
I can insert the control onto the template in the resource editor and it shows up. I run the application and the control functions properly. But I need to have access to the interface of that control.
I used:
CAxWindow m_axTheControlWindow;
CComPtr<ITheControlInterface> m_ctlTheControl;
CWnd* pControl = GetDlgItem(IDC_THECONTROLID);
if (pControl)
{
m_axTheControlWindow.Attach(pControl->GetSafeHwnd());
hr = m_axTheControlWindow.QueryControl(&m_ctlTheControl);
if (FAILED(hr) || !m_ctlTheControl)
{
ATLASSERT(false);
}
}
but QueryControl returns E_FAIL and m_ctlTheControl is NULL.
I guess it has something to do with how MFC keeps track of OLE controls (COleControlContainer) ???
Perhaps the only way I could communicate with this control would be via IDispatch?
The control was create via the VC++ Insert | New ATL Object... wizard. It's a Full Control (Single Threaded, Dual interface, No aggregation, Support ISupportErrorInfo, support connection points, not based on another control, normalize dc, insertable, opaque, solid background, no stock properties).
Now, this is just the bare-bones wizard code. Nothing has been implemented as far as IDispatch or ISupportErrorInfo or connection points beyond what the wizard gives, but I didn't want to go too far before finding out it wasn't going to work.
Thanks for any help.
Gil
|
|
|
|
|
OK, now that this is buried deep it probably won't be seen, but a co-worker of mine has helped me figure this out.
CWnd* pControl = GetDlgItem(IDC_THECONTROLID);
if (pControl)
{
pControl->EnableAutomation();
IUnknown* pUnk = pControl->GetControlUnknown();
CComQIPtr<ITheControl> pIFace(pUnk);
if(pIFace)
{
pIFace->AControlMethod(value);
}
}
|
|
|
|
|
Hi !
I started to develop an ATL object with VC++ 6.0. The COM object is a DLL, supporting the MFC.
In some particular situation, I need to display a dialog box. I created a new class, derived from CDialog, as I usually do with a normal MFC application (Let's call this class CTestDlg).
In the ATL class, I added a member of type of my dialog class (CTestDlg m_myDialog), and when I want to display it, I do : m_myDialog.DoModal();
When I run this COM object, at the moment of displaying the dialog, I get an ASSERT error. In the debugger, the failed assertion is :
ASSERT(afxCurrentResourceHandle != NULL)
which is called in the function CDialog::OnInitDialog()
I'm now wondering if a COM Dll is able to display a dialog box, and if yes, how I'm supposed to do it !!!
Any help will be greatly appreciated !
Thank you !
Jerome
|
|
|
|
|
yes, it's possible to do this (i do it all the time).
1. where are you calling DoModal ? (don't do it in the ATL object's constructor)
2. are you using that little MFC context macro (forget what it is, but you see it at the top of methods that use MFC...) ?
-c
I don't care, and you can't make me.
|
|
|
|
|
Chris Losinger wrote:
1. where are you calling DoModal ? (don't do it in the ATL object's constructor)
From a method which is part of my interface.
2. are you using that little MFC context macro (forget what it is, but you see it at the top of methods that use MFC...) ?
...mmm....nope, I didn't find any context stuff....
Jerome
|
|
|
|
|
Chris is refering to the AFX_MANAGE_STATE(AfxGetStaticModuleState()) macro that gets added to ATL method when added thought the Class View add method option. This is needed so the application looks at the right resource table when executing the ATL methods. If your ATL object is using its own resources (dialogs, bitmaps, cursors, etc.) you must call the manage state macro.
Hope this helps...
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
Ok....I'm making some progress.
I have this AFX_MANAGE_STATE in each of my methods of my interface.
I figured out what I was doing wrong. I tried to display a dialog box, derived from CDialog.
Now, I used the 'Insert ATL Object->Miscellaneous->Dialog' to create my dialog.
I have a problem remaining though : I have a CListBox in my dialog box, and when I do
CListBox* pList=(CListBox*)GetDlgItem(IDC_LIST);
it works, but then, when I do
pList->AddString("Test");
I have an ASSERTION failure.
Do you have any idea how I could use the ListBox control (and any other controls ?)
Thanks !
Jerome
|
|
|
|
|
hi,
I want to get the index of the element clicked in a tree.I can get total elements but can I get the index or relative position of the element I clicked?It may be even in the child nodes.
I have figured out a way but it seems too complicated so wanted to check first; but again it may be how the function would have operated if existed,I dont know.
So,can I?
Sorry about the premature entry
waiting.
|
|
|
|
|
Nope, there is no index in CTreeCtrl. You can only enumerate thru items and count them manually
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
A method would be to store an index in the items data: SetItemData. Then when you need: GetItemData.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
hi,
I want to get the index of the element clicked in a tree.I can get total elements but can I get the index or position of the element I clicked?
|
|
|
|
|
CTreeCtrl::GetSelectedItem
-c
I don't care, and you can't make me.
|
|
|
|