|
GetDlgItem(IDC_MYCONTROL)->SetFocus() ???
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
That's it. Thanks.
ralf.riedel@usm.edu
|
|
|
|
|
I also do myEdit.SetSel (0, -1); before setting focus to an edit control after displaying a validation error message. This prepares the control for overwriting.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I need to send data out in two short ints in a message. The source data is in floating representation, range -180.00 to +180.00. This needs to be converted into a scaled 32 bit 2's Complement integer value
So what I need to do is normalise the data;
i.e. float f = 99.9;
f = f/180; // 0.555
Now I need to extract the bits that reprsent the .555 and convert them to a 32 bit bit 2's Complement integer
I was planning to use the union as follows:
union
{
int intValue;
unsigned short buff[2];
}convert;
So once I have converted the float to int I can assign the buff[]
e.g. convert.intValue = floatToInt(f/180);
So now I can load the message using convert.buff[0] and convert.buff[1]
Note I need to check the conversion, so I am planning to do the following:
float f_out = (float) ((buf[0] << 16 | buf[1])*180);
Question how to I convert the float to int?
grahamfff
|
|
|
|
|
int i = int ((f/180.0f)*float(MAX_INT));
I don't remember exactly what MAX_INT is called. But it is in limits.h.
float f = float (i) / float (MAX_INT) * 180.0f;
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hi everyone,
I am writing a win32 service that listens on a socket. When I run the application in a normal console window, it works fine. However, I cannot initialize the socket when I run it as a service. I found out that the following line was needed:
AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0);
However, this line does not work when I run the service. Coz I guess there is no WinAPP object. But the CSocket object does not initialize and the sevice dies.
Anyone has any ideas how I can init MFC sockets in a service. This is really urgent. I would really appreciate any help.
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
For an easy way out, first read Xiangyang Liu's article Start Your Windows Programs From An NT Service[^]
This article presents you with a service, which is able to start programs before users log on and keep them running after users log off. This way, you don't need to ponder about how to implement MFC to a Win32 service. You can just write a full-fledged MFC application using the MFC App Wizard, and let the XYNTService worry about the rest.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Yeah,
I think I will go for that solution. Thank you so much for pointing that out to me.
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Recently i did a packet capture on my network of what was being sent when i logged into my router and viewed the status page that has the current ip for my router (the ip for the internet side). To my surprise i saw a packet of the http connection that had some XML data in it, like the external ip-address for one. But then when i pressed refresh in IE, or i closed and relogged into my router it didnt send that XML data anymore. Now my question would be why is this? And is there any way i can surely get this XML reply from my router when i connect to it manually? (I don't know much about XML)
Thank you for any assistance.
Kuniva
--------------------------------------------
|
|
|
|
|
I desperately need help on setting up and using the FlatSB with C, no MFC.
I, by all means know nothing about C++ (btw, sorry if i posted this here), and I just migrated from VB.
I found some samples, like JonathanLivingstone's sample (http://www.codeproject.com/dialog/ScrollableChildDialog/ScrollableChildDialog_demo.zip) which is exactly i wanted.
I need to scroll (with FlatSB) my dialog which has about 50 editboxes & labels.
I know how to do this with VB. I just need to use canvas to group all of these controls, and then scroll it.
But I don't know how to do these with win32 API & C.
Please help me!
I really appreciate any help regarding this.
|
|
|
|
|
In my program I have 2 file:input and output.
When I open the first file I am reading the lines where
I have my specific string, other lines I am skiping.
In my output file I need to write my lines with tab delimeter.
How do I do this?
|
|
|
|
|
What are you using to read with: FILE* , istream , CFile , etc?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
|
Then use ostream::write() to write the data to an output stream (e.g., file).
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
hello all,
my name is durval and i've the following problem in my project:
when the color-palette from the windows-desktop (properties)
16-bit (65536) is set. on ms-c++ print-preview (mfc) the
::StretchBlt(...)/::StretchDIBits(...)/::::BitBlt(...)
doesn't work properly. the bitmap is dividing in 2 parts, the
right (1/3 from the bitmap) will be put on the left place and
the left is displaced to the right.
at all the other color-settings there's no problem: 8-bit, 24-bit...
do you know this problem?
please, if everybody could help me, it would be very nice.
thanx a lot,
durval.
the code:
BOOL CDib::Draw(CDC* pDC, CPoint origin, CSize size)
{
if(m_lpBMIH == NULL) return FALSE;
if(m_hPalette != NULL)
::SelectPalette(pDC->GetSafeHdc(), m_hPalette, TRUE);
pDC->SetStretchBltMode(COLORONCOLOR);
// ::BitBlt( pDC->GetSafeHdc(), origin.x, origin.y, m_lpBMIH->biWidth, m_lpBMIH->biHeight, memDC.m_hDC, 0, 0, SRCCOPY );
// ::StretchBlt( pDC->GetSafeHdc(), origin.x, origin.y, size.cx, size.cy, memDC.m_hDC, 0, 0, m_lpBMIH->biWidth, m_lpBMIH->biHeight , SRCCOPY );
::StretchDIBits(pDC->GetSafeHdc(), origin.x, origin.y, size.cx, size.cy,
0, 0, m_lpBMIH->biWidth, m_lpBMIH->biHeight,
m_lpImage, (LPBITMAPINFO) m_lpBMIH, DIB_RGB_COLORS, SRCCOPY);
return TRUE;
}
-------------------------------------------------------------------
system:
Microsoft (R) Windows NT (TM) Workstation
Version 4.0 (Build 1381: Service Pack 6) x86 Uniprocessor Free
-------------------------------------------------------------------
graphic:
BIOS-Datum: 11/17/20
BIOS-Version: Video memory: 1 MB Device Revision: 2.0
Hardware Version 0.0
Adapter:
Setting: 1280 x 1024 x 65536 75 Hz
Typ: i81xnt4-kompatible Grafikkarte
Description: Intel815 Video Accelerator
Memory: 4 MB
Chip-Typ: Intel815
DAC-Typ: Internal
Driver:
Company: <n a="">
Datei(en): i81xnt4.sys, i81xdnt4.dll
Version: <n a="">, 4.0.32
81386745
|
|
|
|
|
Hi Guys,
I'm having a heck of a time doing some rounding here, hoping someone has a quick solution.
Example:
CHAR string[xx] = "1.019", null terminated string holding the current release.
FLOAT instver, intended to hold the float value of string ( I want it to be 1.019 )
When I do:
sscanf ( string, "%5lf", &instver );
My result is always: 1.0189999
I've tried:
instver = atof ( string );
And I still get the same results. I've done some peeking around the helpfile, can't find anything that will let me truncate/round the decimal spots.
Anybody?
Thx.
Mike.
|
|
|
|
|
You are always going to get this degradation of floating point accuracy. You need to read up on how floats are stored in IEEE 754 specification.
Floats are stored as a binary value that is composed of the mantissa and the exponent just like in regular scientific notation, however they are binary, so you are converting a decimal format into binary - this is going to cause round-off error.
It is still basicly fairly accurate. If it is just a cosmetic thing you can use format statements and they will round to the correct value for you. printf("%.3f", val); will do this.
J.
----------------------------
|
|
|
|
|
I'm trying to find "Exact Analysis of Merge sort"- M.Golin & R.Sedgewich - Fourth SIAM Conference on Discrete Mathmatics for my assignment. Could you show me where to find it or if you got it, please send to my email
azury_thanh@yahoo.com
Thank you so much
Study is suffering!!
|
|
|
|
|
merge sort can be implemented in various ways but a very good way to do it is to use the Divide and Conquer Algo.
it divides the array into two.. then sorst the two seperately and then finally merge them back to get the final sorted one.
we use recursive divide calls to divide the array till we get the array with 2 or 1 element.
it runs in time O(n ln n)
if u need the code and the detailed analysis how to derive the complexity.. then mail me.
hope this satisfies u
Deepesh Dhakad
Indian Institute of Information Technology,Allahabad
India
|
|
|
|
|
I have created a lsitbox control, and got a database into MFC application. i am trying to display data from a particular field into the listbox.when i did this
CListBox* pListBox = static_cast<clistbox*> (GetDlgItem(IDC_COURSE));
pListBox->AddString(m_pSet->m_Course);
it is only showing the first one. how can i make display all, and let me choose from it.please let me know
|
|
|
|
|
swerajan wrote:
pListBox->AddString(m_pSet->m_Course);
it is only showing the first one. how can i make display all,
How about a loop?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
One solution is InsertItem().
Kuphryn
|
|
|
|
|
Which would be for a list control, would it not?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
how to convert LPCOLESTR to CString and viceversa ?
|
|
|
|
|
|