|
You cannot insert data into a file on disk.
You will need to create a new file, delete the old file and then rename the new file to the old filename.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Padmanabha_M wrote: How to accomplish this??
By reading the data into some sort of data structure. Add to that data structure as necessary. Write the data structure to disk. Use Superman's suggestion for the rest.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
In my program i got a few edit control box in my dialog. I want when the user click on each edit control box , it will auto highlight the text inside.
After search the forum and msdn i find that SetSel function can done this task. But after i try, it still cannot do what i want to do..
BEGIN_MESSAGE_MAP(CPropErythemaScore, CPropertyPage)
ON_WM_SETFOCUS()
ON_WM_KEYDOWN()
ON_WM_KILLFOCUS()
ON_CONTROL_RANGE(EN_KILLFOCUS, IDC_dELL0, IDC_dEUL4, OnEditKillFocus)
ON_CONTROL_RANGE(EN_SETFOCUS, IDC_dELL0, IDC_dEUL4, OnEditSetFocus)
END_MESSAGE_MAP()
void CTry::OnEditSetFocus(UINT unID)
{
((CEdit*)GetDlgItem(unID))->SetSel(0,-1);
}
any advices?i waiting for your reply..Thank you
|
|
|
|
|
When you click inside an edit control, the control first receives WM_SETFOCUS message and then receives the WM_LBUTTONDOWN message. Since you're highlighting in the set focus, when the button down message is received, the highlight is lost.
To achieve this, you need to derive your own class from CEdit, handle the WM_LBUTTONDOWN message inside your class and subclass the edit control with your class.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thank for reply. Ok, i try to do it on WM_LBUTTONDOWN.
Btw, is there any reading meterial that show the flow of the process when the user click the button / edit control box etc(like here is "control first receives WM_SETFOCUS message and then receives the WM_LBUTTONDOWN message"... )?
|
|
|
|
|
Use Spy++ for this?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi ,
Can u please clarify me how to load the gif file on the CAnimateCtrl picture control using MFC.
Thanks
|
|
|
|
|
The CAnimateCtrl class only understands AVI files and not GIF files.
GIF Animation Control[^] is a custom control derived from CStatic for showing animated GIFs.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi all,
I have a TreeCtrl with checkboxes.I want if checkbox of corrsponding item is unchecked than its not expand even i click on has button of corresponding item.
i m using this code on TVNItemExpanding but its not works
NMTREEVIEW* pnmtv = (NMTREEVIEW*) pNMHDR;
HTREEITEM item = pnmtv->itemNew.hItem;
if ( pnmtv->action == TVE_EXPAND )
{
if(m_tree.GetCheck(item)==0)
{
pnmtv->action=TVE_COLLAPSE;
m_tree.Expand(item,TVE_COLLAPSE);
}
}
Please help me for this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Try to simply return TRUE to prevent expanding.
NMTREEVIEW* pnmtv = (NMTREEVIEW*) pNMHDR;
HTREEITEM item = pnmtv->itemNew.hItem;
if ( pnmtv->action == TVE_EXPAND )
{
if(m_tree.GetCheck(item)==0)
{
return TRUE;
}
}
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Try this:
NMTREEVIEW* pnmtv = (NMTREEVIEW*)pNMHDR;
HTREEITEM item = pnmtv->itemNew.hItem;
if ( pnmtv->action == TVE_EXPAND )
{
if(m_tree.GetCheck(item)==0)
{
*pResult = 1;
return;
}
}
|
|
|
|
|
I think setting the *pResult = 1 will prevent the item from expanding or collapsing.
NMTREEVIEW* pnmtv = (NMTREEVIEW*) pNMHDR;
HTREEITEM item = pnmtv->itemNew.hItem;
if ( pnmtv->action == TVE_EXPAND )
{
if(m_tree.GetCheck(item)==0)
{
*pResult = 1;
return;
}
}
|
|
|
|
|
I have a 32 bit MFC Print Application that uses StartDoc API for printing. In 32 bit OS i didn't configure any Default Print Driver, then on File Print I selected Microsoft XPS Document Writer. A "Save as File" Dialog (MODAL) pops up which runs in the same Process as that of Application. Now I have tried to build the same Application in 64 bit OS using Visual Studio 2008. Here also i didn't configure any Defualt Print Driver. On File Print I selected Microsoft XPS Document Writer. A "Save as File" Dialog pops up which runs in a different Process from the Application. In this sceneario File Save As Dialog is becoming Modeless which is yeilding undesired results - I'm able to access the "Cancel Printing" dialog (the same cannot be accessed on 32-bit OS as File Save As is MODAL) and on clicking 'cancel' in this dialog, the Application hangs ( becomes unresponsive ). If I now navigate to the "Save as File" Dialog, and click Cancel or Save I can proceed.
Can anyone Explain why this difference in behavior is observed when StartDoc API is used?
Is there some option to disable the "Cancel Printing" dialog or make the "Save as File" Dialog MODAL for a 32-bit application in a 64-bit OS?
|
|
|
|
|
We have following code
CComPtr<IWshRuntimeLibrary::IFileSystem> fileSystem;
fileSystem->DeleteFolder((wchar_t*)ServerPath, VARIANT_TRUE);
fileSystem->DeleteFolder() is failing . Can I know when this happens and what could be the solution.
Thanks.
|
|
|
|
|
Why are you using the above said IWshRuntimeLibrary for deleting a folder when you have API's ?IWshRuntimeLibrary is something related to .net isnt it? Or are you coding in CLI ?
|
|
|
|
|
I am not sure why IWshRuntimeLibrary was used. This is some old code which was written by some body else who is right now not available. I am getting some failure on specific machines.
|
|
|
|
|
I will create the new object with the runtimeclass-pointer (CRuntimeClass* pRTC).
But an absolute must is to cal the constructor with parameters (not standard-constructor). I have to save time during creation. The next line did not compile but maybe you can modify it:
CObject* pTestObj = new (CRuntimeClass* pRTC) (5);
At the time of creation, I only know the runtimeclass-pointer and the transfer parameter (5).
In my program the transfer parameter is another big class, to initialice the new one.
Maybe at this way:
CObject* pObj = pRTC->CreateObject(5);
The CreateObject-function calls the standard-constructor.
Can I call another constructor during creation with runtimeclass-pointer and CreateObject?
Do you have an idea?
|
|
|
|
|
You could use a trick to do this.
From the standard constructor use placement new to call into another constructor.
The following code snippet demonstrates this.
class A
{
A()
{
new(this) A(10);
}
A(int i)
{
}
};
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Sorry, it does not go.
Here is the original code.
I will create a Mp-Object and init directly with a config.
-> optimize code and save time
CreateMp(CRuntimeClass* pRTC, CMpConfig* pConfig)
{
CObject* pOb = pRTC->CreateObject();
if(pOb)
{
pMp = dynamic_cast<cmp*>(pOb);
if ( pMp )
pMp->InitMp(pConfig); //it goes, but it is too slow
}
}
-----------------------------------------------------------
This code does not compile, but you can show what i mean.
CreateMp(CRuntimeClass* pRTC, CMpConfig* pConfig)
{
CObject* pOb = pRTC->CreateObject(pConfig);
}
... or ...
CreateMp(CRuntimeClass* pRTC, CMpConfig* pConfig)
{
CObject* pOb = new (CRuntimeClass* pRTC)(pConfig);
}
|
|
|
|
|
Hello,
I have a text document(ini file). I want to load data from the text document to a table in a html document using c++ only, not java script.
It's a http client server communication. When the server feels a button was pressed, he should fill the table.
How can i do it?
thanks,
|
|
|
|
|
Depends on which web server you use, maybe have a look at CGI[^].
You didn't ask for it, but it sounds a lot like a job for PHP
/M
|
|
|
|
|
I have a dialog based application where there are 20 dialogs. Now certain dialogs are Modeless dialogs. On that, one dialog has some ActiveX Control. On OnInitDialog() of the parent dialog I used the Create() to create the child dialog and i am hiding it initially and calling this child dialog at a later use. but when i am calling the parent dialog from another dialog the child dialog flashes and hides away. How can i avoid it?
I hope the query is clear
|
|
|
|
|
Chandru080 wrote: On OnInitDialog() of the parent dialog I used the Create() to create the child dialog and i am hiding it initially and calling this child dialog at a later use
Remove the visible(WS_VISIBLE) style of the child dialog and try again....
|
|
|
|
|
My 5. thanks Naveen.. It was a simple mistake and i was checking this error for more than an hour.
thanks again
|
|
|
|