|
Hi,
I have an existing binary file. My requirement is to insert user specifed number of bytes(data) at any given offset so that data following that point is not overwritten. Can this be implemented without rewriting whole file every time?
I'm looking for efficent way to do this. My files are huge and there will be multiple number of insersions. Any sample code will be appriciated.
Thanks,
Anunay
|
|
|
|
|
You could use a memory-mapped file to eliminate some of the disk I/O.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
But can I do this without rewriting the whole file every time ?
|
|
|
|
|
At the best you can avoid rewriting everything up to the point of insertion. If you need to insert often, and into very big files, then I would suggest an alternative file format/algorithm that better supports random insertion.
|
|
|
|
|
I built a simple graph, (mpeg2 file as source -> mpeg2 demultiplexer -> 2 outputs (null renderes for audio and video)).
After graph has finished i wanted to relase all filters, and when i tried to call : pGraph->RemoveFilter(pDemux) , i got access violation.
The other filters got released and removed with no problem. Only this filter got me an access violation. (I tried replacing this demux in another demux (Elecard Mpeg2 demux) i had, and got same result).
When i tried to enumerate all pins of that filter just before i remove it, everything worked just fine. (Even though the enumration itself got no side effects..)
Someone encountered this problem before or have any idea what can cause this?
I tried googling, and nada, no results.
Thanks for ur help.
|
|
|
|
|
Hi! I want to change the Color of the Text in some of my Buttons.
Can anybody help me?
Thanks!
|
|
|
|
|
|
Thats the way I tried first, but it dont´t work. I don´t know why.
I wrote the following Code:
HBRUSH CDialogProgKonf::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
int nId = pWnd->GetDlgCtrlID();
if ( nId == IDOK) pDC->SetTextColor(RGB(255,1,2));
return hbr;
} // OnCtlColor
I don´t see me fault. It would be nice if anybody can help me. Thanks
|
|
|
|
|
Did you read the example from Microsoft?
// This OnCtlColor handler will change the color of a static control
// with the ID of IDC_MYSTATIC. The code assumes that the CMyDialog
// class has an initialized and created CBrush member named m_brush.
// The control will be painted with red text and a background
// color of m_brush.
You need to return m_brush.
HBRUSH CDialogProgKonf::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
int nId = pWnd->GetDlgCtrlID();
if ( nId == IDOK)
{
pDC->SetTextColor(RGB(255,1,2));
CBrush m_brush;
m_brush.CreateSolidBrush(RGB(255, 255, 255));
or
COLORREF crSys = ::GetSysColor(COLOR_BTNFACE);
m_brush.CreateSolidBrush(crSys);
hbr = (HBRUSH)m_brush;
m_brush.Detach();
}
return hbr;
}
|
|
|
|
|
I´m sorry to ask you again, but it doesn´t work. I put your Code in mine in both versions, but there is no change.
The button I want to change is a standard button in an dialog, both created with the Ressource-Editor of MS Visual C++ 6.0. Are there any properties I have to change? The ID of the button is IDOK. The Dialog-Class is CDialogProgKonf.
Thanks again!
|
|
|
|
|
|
Thank you for your efforts. I´ll have a look on the web site you posted. If I find a way, I´ll lett you know.
|
|
|
|
|
The only other way is to make it an "owner draw" button.
CMyDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if (nIDCtl == ID_MYBUTTON)
{
}
}
|
|
|
|
|
Ok, that will take some time, because I have to find out how to draw an button myself.
Never mind, thank you for your friendly help.
|
|
|
|
|
Hi All,
I have some application, which is running and have icon on system tray.
(Like Dictionary). How can I get the keybord messages like "Alt +Shift" or "Alt +Ctrl", when my window is not active ?
For example when I press "Ctrl +Insert+Insert" some dictionary applications
understand that message ( and they have not any active window )and translate the word.
Can you help me, if you know how to do that.
Thanks
Murad.
|
|
|
|
|
Hi Murad,
You can write hook application to monitor system wide key press. Following link might be of some help to you
http://www.codeproject.com/dll/keyboardhook.asp?target=hooks
Check out other hook articles on codeguru
Have fun,
Anunay
|
|
|
|
|
Hi Murad,
You can write hook application to monitor system wide key press. Following link might be of some help to you
http://www.codeproject.com/dll/keyboardhook.asp?target=hooks
Check out other hook articles on codeguru
Have fun,
Anunay
|
|
|
|
|
|
It works fine, Thank you!
Best Regards
Murad.
|
|
|
|
|
Hi
My question is: MY program that i wrote is working fine it opens the serial and close it it works fine on a modem BUT when i connect it to the scale it works perfctly.. We have used pascal to do the reading but pascal do not work with windows Xp so have to code in MS visial c++6.
i want to send the scal a character 5 how do i do this in c++?? This is a sample of my pascal program.
PROGRAM SKALE;
USES
Dos, Crt;
CONST
CtrlE=#5; (THIS IS WHAT I WANT TO SEND A CTRLE TO READ THE STRING BACK TO ME!!)
VAR
poort, data: text; {Poort en leer veranderlikes}
junk, gewig: String; {Lees die gewig vanaf skale}
BEGIN
Assign(poort, 'COM1'); {Com2 word gelees vir data}
Assign(data, 'C:\SKALE\IN.TXT'); {Inbrug se data leer}
Rewrite(data);
Rewrite(poort);
Writeln(poort,CtrlE); {Vra skaal vir gewig}
Reset(poort);
Read(poort,junk);
Delay(1000);
Rewrite(poort);
Writeln(poort,CtrlE);
Reset(poort);
Read(poort,gewig); {Lees gewig}
Writeln('Lees ',junk,' vanaf skaal.');
Writeln(data, gewig); {Skryf gewig in leer}
Close(poort);
Close(data);
END.
Thank you
Tiaan Strydom
|
|
|
|
|
Check out MSDN.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp
Kuphryn
|
|
|
|
|
I am porting a 32-bit MFC application to 64-bit Windows.
I will be using Windows Server 2003 64-bit and Visual C++ .net 2003 Standard Win32 Edition .
1) Will there be a compatibility issue between these 2?
2) Does Visual C++ .net 2003 support 64-bit using the /WP64 switch? Does it have some extra/ other switches for 64-bit support?
|
|
|
|
|
MSDN information on 64-bit Windows[^].
64-bit applications at present can only be built using the compilers in the Driver Development Kit[^]. For the most part, Win64 is a pure extension of Win32 with some pointer and integer types extended to 64 bits. In terms of compatibility, you can run most IA-32 binaries on a 64-bit platform (albeit slowly at present on Itanium), but I don't think that's what you were after.
Visual C++ .NET 2003 uses version 13.10 of the x86 compiler, which supports the /wp64 64-bit portability warning switch. This switch detects conversions from types tagged __w64 to types smaller than 64 bits without this tag.
It should be possible to use the 64-bit compilers from VS.NET using a makefile project, or by changing the directories options. However, you won't be able to debug from VS.NET at present, as it only understands x86 native code. You'll have to use WinDBG, from the Microsoft Debugging Tools[^] kit.
|
|
|
|
|
I have written an application which has a splitter window (2 panes), I hvae written 2 different view Classes for these panes. In one view I have a List box and in the other I have a Dialog box with a few controls.
Now as I change the selection of items in the list box, I need to disable/ enable certain controls in the other pane. How do I communicate between the two panes
With Regards
|
|
|
|
|
Each view should communicate with the other either by sending messages to the parent. Yes, one view could send a message directly to the other, but then those two views are now "tied" together.
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|