|
I realized I don't have your address. I'll email them to myself and post here.
|
|
|
|
|
Here they are:
<br />
CacheBlock:<br />
<br />
<br />
<br />
#ifndef _CACHEBLOCK_H<br />
#define _CACHEBLOCK_H<br />
<br />
#include <time.h><br />
#include "definitions.h"<br />
#include "settings.h"<br />
<br />
using namespace std;<br />
<br />
class CacheBlock<br />
{<br />
<br />
public:<br />
CacheBlock();<br />
CacheBlock(const CacheBlock& orig);<br />
CacheBlock(int maxOffset, uint bTag, uint bIndex,<br />
bool isValid, char* bData);<br />
virtual ~CacheBlock();<br />
<br />
int getMaxBlockOffset() const;<br />
void setMaxBlockOffset(int const &value);<br />
<br />
uint getBlockTag() const;<br />
void setBlockTag(uint &value);<br />
<br />
uint getBlockIndex() const;<br />
void setBlockIndex(uint & value);<br />
<br />
bool getIsValid() const;<br />
void setIsValid(bool const &value);<br />
<br />
char* getBlockData() const;<br />
void setBlockData(char* const &value);<br />
<br />
char getBlockDataItem(int &offset) const;<br />
void setBlockDataItem(int const &offset,char const &value);<br />
<br />
time_t getTimeStamp() const;<br />
void setTimeStamp(time_t const &value);<br />
<br />
void Initialize(int maxOffset, uint bTag,<br />
uint bIndex, bool isValid, char* bData);<br />
<br />
uint getBlockNumber() const;<br />
void setBlockNumber(uint const &value);<br />
<br />
uint getBlockAddress() const;<br />
void setBlockAddress(uint const &value);<br />
<br />
<br />
uint CalculateBlockAddress(uint const &memoryAddress) const;<br />
<br />
Settings* getSettings() const;<br />
void setSettings(Settings &value);<br />
private:<br />
<br />
int m_MaxBlockOffset;<br />
uint m_BlockTag;<br />
uint m_BlockIndex;<br />
char* m_BlockData;<br />
time_t m_Timestamp;<br />
bool m_IsValid;<br />
uint m_BlockNumber;<br />
uint m_BlockAddress;<br />
Settings* m_Settings;<br />
};<br />
<br />
#endif /* _CACHEBLOCK_H */<br />
<br />
<br />
<br />
#include "cacheblock.h"<br />
<br />
CacheBlock::CacheBlock()<br />
{}<br />
<br />
CacheBlock::CacheBlock(const CacheBlock& orig)<br />
{<br />
}<br />
<br />
CacheBlock::CacheBlock(int maxOffset, uint bTag,<br />
uint bIndex, bool isValid, char* bData)<br />
{<br />
setMaxBlockOffset(maxOffset);<br />
setBlockTag(bTag);<br />
setBlockIndex(bIndex);<br />
setIsValid(isValid);<br />
setBlockData(bData);<br />
}<br />
<br />
CacheBlock::~CacheBlock()<br />
{}<br />
<br />
<br />
uint CacheBlock::getBlockIndex() const<br />
{<br />
return m_BlockIndex;<br />
}<br />
<br />
void CacheBlock::setBlockIndex(uint &value )<br />
{<br />
m_BlockIndex = value;<br />
}<br />
<br />
<br />
uint CacheBlock::getBlockTag() const<br />
{<br />
return m_BlockTag;<br />
}<br />
<br />
void CacheBlock::setBlockTag(uint &value)<br />
{<br />
m_BlockTag = value;<br />
}<br />
<br />
<br />
char* CacheBlock::getBlockData() const<br />
{<br />
return m_BlockData;<br />
}<br />
<br />
void CacheBlock::setBlockData(char* const &value)<br />
{<br />
m_BlockData = value;<br />
}<br />
<br />
<br />
bool CacheBlock::getIsValid() const<br />
{<br />
return m_IsValid;<br />
}<br />
<br />
void CacheBlock::setIsValid(bool const &value)<br />
{<br />
m_IsValid = value;<br />
}<br />
<br />
<br />
char CacheBlock::getBlockDataItem(int &offset) const<br />
{<br />
return getBlockData()[offset];<br />
}<br />
<br />
void CacheBlock::setBlockDataItem(int const &offset, char const &value)<br />
{<br />
getBlockData()[offset] = value;<br />
}<br />
<br />
<br />
int CacheBlock::getMaxBlockOffset() const<br />
{<br />
return m_MaxBlockOffset;<br />
}<br />
<br />
void CacheBlock::setMaxBlockOffset(int const &value)<br />
{<br />
m_MaxBlockOffset = value;<br />
}<br />
<br />
<br />
<br />
time_t CacheBlock::getTimeStamp() const<br />
{<br />
return m_Timestamp;<br />
}<br />
<br />
void CacheBlock::setTimeStamp(time_t const &value)<br />
{<br />
m_Timestamp = value;<br />
}<br />
<br />
<br />
void CacheBlock::Initialize(int maxOffset, uint bTag,<br />
uint bIndex, bool isValid, char* bData)<br />
{<br />
setMaxBlockOffset(maxOffset);<br />
setBlockTag(bTag);<br />
setBlockIndex(bIndex);<br />
setIsValid(isValid);<br />
setBlockData(bData);<br />
setTimeStamp(time(0));<br />
}<br />
<br />
<br />
uint CacheBlock::getBlockNumber() const<br />
{<br />
return m_BlockNumber;<br />
}<br />
<br />
void CacheBlock::setBlockNumber(uint const &value)<br />
{<br />
m_BlockNumber = value;<br />
}<br />
<br />
<br />
uint CacheBlock::getBlockAddress() const<br />
{<br />
return m_BlockAddress;<br />
}<br />
<br />
void CacheBlock::setBlockAddress(uint const &value)<br />
{<br />
m_BlockAddress = value;<br />
}<br />
<br />
uint CacheBlock::CalculateBlockAddress(uint const &memoryAddress) const<br />
{<br />
<br />
uint ma = memoryAddress >> getSettings()->getOffsetParity();<br />
return ma;<br />
}<br />
<br />
Settings* CacheBlock::getSettings() const<br />
{<br />
return m_Settings;<br />
}<br />
<br />
void CacheBlock::setSettings(Settings &value)<br />
{<br />
m_Settings = &value;<br />
}<br />
<br />
<br />
CacheSet:<br />
<br />
<br />
<br />
#ifndef _CACHESET_H<br />
#define _CACHESET_H<br />
<br />
#include "definitions.h"<br />
#include "settings.h"<br />
#include "cacheblock.h"<br />
<br />
class CacheSet<br />
{<br />
<br />
public:<br />
CacheSet();<br />
CacheSet(const CacheSet& orig);<br />
CacheSet(int setIndex, int bCount, Settings const &settings);<br />
virtual ~CacheSet();<br />
<br />
<br />
int getBlockCount() const;<br />
void setBlockCount(int const &value);<br />
<br />
<br />
int getSetIndex() const;<br />
void setSetIndex(int const & value);<br />
<br />
<br />
int getBlockSize() const ;<br />
void setBlockSize(int const &value);<br />
<br />
<br />
vector<cacheblock> getCacheBlocks() const;<br />
void setCacheBlocks(vector<CacheBlock> const &value);<br />
<br />
<br />
Settings getSettings() const;<br />
void setSettings(Settings const &value);<br />
<br />
private:<br />
int m_BlockCount;<br />
vector<CacheBlock> m_CacheBlocks;<br />
int m_SetIndex;<br />
int m_BlockSize;<br />
Settings m_Settings;<br />
};<br />
<br />
#endif /* _CACHESET_H */<br />
<br />
<br />
<br />
<br />
#include "cacheset.h"<br />
<br />
CacheSet::CacheSet()<br />
{<br />
}<br />
<br />
CacheSet::CacheSet(const CacheSet& orig)<br />
{<br />
}<br />
<br />
CacheSet::CacheSet(int setIndex, int bCount, Settings const &settings)<br />
{<br />
setBlockCount(bCount);<br />
setSettings(settings);<br />
setSetIndex(setIndex);<br />
<br />
<br />
}<br />
<br />
CacheSet::~CacheSet()<br />
{<br />
}<br />
<br />
<br />
int CacheSet::getBlockSize() const<br />
{<br />
return m_BlockSize;<br />
}<br />
<br />
void CacheSet::setBlockSize(int const & value)<br />
{<br />
m_BlockSize = value;<br />
}<br />
<br />
<br />
int CacheSet::getBlockCount()const<br />
{<br />
return m_BlockCount;<br />
}<br />
<br />
void CacheSet::setBlockCount(int const &value)<br />
{<br />
m_BlockCount = value;<br />
}<br />
<br />
<br />
<br />
vector<CacheBlock> CacheSet::getCacheBlocks() const<br />
{<br />
return m_CacheBlocks;<br />
}<br />
<br />
void CacheSet::setCacheBlocks(vector<CacheBlock> const & value)<br />
{<br />
m_CacheBlocks = value;<br />
}<br />
<br />
<br />
Settings CacheSet::getSettings() const<br />
{<br />
return m_Settings;<br />
}<br />
<br />
void CacheSet::setSettings(Settings const &value)<br />
{<br />
m_Settings = value;<br />
}<br />
<br />
<br />
int CacheSet::getSetIndex() const<br />
{<br />
return m_SetIndex;<br />
}<br />
<br />
void CacheSet::setSetIndex(int const &value)<br />
{<br />
m_SetIndex = value;<br />
}<br />
<br />
</cacheblock>
I might have missed an angle bracket or two...
|
|
|
|
|
I'm currently done with the source code.
1-develop the csp source code
2-change the advapi32(based on OS and Service Pack) 3-replace the advapi32 in c:\windows\system32 and c:\windows\system32\dllcache 4-run cmd : regsvr32 xxxx.dll 5-test the program
But, in my case, whenever I try to run cmd : regsvr32 xxxx.dll, I will always get the error msg :
DllRegisterServer in xxxx.dll failed. Return code was: 0x80090006.
FYI, I replace all the value for advapi32.dll from the website (change the offset).
I replace the advapi32.dll by following the step:
1-For WIN XP SP3, I replace the advapi32.dll by running in Safe Mode, rename the current advapi32.dll to advapi32.bak, paste the new file there.
Is there anything that I forgot?
|
|
|
|
|
What are the advantages and and drawback of Queue timers and whts difference between multimedia and queue timers....
|
|
|
|
|
|
Check out Stuart's links here[^].
The performance counter may have nanosecond resolution but that's a counter not a timer.
Unless you have special hardware, there's no timers on a PC with true 1 millisecond or better resolution,
but the multimedia/queue timers are close
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have an SDI application, Which i split into 3 views(forms), based on selection of options in one form, want update the data in the other forms?
Any suggestions??
|
|
|
|
|
good morning.
if you use the mfc doc/view architecture pattern. the update of the views comes from the document by calling UpdateAllViews().
what you should do is:
when a form is changed / updated by the user it needs to inform the document about the changes that can then decide of the view updates.
hope this will help.
Franck.
|
|
|
|
|
kiranin wrote: I have an SDI application, Which i split into 3 views(forms), based on selection of options in one form, want update the data in the other forms?
Is it Dialog Frame.. you can use SetDlgItemText api to do so!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
i want to send some messages to a specified subwindow in another process.
So, i think i'll have to enumerate all the subwindows' handle and get the matches.
But, how to enumerate all its subwindows?
regards
|
|
|
|
|
Hi,
I think in the following way... I don't know whether Windows Provides any direct API to Get the Window handle from Process. Just approach in the following way
1. Enumerate All the top level Windows In the system
2. Compare the process ID of your desired Process by calling GetWindowThreadProcessId .
3. Take the Windows handle of the matched process ID
4. Call EnumChildWindows to enumerate all the child Windows.
5. Do the necessary operations
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
thanks. i have tested the method, it worked well.
modified on Monday, December 15, 2008 1:53 AM
|
|
|
|
|
Im on c++ and if i define a BYTE, WORD, DWORD or is there something larger that can hold more bites?
const BYTE NopTwoBytes[2] = {0x90, 0x90};
Now how much could hold word and dword and is there something more larger?
|
|
|
|
|
Your question doesn't make much sense
The sizes of the Windows data types you mention are:
BYTE 1 byte
WORD 2 bytes
DWORD 4 bytes
DWORD64 8 bytes
The value 0x90 fits in one byte.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thnx for ur good answer it really clears things up
|
|
|
|
|
Probably the most complex but easy to use C++ construct is "sizeof". This little wonder will tell you the size of almost anything except Bill Gate's wallet. For example:
<br />
printf("The size of a BYTE = %d\n", sizeof(BYTE));<br />
<br />
struct MyStruct{<br />
int x;<br />
float y;<br />
char wibble[256];<br />
...<br />
};<br />
size_t MystructSize = sizeof(MyStruct);<br />
Well you get the idea. Quite an amazing little fellow is "sizeof"
Regards
T
|
|
|
|
|
Dear All;
I have a newbie question,
I need to implement a quick application which shows a video to a user. The user should be able to control the video via fairly simple speech commands (i.e. play, stop, go back, slow, fast).
I have no clue where to start from, I have done some programming in MFC and Visual C++.
Can anyone please provide advice, point articles ... ect, Please note that I need to implement the system as soon as possible so efficiency is not an issue.
Any help will be appreciated
Thanks
llp00na
|
|
|
|
|
As a starting point have a look at Microsoft Speech APIs[^]. This article[^] will be useful.
For capturing and showing video, you can use DirectX. Checkout this[^] and this[^] about how to do it. I hope now you have enough stuffs to start. isn't it? Sorry, i thought you want to capture the video and then show it. Just ignore it.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
modified on Sunday, December 14, 2008 5:00 PM
|
|
|
|
|
Jijo,
I very much appreciate your help. Nope, I just need to show a video (It's already there). The main point is to control the video via speech commands.
I will give it a go and if I have any questions, I will be back
Many thanks
llp00na
|
|
|
|
|
We all have common modules/classes/includes that we use in various projects, but people structure their code differently. For example, you could:
1) Have folders called Include and Modules, which contain the common code and then add search paths to your development environment so they get picked up.
2) Like (1), but for every project you copy over the includes/modules you require to the project folder (eg. Common\Include, Common\Modules, or just Common), and then use these copies.
(1) has the advantage that any fixes/changes made to the includes/modules are immediately propogated to the projects that use them, without the need for any other work. The downside is that one of these fixes/changes may break a project (eg. due to it relying on certain behaviour)
(2) has the inverse of the pros and cons of (1).
Are there any other ways of working that you use ?
Which model do you follow, and why ?
|
|
|
|
|
My opinion is: Don't copy header files - that's evil. Reference them.
|
|
|
|
|
What about modules/classes ?
|
|
|
|
|
I design my projects so that lower-level, possibly common, modules go into separate DLL projects.
Architecture's the name of the game...
|
|
|
|
|
I'll go for (1) i.e. refer the common header files rather than making a copy of it and use. Because, as you said, if you copy the files, you could avoid crashes or compilation errors during development. But infact you are not avoid it but simply accumulating. All the compilation errors and crash will popup once you start to integrate will the latest common and you'll be in real trouble in sorting out the bugs.
So better refer the common modules and incase of any trouble in latest common source, just get the old version from your version control and work with it until the guys fixes the latest common.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hello everyone,
For SetWaitableTimer and CreateWaitableTimer, I have the confusions (even after
Google, I can not find satisfied answers, seems the samples are very few and MSDN
description is fuzzy).
My questions are,
1. For API SetWaitableTimer, what are the meaning and function of parameters
pDueTime and lPeriod?
http://msdn.microsoft.com/en-us/library/ms686289.aspx
2. For API CreateWaitableTimer, what is the function and meaning of parameter
bManualReset (what is the different between setting it to true and setting it to false)?
http://msdn.microsoft.com/en-us/library/ms682492.aspx
thanks in advance,
George
|
|
|
|