|
now, i simulate one desktop.
After i clean the full rubbish, which message is sent to the desktop for notifying you to change the icon of rubbish.
thank you very much.
|
|
|
|
|
It has always been called as recycle bin.
People may not understand you if you call it by other names.
Anyway, try doing an invalidate on the desktop.
|
|
|
|
|
Hi,
I have a file which is in binary mode.(I am using stdio functions fwrie,fread,fseek)
I have to read this file in binary mode and needs to replace some of the bytes in this file.
It contains around 1000 entries with 2 bytes each.
I know the location of bytes which is to be changed, like 100th entry.
Is there anyway to change that specific bytes, without copying in to other file.
As I have small memory I can not copy into other file and recopy with changed bytes.
So on the fly i want to change specific bytes.
please tell me if any method is there to do this.?
Regards,
Sunil Kumar
|
|
|
|
|
You may open the file for read/write (i.e. "r+" ) go to intended position with fseek and change the byte content with fwrite .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
yeah.i've used the same thing.But that is not working.
Regards,
Sunil Kumar
|
|
|
|
|
My code (beware: error checking omitted for concision)
FILE * fp = fopen("foo.bin", "rb+");
fseek(fp, 10, SEEK_SET);
fwrite("#", 1, 1, fp);
fclose(fp);
is working fine.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Friday, January 22, 2010 6:43 AM
|
|
|
|
|
Except that for binary you could do a "rb+".
|
|
|
|
|
Oh, thanks...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
did you remember fflush() the buffers?
|
|
|
|
|
As superman's said elsewhere in this thread, use binary mode when you open the file, using
FILE * fp = fopen("foo.txt", "rb+");
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
I am doing an application where i am writing something to an excel sheet. Initially i am writing into 2 rows and coloums. i have the heading and then the values and then closing the file. Now at a later point of time i need to open the same file and append. starting writing from the third row. How can i do that?
|
|
|
|
|
|
What is the format of your file ? A CSV file or really an excell spreadsheet ? Are you using excell automation ?
|
|
|
|
|
Chandru080 wrote: Now at a later point of time i need to open the same file and append. starting writing from the third row. How can i do that?
How did you write to the second row?
"One man's wage rise is another man's price increase." - Harold Wilson
"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,
I have a video playing in a video player. Irrespective of video player, I need the handle to the video being played. I have user-specified screen co-ordinates, now I need to convert the screen co-ordinates into frame co-ordinates of the video. To convert screen co-ordinates to video-frame co-ordinates and to further process video frames, I need handle to the video.
I am using Visual Studio and C++ for Win32 programming.
Any pointer?
Thanks
|
|
|
|
|
I found a technical document for adding multiple view to a single document project.
http://msdn.microsoft.com/en-us/library/s199bks0%28VS.80%29.aspx[^]
I made a form view and tried to create it in my project.
When I tried it first, it was succeeded. But when I made it again I got an error message.
It is my code copy from MSDN document.
CView* pActiveView = ((CFrameWnd*)m_pMainWnd)->GetActiveView();
m_pOldView = pActiveView;
m_pSearchView = (CView*)new CSearchMember;
CDocument* pCurrentDoc = ((CFrameWnd*)m_pMainWnd)->GetActiveDocument();
CCreateContext newContext;
newContext.m_pNewViewClass = NULL;
newContext.m_pNewDocTemplate = NULL;
newContext.m_pLastView = NULL;
newContext.m_pCurrentFrame = NULL;
newContext.m_pCurrentDoc = pCurrentDoc;
UINT viewID = AFX_IDW_PANE_FIRST+1;
CRect rect(0,0,0,0);
m_pSearchView->Create(NULL, NULL, WS_CHILD, rect, m_pMainWnd, viewID, &newContext);
m_pSearchView->SendMessage(WM_INITIALUPDATE, 0, 0);
In debugging mode, I could find a place occurred error.
BOOL CFormView::Create(LPCTSTR , LPCTSTR ,
DWORD dwRequestedStyle, const RECT& rect, CWnd* pParentWnd, UINT nID,
CCreateContext* pContext)
{
ASSERT(pParentWnd != NULL);
ASSERT(m_lpszTemplateName != NULL);
m_pCreateContext = pContext;
#ifdef _DEBUG
if (!_AfxCheckDialogTemplate(m_lpszTemplateName, TRUE))
{
ASSERT(FALSE);
PostNcDestroy();
return FALSE;
}
Because of m_plszTemplateName, this error is occurred.
But I don't know how do I solve.
Please advise for me.
|
|
|
|
|
Are you wanting to create the additional views on the fly? or creating them in edition time (for instance a CFormView in Resource.h) and attaching / opening them in run-time? With or Without MFC?
If the second there is another approach to get it, I used it in VC6 with MFC. But it is quite long to explain, if it is not what you want / need.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
modified on Friday, January 22, 2010 4:52 AM
|
|
|
|
|
I already made a formview class with MFC. I want when I push the button(like as menu or toolbar), my application's view is changed from basic view to the formview made by me.
So I found that document from MSDN, I tried. But I got a error in Create function in CView. I don't know why that error is occurred. Just guess, it would be because of m_lpszTemaplateName.
Finally, I wanna make the additional view, and show that in my application, when I occur an event like as push a button or toolbar. The application view have to be changed between basic view and formview I made.
|
|
|
|
|
Take a look into the search[^] for more general info.
To add a different View to the running application (note the "add") you can check this[^] message I wrote quite a time ago and the other I point out in it, about this topic.
To do what you want of just changing the view you could improve/override one of my methods doing that when one view opens, then you go and close the previous one.
I hope it helps you.
EDIT: Searching for another thing I found this[^] I forgot to comment the step 2 of this link into my answers. In fact it is an important step missing. But as he says the code won't compile correctly, but it has the basics and you can complete it with my answers above.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
modified on Friday, January 22, 2010 9:51 AM
|
|
|
|
|
Hi all,
i want to generate generate random number in given minimum and maximum number range like 1 to 20;
i m using this.
srand((unsigned)time(0));
int random_integer;
int lowest=1, highest=20;
int range=(highest-lowest)+1;
for(int index=0; index<20; index++){
random_integer = lowest+int(range*rand()/(RAND_MAX + 1.0));
cout << random_integer << endl;
}
but this generate some repeated numbers.
i want to generate random number but not repeated.
please help me for this.
thanks.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
I think you just check with srand CRT functions, Please check this link, it shows how you can generate different numbers [^]
Величие не Бога может быть недооценена.
|
|
|
|
|
its generate any numbers,i want to generate numbers with in provide range.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
It can be done with it
just check this code below.
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int i;
srand( (unsigned)time( NULL ) );
for( i = 0; i < 10;i++ )
printf( " %6d\n", rand()%20 );
return nRetCode;
}
Величие не Бога может быть недооценена.
|
|
|
|
|
if i had to do this, i'd use a std::set to keep track of numbers that have been generated.
std::set < int > foo;
for (int i=0;i<20;i++)
{
int z = rand() % 100;
if (foo.find(z) == foo.end())
{
foo.insert(z);
TRACE("+%d\n", z);
}
else
{
TRACE("skip %d\n", z);
}
}
|
|
|
|
|
error generated
error C2039: 'set' : is not a member of 'std'
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|