|
|
Hi
I am used to figuring character formatting from the mainframe world where everything is a byte, towards that and I would like to use courier new in my rich edit.
can I use
EM_SETCHARFORMAT setting courier new
of course I would probably have to use CClientDC to get the device context of the rich edit
and then GetCharABCWidths
Does this make any sense ?
|
|
|
|
|
ForNow wrote: Does this make any sense ? Not really.
Everything on a PC is also a byte (or a word ...). The only time the format of a character has any real relevance is when you display it on some output device. So when writing to your device context, you must first create a font and select it into the DC. See https://msdn.microsoft.com/en-us/library/w6196kz3.aspx[^] for some more details. See also http://www.functionx.com/win32/Lesson15.htm[^] for a sample using Win32, but you should be able to get enough information to use that in MFC.
|
|
|
|
|
I have created an excel file via code .
I want to write data in the file for that I want to
increase the size of cells via program and write some text
bold format as per my requirement.
How to do this?
|
|
|
|
|
|
I think courier new all the characters are the same width I'll read the doc
Thanks
|
|
|
|
|
Hi friends,
case 1:
I am opening a file from network drive location. During file read, the mapped network drive is disconnected, my application get crashed and closed. how to check the mapped network drive is connected or not using file pointer.
case 2: during file read, I am disconnecting and connecting the mapped network drive that time pointer is not null. but I cant able to access a file using this file pointer.
Thanks,
S Shanmuga Raja
|
|
|
|
|
You should use a try/catch block to catch exceptions that occur in such circumstances, and/or check the status of any file access calls.
|
|
|
|
|
1. You should handle the exception.
2. You can write a method to check connection (through ping).
|
|
|
|
|
If you share which API you are using for file I/O then you'd get answer more accurately.
Did you used std::fstream or some other API?
|
|
|
|
|
I want a code of c code
which can take million integers as input,
sort them (bubble or quick or selection sort).
It should display time taken to sort first 10 integer, then for first 100 integer, then for 10000 and total.
Please help me soon I have very less time to complete my project.
iamsohail.srk@gmail.com
|
|
|
|
|
Sorry, CodeProject does not provide code to order, especially for homework questions.
|
|
|
|
|
Well then, you'd better hop-to-it and get writing then don't you?
There's countless examples of sorting code on the web. If you cant even be bothered to search for them, and instead ask to be spoon-fed,you're not going to enjoy programming much - it's an occupation that required copious amounts of research.
Also, you might wish to edit your question to remove your email address - you'll get email notifications if someone replies anyway - providing your email just provides opportunity for others to inconvenience you.
"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon
|
|
|
|
|
Hello,
I am trying to get all available logical drive information using WMI services. If a partition is under extended partition, I am getting wrong startingOffset although getting correct startingoffset in case non extended partition.
Please suggest....
|
|
|
|
|
In the extended partitions the meaning of partition table entries are different from that of standard partitions.
You may want have a look to this[^] MS article.
|
|
|
|
|
Hi
My code for Create (of a dialog box fails) in MFC base code specifically the line in bold
when I try to Create for a DialogBox
I have DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC in the respective sources though I don't think that is a issue one way or a other
Don't know why
main_app->myshow_storageptr = new Show_storage();
main_app->myshow_storageptr->AssertValid();
main_app->myshow_storageptr->Create(IDD_DIALOG6,NULL);
MFC code from wincore
void AFXAPI AfxHookWindowCreate(CWnd* pWnd)
{
_AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();
if (pThreadState->m_pWndInit == pWnd)
return;
<pre>
if (pThreadState->m_hHookOldCbtFilter == NULL)
{
pThreadState->m_hHookOldCbtFilter = ::SetWindowsHookEx(WH_CBT,
_AfxCbtFilterHook, NULL, ::GetCurrentThreadId());
if (pThreadState->m_hHookOldCbtFilter == NULL)
AfxThrowMemoryException();
}
ASSERT(pThreadState->m_hHookOldCbtFilter != NULL);
ASSERT(pWnd != NULL);
ASSERT(pWnd->m_hWnd == NULL); // only do once
ASSERT(pThreadState->m_pWndInit == NULL); // hook not already in progress
pThreadState->m_pWndInit = pWnd;
|
|
|
|
|
What type of object is Show_storage ?
What does Create() return?
Where is your code called from, or what is it in response to?
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 15-May-15 15:59pm.
|
|
|
|
|
A CDialog
Create never return it aborts causes an an exception
In the assert highlighted in bold
|
|
|
|
|
The assert fails because the CWnd* does not point to an object that contains a valid Window handle. Something in your code has not been initiailised correctly, or you are calling Create from outside of a Window class. What class is Show_storage ?
|
|
|
|
|
I am creating a simple property grid (CMFCPropertyGridCtrl) containing sub groups (value list)
There is a alignment issue for the sub groups where the labels are drawn with a left offset (see in particular the "Level2" label)
Why is the "Level2" label not aligned the same was as the "Level1" label?
I would imagine that it should be aligned at the same level as the "subLevel1" label.
See screenshot : http://imgur.com/9JeC4iz
Here is how I code the property grid:
CMFCPropertyGridProperty* level1Group = new CMFCPropertyGridProperty(_T("Level1"), 0, TRUE );
CMFCPropertyGridProperty* subLevel1 = new CMFCPropertyGridProperty(_T("subLevel1"), _T("subLevel1"), _T("subLevel1") );
level1Group->AddSubItem(subLevel1);
CMFCPropertyGridProperty* level2Group = new CMFCPropertyGridProperty(_T("Level2"), 0, TRUE );
CMFCPropertyGridProperty* subLevel21 = new CMFCPropertyGridProperty(_T("SubLevel2.1"), _T("SubLevel2.1"), _T("SubLevel2.1") );
CMFCPropertyGridProperty* subLevel22= new CMFCPropertyGridProperty(_T("SubLevel2.2"), _T("SubLevel2.2"), _T("SubLevel2.2") );
CMFCPropertyGridProperty* subLevel23 = new CMFCPropertyGridProperty(_T("SubLevel2.3"), _T("SubLevel2.3"), _T("SubLevel2.3") );
level2Group->AddSubItem(subLevel21);
level2Group->AddSubItem(subLevel22);
level2Group->AddSubItem(subLevel23);
level1Group->AddSubItem(level2Group);
m_PropertyGrid.AddProperty(level1Group);
I tried inheriting my own CMFCPropertyGridProperty class and overwrite the OnDrawName but because of many protected members in the base class. (see CMFCPropertyGridProperty::OnDrawName in afxpropertygridctrl.cpp )
Now, I did overwrite the OnDrawName method, but removed lot of code that was in the base method that did not compile (access to protected members); but it seems to be OK.
Thanks.
Max.
I'd rather be phishing!
|
|
|
|
|
As is well known when using switch (expression), thus:
"The expression must be of an integral type or of a class type for which there is an unambiguous conversion to integral type".
If the switch contains a number of case / 2 to 4 /, then there is no problem.
Well, if you say case is 30 pieces, then dostura to 29 in a row case, the compiler must make 29 comparisons.
Below is a one of the solutions to this problem.
And so the program as expression must transmit the index number to any array, containing the address points
transition operator goto.
Everything!
Notes: Of course array must contain the called function.
modified 15-May-15 11:09am.
|
|
|
|
|
Have a gander here[^]. Pay particular attention to #11.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
Hi Guys!,
I'm developing a simple tracking game using two haptic devices as controllers.
Haptic rendering is executed in a high priority thread.
During the experiment, force experienced will depends on the position of each player, it's calculated as follows:
coupledForce1 = cMul(Kp, (newPosition2-newPosition1))-(cMul(Kb, (linearVelocity1)));
coupledForce2 = cMul(Kp, (newPosition1-newPosition2))-(cMul(Kb, (linearVelocity2)));
I have 100 trials of tracking tasks and I have to calculate the average interaction force during each trial. How it can be done? my issue is: this manipulation have to be done in a thread with execution rate of around 8KHz
Thanks!
|
|
|
|
|
|