|
How to change an int variable to cstring, so that i can post it using AfxMessageBox....
|
|
|
|
|
CString str;
str.Format("%d",5);
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I am a novice student who's trying to learn MFC.
I am trying to access a chipset using i2c.
When I download about 6k byte of information through i2c in DOS program it takes less than 10 seconds, but when I program a download program with MFC, it takes more than 2 minutes to download through i2c.
Please someone tell me what I am missing here, or recommand me a book or something that I can solve this problem.
Thank you
![Roll eyes | :rolleyes:](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_rolleyes.gif)
|
|
|
|
|
Hello,
I am trying to convert a large integer(in a string form) to integer using StrToInt64Ex function. MSDN suggests that this function is defined in shlwapi.h, but it is not defined. I am using Visual C++ 6.0 on windows 2000. Source code is enclosed with the error message here below. Please someone tell me what is wrong with this code ? Is there any other method to convert a large integer? How to proceed further?
Thank you.
Regards,
Mainak.
==============================================================================
#include <windows.h>
#include <Shlwapi.h>
#include <stdio.h>
#include <stdlib.h>
int main ()
{
// with StrToInt64Ex
__int64 a2;
char s2[] = "0xffff";
LONGLONG a3;
StrToInt64Ex (s2, STIF_SUPPORT_HEX, &a3 );
return 0;
}
Compiling...
main.cpp
C:\tmp\str\main.cpp(19) : error C2065: 'StrToInt64Ex' : undeclared identifier
Error executing cl.exe.
str.exe - 1 error(s), 0 warning(s)
==============================================================================
|
|
|
|
|
This is only supported for IE 6.0 or higher. You'll need to add:
#define _WIN32_IE 0x0600
to stdafx.h before the other includes.
(If you look at shlwapi.h you'll see it's wrapped in ifdefs for this value)
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
I upgraded to IE 6.0 still it did not compile.
The header shlwapi.h (version 1) does not have the
function proto. What is your PC configuration?
-Mainak
|
|
|
|
|
|
Instead of StrToInt64Ex, which isn't supported on older Windows version, use plain old sprintf with %I64x or %I64d format specifiers:
char buf[32];
__int64 v;
v = 0x1234567890abcdef;
sprintf(buf, "%I64x", v);
Tomasz Sowinski -- http://www.shooltz.com ** If you're going to rape, pillage and burn, be sure to do things in that order. **
|
|
|
|
|
how do i implement cpu scheduling using the multilevel feedback priority queues? i have 4 io devices and one cpu
abbas
|
|
|
|
|
i build the MDI(base class is CRichEditView) and i want to know the method to get the string(user write) from MDI
|
|
|
|
|
Check CRichEditView::GetRichEditCtrl .
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I am trying to call a function that adds info to a CListCtrl m_List through a pointer.
pointer->foo(CString). Does anyone know how to do this? I keep getting errors. Thanks if you can help.
- Matt Newman / Anti-Linux Activist
-Sonork ID: 100.11179:BestSnowman
†
|
|
|
|
|
Huh?
Perhaps I don't understand the question.
But if it is what I think it is do this :-
pListCtrl->InsertItem(0,"string here");
Nish
I am looking for a free racing game. Old style racing game without any complicated 3D stuff. Around 4 MB download. If anyone has such a game, please inform me.
|
|
|
|
|
Maybe this will make sense
pointer->dostuff(CString strStuff)
dostuff(CString strStuff)
{
m_List.InsertItem(.....)
}
- Matt Newman / Anti-Linux Activist
-Sonork ID: 100.11179:BestSnowman
†
|
|
|
|
|
Matt Newman wrote:
pointer->dostuff(CString strStuff)
What type of object is 'pointer'?
Nish
I am looking for a free racing game. Old style racing game without any complicated 3D stuff. Around 4 MB download. If anyone has such a game, please inform me.
|
|
|
|
|
It is a pointer to my MFC dialog class.
- Matt Newman / Anti-Linux Activist
-Sonork ID: 100.11179:BestSnowman
†
|
|
|
|
|
Matt Newman wrote:
It is a pointer to my MFC dialog class.
I guess you are trying to insert into the list box before the list box has been created. Where did you call the function? You cant call it anywhere before OnInitDialog()
Nish
I am looking for a free racing game. Old style racing game without any complicated 3D stuff. Around 4 MB download. If anyone has such a game, please inform me.
|
|
|
|
|
It has already been created I get static errors at compile time
- Matt Newman / Anti-Linux Activist
-Sonork ID: 100.11179:BestSnowman
†
|
|
|
|
|
Thanks for trying to help me with this. I am just going to restructure the app.
- Matt Newman / Anti-Linux Activist
-Sonork ID: 100.11179:BestSnowman
†
|
|
|
|
|
Trying Open recoedset with "SELECT ID, NAME FROM DTable WHERE NAME="Titan" AND ID=4" i'm receive error message "Not enough parameters. Required 1". The same string in MS Access work properly. Where is error ?
|
|
|
|
|
Ranger wrote:
WHERE NAME="Titan"
I think this should be WHERE NAME='Titan'
Single quote.
Not very sure. My SQL is bad
Nish
I am looking for a free racing game. Old style racing game without any complicated 3D stuff. Around 4 MB download. If anyone has such a game, please inform me.
|
|
|
|
|
Nish [BusterBoy] wrote:
I think this should be WHERE NAME='Titan'
Yes,Nish thats the problem.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Hi.
I have a CComboBox object. I need to set one or more of its strings to represent a *double* data type. For example:
[code]
CComboBox mCbbCandy;
mCbbCandy.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | LBS_NOTIFY | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT, CRect(CPoint(270, 10), CSize(100, 100)), this, IDC_CBB_FLAVORS);
// Setting its value
int i = mCbbCandy.AddString("X");
mCbbCandy.SetItemData(i, 1.99); // $1.99
// Retrieving its value
int i = mCbbCandy.GetCurSel();
double price = mCbbCandy.GetItemData(i);
-----
For some reason, the price does not come out right if I use the decimal point. For example, any whole number works, but not decimal.
How do you set the item data to a double type? Visual C++ gave warnings about data loss because the CComboBox object expected a DWORD instead of a double.
Thanks,
Kuphryn
|
|
|
|
|
SetItemData stores a DWORD, thus you cannot store a float.
Use SetItemDataPtr which allows you to associate a pointer with an item. Now point this to your float
Nish
Oh, I don't know why she's
leaving, or where she's gonna go
I guess she's got her reasons but I just don't wanna know
'Cos for 24 years I've been living next door to Alice
24 years just waitin' for a chance
To tell her how I feel and maybe get a second glance
Now I gotta get used to not living next door to Alice
|
|
|
|
|
A DWORD stores only integer values (in fact, unsigned integers) so when you do:
mCbbCandy.SetItemData(i, 1.99)
the compiler will throw away the .99 and convert the number to a DWORD. Here you've got a problem, because there won't be a way to store a value in there unless it takes up four bytes or less. One option would be to store a pointer to a double in the item data. This is OK, but means that you have to make sure you delete all the values when the combo box is destroyed.
Another option would be to have a container class for doubles (eg std::vector) and store the index to the item in the item data. So, when you add your first double, store 0 in the item data, then to get your double you use m_vecMyDoubles[0].
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|