|
hi guys, I used appWizard to created a dialog that has a dropdown combobox on it, it's id is DROPDOWNHRSFN, my question is that, inside of its event handler code, how would I be able to obtain a reference of the dropdown combobox? I would like to get the item that the user selects from the combobox. how would I do that? And How would I initialize this combobox with my custom data?
thank you so much
void CDlgDlg::OnDropdownHrsfn()
{
MessageBox("drop down","drop down",MB_OK);
// TODO: Add your control notification handler code here
}
|
|
|
|
|
|
|
As the sig says, Im new to this entire game! Im not only learning VC++, but the IDE to boot! Gosh.. Gimme some Tylenol!!
Ive got a string variable, Number1, I want to convert it Long, but the linker give the message:
error C2664: 'strtol' : cannot convert parameter 1 from 'class CString' to 'const char *'
Heres the code snippit:
===========================================================
GetDlgItemText(IDC_EDIT1, Number1);
GetDlgItemText(IDC_EDIT2, Number2);
CString TmpTxt = "The numbers are " + Number1 + " and " + Number2;
MessageBox( TmpTxt, _T("Error"), MB_ICONINFORMATION | MB_OK);
// Everything above works fine, below is conversion
// which wont work.
long Ans;
Ans = strtol(Number1, NULL, 10);
===========================================================
This is a stupid newbie project, enter two numbers in two Edit Boxes, convert the text var to a long var, add the two, convert it back to text and give a message box with the sum of the two.
I have the Member Variable assigned to IDC_EDIT1 as CString using Number1, and 2 respectively.
I am using eVC++ 3.0 for WinCE.
Any help, thanks much in advance!
This *aint* VB, dats fur sure!
PS
Please reply as if I were a total idiot, becaue I am!
Andrew
New to VC++ programming, working hard to learn.
|
|
|
|
|
The raw CString is not a character string (as you can see.)
PocketBlast wrote:
long Ans;
Ans = strtol(Number1, NULL, 10);
Try
Ans = strtol((LPCSTR)Number1, NULL, 10);
This gives you a pointer to the character data.
"I will find a new sig someday."
|
|
|
|
|
You're using the wrong function. strtol() is only for ANSI strings. Since WinCE is a Unicode OS, use wcstol() instead, which is the Unicode version.
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hello,
I'm using COleDateTime to parse a date and time field from an
input file. First I reorder the input into a string s of the form: "8:30:00 Jan. 25, 1996", and convert it using:
COleDateTime t;
t.ParseDateTime(s, LOCALE_NOUSEROVERRIDE);
This works, but fails on certain dates since ParseDateTime apparently uses
the locale of my country. Now in my case the input dates are always in US format: Jan, Feb, Mar, Apr, .....Oct, Nov, Dec, so I want to force
ParseDateTime to use a US format (i.e. English only).
How do I do that ?????????
I've tried to use the locale code for English_United_States (0x0409),
but it didn't work. What am I doing wrong ??
Please help !
Best Regards,
-Kasper
|
|
|
|
|
Did you try the 3rd parameter of COleDateTime::ParseDateTime?
|
|
|
|
|
No, I did not ! I now use:
t.ParseDateTime(s, LOCALE_NOUSEROVERRIDE, MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ) );
and it works very well.
Thanks, man.
- Kasper
|
|
|
|
|
Hello everyone, I have this XML document and I need to store the content in a C/C++ structure. So far I can use MSXML to load the document and display it but how can I get it into C/C++ struct. I'm completely new to C/C++, can anyone help me to create a C/C++ struct (or linked list) to hold these data and also how to get the XML into the structure created. Many thanks!
<contact>
<personal>
<name>John Moss</name>
<age>28</age>
<house_number>8</house_number>
<street>Polygon Road</street>
<town>London</town>
<country>UK</country>
</personal>
<sport>
<style>Karate</style>
<belt>Second degree black belt</belt>
<champion>1992 1994 1995 1996</champion>
</sport>
</contact>
|
|
|
|
|
I am trying to build a simple linked list and i keep getting the following error: "error C2146: syntax error : missing ';' before identifier 'server'"
here is my code and if anybody can figure it out PLEASE let me know.
#include <fstream>
#include <iostream>
#include <iomanip>
#include <list>
using namespace std;
class server // Actual Data the serverNodes will point to
{
private:
int S_ID;
int Speed;
public:
server(); //Contructor aka (
~server();
};
class request
{
private:
int R_ID;
int Arr_t;
int cpuT;
public:
request();
~request();
};
class serverNode
{
public:
server *entry; //pointer to server object (aka my data)
serverNode *next; //pointer to my next node
serverNode (server *);
~serverNode();
};
serverNode::serverNode( server *p)
{
entry = p;
next = NULL;
}
class LinkedList //list will be responsible for adding,removing etc.
{
private:
serverNode *front; // pointer to the front of my list
serverNode *rear; // pointer to the rear of my list
public:
LinkedList();
~LinkedList();
void insert( server *); //function will insert server data to rear of list
server* remove(void);
server* dis();
};
LinkedList::LinkedList(){front=rear=NULL;}
LinkedList::LinkedList()
server *Linkedlist::dis()
{
front->entry;
}
LinkedList::insert(server *item) //This fucntion will insert next data from the rear
if(rear != NULL)
{
rear->next= new serverNode (item);
rear= rear->next;
}
else
front=rear= new serverNode(item);
}
server *LinkedList::remove(void)
{
server *ret;
if(isEmpty()==false)
{
ret=front->entry;
servernode *tobe_removed = front;
front = front->next;
delete tobe_removed;
if(front==NULL) // if list is becoming an empty list
rear=NULL
}
return ret;
}
int main()
{
int user_in;
cout <<"Welcome to the Washington Heights server system where you network may or may not work\n";
cout << "How many servers you want us to attempt to work with?\n";
cin >> user_in;
return 0;
}
|
|
|
|
|
It would be helpful to actually show the line where compiler stops. I am guessing here :
Sal R. wrote:
LinkedList::LinkedList(){front=rear=NULL;}
LinkedList::LinkedList() //-----> What is it?
server *Linkedlist::dis()
{
front->entry;
}
You have 2(!!!!!) default constructors for LinkedList AND the second one does not have body or terminating ';'
|
|
|
|
|
What would be the best way to create and write into an LPSTREAM
the contents of a CString?
|
|
|
|
|
|
if you want to save the string into a stream:
write the length first, the n the data bytes.
If ANSI/UNICODE might be an issue, either write a "tag" which type is used, or always save as unicode.
So many people long for eternity that don't know what to do on a rainy sunday afternoon. [sighist] | [Agile Programming] [doxygen] If you look for evil in me you will find it whether it's there or not.
|
|
|
|
|
I have some terrible problem
I use following code, but buttons and toolbars sometimes flick. To solve flick's problem with Line/Rectangle/etc. Painting i use m_Context, but this causes another problem ;_(
After of the calling BitBlt function, Buttons and Toolbars repaint.
May be i need to paint buttons to m_Context, but how?
void CMy123Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CPaintDC dc(this);
CRect button;
m_OK.GetWindowRect(&button);
CRect rect;
m_Frame.GetWindowRect(&rect);
//int Width = rect.Width();
//int Height = rect.Height();
int Width = 1000;
int Height = 1000;
m_Context.BitBlt(0, 0, Width, Height, &m_Context,0,0,WHITENESS);
m_Context.LineTo(300,600);
m_Context.LineTo(0,200);
m_Context.SetTextColor(0);
m_Context.DrawText("SSDSDSDSDJKLHklhljk", CRect(200,200,400,400), NULL);
m_Context.TextOut(500,100,m_str);
dc.BitBlt(0,0, Width, Height, &m_Context,0,0,SRCCOPY);
//CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMy123Dlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
int CMy123Dlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
CDC *Canvas=GetDC();
m_Context.CreateCompatibleDC(Canvas);
m_Bitmap.CreateCompatibleBitmap(Canvas,1000,1000);
m_Context.SelectObject(&m_Bitmap);
ReleaseDC(Canvas);
m_i=1;
SetTimer(1,7,NULL);
return 0;
}
void CMy123Dlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
Invalidate();
m_i++;
itoa(m_i,m_str,10);
CDialog::OnTimer(nIDEvent);
}
BOOL CMy123Dlg::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
//return CDialog::OnEraseBkgnd(pDC);
return 0;
}
|
|
|
|
|
Hi,
My application (under development !) has just developed a most unusual problem (well,I've never seen it before !) In the debug window of MS Developer Studio (VC++ Ver 4.0),I get the following lines:-
Warning: Uncaught exception in WindowProc (returning 0).
First-chance exception in Dgvcr.exe: 0xE06D7363: Microsoft C++ Exception.
Warning: Uncaught exception in WindowProc (returning 0).
First-chance exception in Dgvcr.exe: 0xE06D7363: Microsoft C++ Exception.
(The last two lines are repeated many times.) The problem only occurs after the app has been running for some time, but I've no idea where the problem starts.
Anybody got any ideas on how I can pin this down ?? Thanks in advance !
Doug
|
|
|
|
|
start the program in the debugger. i think in VC4, you can find an "Exceptions..." item in the debug menu. find "MS C++ Exception" in the list and change it to "Stop Always". the program will break when that exception happens.
-c
Be very, very careful what you put into that head, because you will never, ever get it out. --Thomas Cardinal Wolsey
|
|
|
|
|
Hi Chris,
Many thanks for your response.
I have now ascertained that the exception is a ResourceException raised during the construction of a CBrush object. I assume from this that I have inadvertently been dynamical creating resources and not releasing them back to the system (would that be correct ??)
I hope that this is not a stupid question, but is there anyway that I can display/trace resources that have been created (and where in my program) up to the point of the exception ? I'd appreciate any advice/help, as I've had little experience of tackling runtime problems like this.
Many thanks !
Doug
|
|
|
|
|
|
Hiya I am writing a program with SQL and an Access Database. I need to set the lenght of the text field (a column) to 600. Can I do this from my program??
I have tried setting it in the database in the design view but it will only allow a maximum of 255 chars. It would be better to be able to set it from the program.
I am using CDatabase and CRecordset and its an ODBC database..
Thanks
grahamoj.
|
|
|
|
|
grahamoj wrote:
I have tried setting it in the database in the design view but it will only allow a maximum of 255 chars
Thats probably because it can't be any longer. So it won't help you if you did it from your program.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Use a Memo field type; these can be 64,000 characters long. A Memo type doesn't have a Length property, so your code will have to handle the 600 character limit prior to storing the values in the table. Hopefully Access doesn't reserve the entire 64,000 character space for each Memo field - that would get ugly really fast - but the Help info doesn't mention how it is implemented.
It is ok for women not to like sports, so long as they nod in the right places and bring beers at the right times.
Paul Watson, on Sports - 2/10/2003
|
|
|
|
|
Hi grahamoj, text can be maximum of 255, however a memo as others have pointed out will suit and the JET database engine doesn't waste any unused space so no problems there.
In order to create fields or modify them programatically (and in the easiest possible way, there are others) you need to use data definition sql statements:
See here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acfundsql.asp[^]
See also in that article at the bottom the intermediate and advanced articles. That should give you all the info you require.
This is something I have done a *lot* but through ADO, not odbc so I can't give you anything more specific.
|
|
|
|
|
Thanks will check it out.
grahamoj.
|
|
|
|
|