|
Hi,
I need to define a datatype with a size of 4 bit within a struct.
char has a size of 8 bit and thats the smallest type I know ...
So what else should I do? I really dont know how to search for this, sorry.
btw: I think I saw something like "unsigned short varName:4" in a code-snipet.
Does this mean the varName holds 4bit of data?
Thanks in advance!
|
|
|
|
|
_NielsB wrote: So what else should I do?
Something like:
struct
{
char c:4;
};
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: Something like:
struct{ char c:4;};
This is indeed a respected method inkeeping with the language. However it also depends on what the four bit data type is to be used for, Is packing on a Four Bit boundary required.If a lot of manipulating code is to be written, or an array of nibbles needs to be addressed, maybe a more transparent way is Masking and Shifting, and a Raft of Macro's to cover it.
e.g.:
#define LO_NIBBLE(x) ((x)&0xFF)
#define HI_NIBBLE(x) (((x)>4))&0xFF)
#define GET_ARR_ITEM(Arr,N) ((((N)&1)==0)?LO_NIBBLE((Arr)[(N)/2]:HI_NIBBLE((Arr)[(N)/2])
And so on ad infinitum
Even further, depending on the importance and complexity of the grander problem to be solved, (and the Time and resources available)one could conceive of a new class, CNibble with an entire gammet of overloaded operators. Come to think of it, why not also a Class CHalfNibble and CBit.
Hope this is of help,
regards
LateNightsInNewry
|
|
|
|
|
Dear Friends,
I want to programatically change a resource (bitmap) in a dll. Ofcocurse, i do not have a source code of that dll. Can anyone tell me how to do this kind of work.. what APIs are required or if there is any sample article/software you aware of doing such thing; then tell me please.
cheers...
Imtiaz
|
|
|
|
|
See Here[^]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
Hello,
I have an Microsoft Outlook style application - a splitter window with a TreeView derived class in the left pane, and , at different times, one of various CView derived class in the right pane.
When the user resized the main application window, eventually the CFormView derived class will display scrollbars. I'd prefer for it to never display scrollbars. Can this be done? How?
Regards,
Sternocera
|
|
|
|
|
If the control bars appear, it means that some working sufrace of that view is not being displayed, so if you want to remove the controlbars, you may lose some working area in your view.
Possible, it is possible, but I don't know why do u want to.
I can think on 2 possibilities.
First one... Change the visible area with SetScrollSize ()
Second one... take the moment you want with WM_SIZE, take a pointer to the scrollbars and disable/make them not visible.
Greetings.
--------
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
|
|
|
|
|
This has done it for me:
void CsplittertestView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
SIZE mysize; mysize.cx = 1; mysize.cy = 1;
SetScaleToFitSize(mysize);
}
Thanks,
Sternocera
|
|
|
|
|
I didn't think bout this possibility.
I love this forum because trying to help one learn new things too
Greetings.
--------
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
|
|
|
|
|
I can't find anywhere to add a grid to my dilog window.
Is this due to my older version of c++?
What am I missing here?
|
|
|
|
|
hi there,
i have coded an aplication that talks to a relay board via the parallel port on my pc,it has eight relays on it that effectivly turns things on or off upon recipt of a command.
so what i want to be able to do is set an on and off sequence for each individual relay on the board,using some sort of timer as a trigger.
i think i will need eight timers that are in sync with the sytem clock and will trigger when the values match
can anybody point me in the right dirction as how to achive this
chris
|
|
|
|
|
If you are using MFC, take a look in CWnd::SetTimer (...) and KillTimer (...)
without MFC i have read the function sleep sometimes, but to make a pause I dont know if it triggers code
Greetings.
--------
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
|
|
|
|
|
Hello
I have written a small application which reads the registry keys present in a .txt file and tries to export each key using regedit, i.e. I read each line of the file (which is a key) and using the commandline for regedit (regedit /e "target file" "source key") I export it into a folder creating a new .reg file for each key read from the file.
Now in my .txt file there are around 11,500 keys. The keys are successfully exported till 5450, but after that calling CreateProcess on regedit returns error no. 1450 (no system resources) and all the subsequent keys are not exported into the target folder.
What could be the reason for this error to come up? And how should I change the logic so that this error doesnt come up and all the 11500 keys are exported as different .reg files into my target folder?
Thanx.
|
|
|
|
|
vipin_nvk wrote: no system resources
Are you closing the processes after each one is used. Windows has a resource limit of 10,000 resource handles 10,000 limit[^](or something like that) per process and if your spawning outside processes, they may count against your main process. I'm not sure how the rules work with spawned processes.
However, be informed that a resource handle can include pens, brushes, windows, etc... and depending on the type of windows or controls being created, you can hit the resource limit pretty quick.
Try closing things that might maintain handles to resources once you are finished with them as it sounds like their being maintained somehow.
Here are some links about resource handle limits...
Concerns about resource handles and Raymonds words on the matter[^]
Window Manager limits[^]
|
|
|
|
|
Hi every one;
This is my first time here. and I faced problem with Visual C++ 2005.
the problem is:
I want to read 6 keys from keyboard as same time. for example (zxcnm,). because I will replace them with dots. that means if the user press c and z it means dot one and dot 3.
may any one help me in this topic. please
Thanks
--------------------------------------------------------------------------------
allooba
|
|
|
|
|
Is this a console or a GUI application? If the former, check out getch() . If the latter, check out the WM_CHAR message.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thnaks man;
but I am beginner in Visual C++, I found more files like (".h" and ".cpp"), but in which one can I wrote my code.
in ".h" file, when I duble click in any item in the form it is open the code in ".h" file.
can u give me small notes about this.
alot thanks.
|
|
|
|
|
allooba wrote: I found more files...
What type of project did you opt for? With a console application, it'll likely contain one of each, making editing them about as easy as it gets.
allooba wrote: in which one can I wrote my code.
Both, since everything is technically code. Files with a .h extension typically contain declarations, while files with a .cpp extension typically contain definitions.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks again David;
I wrote all my code in ".h" file, that because when I duble click in any object in form desigin it is open in ".h" file.
but I face message error when I try to handel keypress function in text area object. how can I hendel the input? it gives me error message " the keypress function not member in system::windows::forms::control::keypress"?
can you help me in this issue?
my project is small program to simulate braile letters. that means 6 dots in one char.
thanks David.
|
|
|
|
|
Hi All,
I have created the project of MFC Activex Control and also I have included other project as a DLL in the same solution.And my Activex project is depends on the DLL project.
Here First of all I want to ask you that is it possible for the Activex project to depend on DLL project? Is there any other setting I have to make?
And now when I compile the project it gives me the error like......
Project : error PRJ0050: Failed to register output. Please ensure you have the appropriate permissions to modify the registry.
In my DLL project I have made some registry operations.How can I get appropriate permissions to modify registry?
Thanks In Advance.
Ashish Bhatt
|
|
|
|
|
ashishbhatt wrote: How can I get appropriate permissions to modify registry?
Log in with a local administrative account and try again would be the simplest approach. By default, not involving discussion of any type of UAC, only certain accounts have modify or write rights to HKLM and HKCR and it sounds like your not logged in with one of them or your IT staff has made modifications to the standard registry rights settings.
If you on a Windows Vista box with UAC turned on, you will potentially get some false positives if your not familiar with what is going on under the hood.
|
|
|
|
|
Thanks For Reply,,
As you told to login in local Administrative,But I am already working in administrator Account.
And my other confusion is that is it possible that IO can add other DLL in the solution in which Activex project is the main project.But here my Activex project depends on DLL project.
Thanks.
Ashish Bhatt
|
|
|
|
|
I'm not really sure what it might be then. I googled and the first hit I got looks interesting/promising...
(Specifically, the "community content" section had some detailed talk about possible things to look for)
Ideas[^]
|
|
|
|
|
hi every one
i want one simple sample of CListCtrl print and print perewie in CFormView Project.
please help me
|
|
|
|
|
For print preview see here[^] and here[^] for first section of your question can you more explain ?
|
|
|
|